TL;DR
This paper introduces "language model cascades," a framework for composing language models (LMs) as probabilistic programs. This approach unifies various existing techniques like chain-of-thought prompting and tool use, enabling more complex reasoning by treating LM outputs as random variables within a probabilistic graphical model.
What Problem Does This Paper Address?
Large language models (LLMs) have shown impressive few-shot learning capabilities, leading to various methods for enhancing their reasoning abilities. These include techniques like "scratchpads," "chain of thought," "verifiers," "STaR," and "selection-inference," which often involve repeated interactions with LMs or composing multiple LMs. However, these methods are often ad-hoc and lack a unifying theoretical framework. This paper addresses this by proposing a probabilistic programming language (PPL) perspective to formalize and extend these techniques, treating strings as complex data types within probabilistic models.
Methods
The core contribution is the formalization of "language model cascades" using probabilistic programming. This framework views the composition of LMs as a probabilistic program where random variables can take string values. LMs are used to parameterize the conditional distributions of these string-valued random variables. The paper demonstrates how existing techniques can be represented within this framework:
- Scratchpads/Chain of Thought: Modeled as introducing intermediate "thought" variables that are sampled from an LM before generating the final answer.
- Verifiers: Represented as a separate model that assigns a probability of correctness to a generated thought or answer, allowing for filtering or rejection of incorrect reasoning paths.
- STaR (Self-Taught Reasoner): Interpreted as a stochastic EM-like procedure for fine-tuning LMs, where "thoughts" are imputed and then used to update model parameters.
- Selection-Inference: Modeled as a cascade where one LM selects relevant facts, and another infers new information based on those facts.
- Tool Use: Integrated by allowing LM-generated programs to call external tools (like a calculator) as part of the probabilistic model.
The implementation uses a trace-based PPL embedded in Python, supporting arbitrary control flow and recursion.
Datasets
The paper does not introduce new datasets. Instead, it discusses how existing techniques are applied to various tasks and benchmarks, often using few-shot examples or existing datasets for training and evaluation. For instance, the "Twenty Questions" task from BigBench is used for experimental evaluation.
Key Insights and Ideas
- Unifying Framework: The PPL perspective provides a powerful and unified way to understand and extend diverse LM reasoning techniques, moving beyond ad-hoc methods.
- Strings as Random Variables: Treating strings as complex data types in probabilistic models opens up new possibilities for modeling and reasoning with language.
- Probabilistic Programming for LMs: This approach allows leveraging established PPL inference and training techniques for complex LM compositions.
- Generative Models for Reasoning: Cascades can be viewed as generative models that explicitly model the reasoning process, not just the final output.
- Flexibility in Model Structure: The framework supports dynamic structures, control flow, and interactions with external tools, making it highly adaptable.
Key Results
The paper is primarily a position paper and a formalization of existing ideas, rather than a report on extensive empirical results. However, it demonstrates the applicability of the cascade framework to several tasks:
- Chain of Thought and Verifiers: The paper provides code examples and conceptual models for these techniques, illustrating how they fit into the cascade framework.
- Selection-Inference: A model is described for this task, highlighting its representation as a cascade.
- Tool Use: The framework is shown to accommodate LM use of external tools like calculators.
- Twenty Questions Task: Preliminary experiments using a LaMDA 137B model on the "Twenty Questions" task achieved a 29% success rate, demonstrating the potential of cascades for interactive reasoning.
Limitations and Future Work
- Inference Efficiency: A significant challenge is efficient probabilistic inference in models with string-valued random variables. The paper acknowledges that current work does not evaluate methods beyond rejection sampling.
- Exploration of Inference Techniques: Future work will explore emulating posterior inference by training LMs to "fill in the blanks" for unknown variables, similar to foundation posteriors.
- Program Synthesis: The authors suggest exploring program synthesis techniques to automatically discover cascade structures for target tasks.
- Multimodal Settings: The ideas presented are applicable to multimodal settings, allowing for the combination of image and text models.
- Fine-tuning and Prompting: Future work will investigate fine-tuning methods that go beyond few-shot prompting.
Summary updated