passdrill
AI & LLM Engineering · Prompt Engineering · Card 028/039 easy

A team building a math word-problem solver notices that a large language model using standard chain-of-thought prompting writes out a correct step-by-step plan in natural language but still makes an arithmetic slip when computing the final number, producing a wrong answer despite sound reasoning. Gao et al. (2022), "PAL: Program-Aided Language Models," propose an alternative prompting approach specifically to fix this class of error. What does PAL have the model do differently?

  1. PAL asks the model to write out the same natural-language reasoning chain twice independently and takes whichever of the two final numeric answers appears first
  2. PAL replaces every arithmetic step with a request for the model to look up the answer in a retrieved external knowledge base of pre-solved problems
  3. PAL prompts the model to translate the problem into intermediate steps expressed as runnable code (for example Python statements) and hands that generated program to an external interpreter to execute, using the interpreter's output as the final answer instead of having the model compute it itself
  4. PAL fine-tunes the underlying model on millions of additional arithmetic examples so it memorizes correct computations for common operation patterns
Next card → Shuffle