Program-Aided Language Models (PAL) is a Chain-of-Thought (CoT) technique that offloads precise computation from the language model to a deterministic interpreter. Instead of generating a textual narrative of reasoning steps, the model writes executable code—typically in Python—within its response. This code, containing the logical and arithmetic operations needed to solve the problem, is then executed in a sandboxed environment. The final output is the result of this code execution, not the model's direct textual generation, which dramatically improves accuracy for mathematical, symbolic, and algorithmic tasks by eliminating arithmetic hallucinations and logical errors inherent in autoregressive text generation.
