[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"glossary-program-aided-language-model::en":3,"gloss-cluster-program-aided-language-model::en":26,"gloss-next-program-aided-language-model::en":9},{"slug":4,"category":5,"name":6,"definition":7,"meta_desc":8,"faq":9,"schema_markup":9,"related":10},"program-aided-language-model","prompt-eng","Program-Aided Language Model (PAL)","A Program-Aided Language Model (PAL) is a prompting pattern where, instead of computing an answer in prose, the model writes a short program — usually Python — whose execution produces the result. Introduced by Gao et al. (2023), PAL splits the work: the LLM reads the problem and expresses the logic as code, while a plain interpreter does the actual arithmetic and control flow deterministically. This sidesteps a core weakness — language models are unreliable calculators but competent code authors — and the same idea appears as Program-of-Thoughts. It matters wherever answers must be exact: pricing math, date and timezone logic, unit conversions, data aggregations, or anything you would not trust to token-by-token 'mental math.' For builders, the practical shape is a sandboxed code-execution step wired after generation, returning the program's output as the answer. Caveats: you must run untrusted code safely (isolated sandbox, timeouts, no network), and the model can still write buggy logic — so validate results and log the generated code for debugging.","PAL has the model write a short program — usually Python — whose execution produces the answer, so arithmetic and logic are computed rather than guessed in prose.",null,[11,14,17,20,23],{"slug":12,"name":13},"chain-of-thought-prompting","Chain-of-Thought Prompting",{"slug":15,"name":16},"code-generation","Code Generation",{"slug":18,"name":19},"function-calling","Function Calling (Tool Use)",{"slug":21,"name":22},"plan-and-solve-prompting","Plan-and-Solve Prompting",{"slug":24,"name":25},"sandbox-environment","Sandbox Environment",[27,31,34,37,39,42,45,48,51,54,57,60],{"slug":28,"category":5,"name":29,"updated_at":30},"analogical-prompting","Analogical Prompting","2026-08-24T02:46:37+00:00",{"slug":32,"category":5,"name":33,"updated_at":30},"automatic-prompt-optimization","Automatic Prompt Optimization",{"slug":35,"category":5,"name":36,"updated_at":30},"chain-of-density","Chain of Density (CoD)",{"slug":12,"category":5,"name":13,"updated_at":38},"2026-08-24T02:46:36+00:00",{"slug":40,"category":5,"name":41,"updated_at":30},"chain-of-verification","Chain-of-Verification",{"slug":43,"category":5,"name":44,"updated_at":38},"chunking","Chunking",{"slug":46,"category":5,"name":47,"updated_at":38},"constrained-decoding","Constrained Decoding",{"slug":49,"category":5,"name":50,"updated_at":38},"context-stuffing","Context Stuffing",{"slug":52,"category":5,"name":53,"updated_at":38},"delimiter","Delimiter",{"slug":55,"category":5,"name":56,"updated_at":30},"directional-stimulus-prompting","Directional Stimulus Prompting",{"slug":58,"category":5,"name":59,"updated_at":30},"emotion-prompting","Emotion Prompting",{"slug":61,"category":5,"name":62,"updated_at":38},"few-shot-prompting","Few-Shot Prompting"]