The card walks a compact worked example. A word problem asks for the total cost of discounted items plus tax. The model emits a short Python script with variables, loops, and arithmetic. An arrow points to a runtime box that executes the script. The printed result becomes the final answer shown to the user. Code is the intermediate representation; execution is the source of truth.
PAL separates language understanding from computation. The model parses the question, chooses operations, and formats a program. The interpreter handles carries, branching, and library math without token-level guesswork. This pattern generalizes beyond arithmetic to date logic, combinatorics, and data transforms when a safe sandbox is available.
Operational requirements matter. You need a controlled execution environment with timeouts, memory limits, and no network unless explicitly allowed. Capture stdout or return values deterministically and feed them back to the model only if further narration is needed. Validate generated code before run; even benign tasks can produce infinite loops or unsafe imports if the sandbox is loose.
Compared to chain-of-thought alone, PAL trades token verbosity for reliability on tasks with crisp algorithms. Compared to fixed calculators, it flexes to novel formulas described in natural language. Failures shift to syntax errors, wrong variable mapping, or misread problem constraints, which are easier to detect with tests than silent numeric drift. The card’s message is procedural: when the answer is a computed value, let code compute it.