← all repositories
reasoning-machines/pal

PaL: Why ask an LLM to count when Python is right there?

It lets large language models solve reasoning problems by generating Python and letting an interpreter handle the arithmetic they would otherwise mangle.

525 stars Python Language Models
pal
Not currently ranked — collecting fresh signals.
star history

What it does PaL is the reference implementation for the ICML 2023 paper on Program-Aided Language Models. It provides a prompting framework where an LLM drafts interleaved reasoning text and executable code; a ProgramInterface class then runs that code through a Python interpreter and evaluates a user-specified expression to extract the answer. The model outlines the logic, but the runtime does the actual computation.

The interesting bit Instead of chaining more text tokens to solve math, PaL treats the Python runtime as an external coprocessor. The LLM writes the script, but the heavy arithmetic and procedural execution happen outside the model entirely, which neatly sidesteps the classic problem of LLMs confidently botching long division.

Key highlights

  • Implements few-shot prompting for mixed text-and-code reasoning chains
  • Core ProgramInterface glues together an OpenAI LLM backend and a Python execution backend
  • Ships with evaluation scripts for math, date understanding, colored objects, and penguin reasoning tasks
  • Includes GSM-hard, a tougher variant of the GSM8K benchmark, hosted on Hugging Face
  • Added beta support for ChatGPT APIs after the Codex shutdown

Caveats

  • Tightly coupled to the OpenAI API, with legacy references to the discontinued code-davinci-002 still in the docs
  • ChatGPT integration is explicitly labeled beta
  • The repo is a research artifact, not a general-purpose LLM orchestration framework

Verdict Grab it if you want a clean reference for delegating LLM reasoning to an interpreter; look elsewhere if you need something model-agnostic or production-hardened.

Frequently asked

What is reasoning-machines/pal?
It lets large language models solve reasoning problems by generating Python and letting an interpreter handle the arithmetic they would otherwise mangle.
Is pal open source?
Yes — reasoning-machines/pal is open source, released under the Apache-2.0 license.
What language is pal written in?
reasoning-machines/pal is primarily written in Python.
How popular is pal?
reasoning-machines/pal has 525 stars on GitHub.
Where can I find pal?
reasoning-machines/pal is on GitHub at https://github.com/reasoning-machines/pal.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.