Scratchpad Prompting is a Chain-of-Thought (CoT) technique that explicitly reserves part of a language model's context for intermediate working memory. The prompt instructs the model to use a designated area—often marked with tags like <scratchpad>—to perform step-by-step calculations, store temporary variables, or draft reasoning traces before producing a final, polished answer. This method enforces a clear separation between the reasoning process and the final output, improving transparency and reducing errors in multi-step tasks like mathematical problem-solving or logical deduction.
Glossary
Scratchpad Prompting

What is Scratchpad Prompting?
Scratchpad Prompting is a technique that allocates a section of the model's context window as a 'scratchpad' for intermediate calculations or reasoning traces, keeping the working memory explicit.
By structuring the context window into distinct zones, this approach mimics a human using pen and paper for rough work. It prevents the model from conflating its internal deliberation with the answer it must present, which is crucial for deterministic output formatting and auditability. The technique is closely related to Program of Thoughts (PoT) and Faithful Chain-of-Thought, as it demands that each computational step is explicitly recorded and verifiable within the scratchpad space, enhancing the reliability of complex reasoning.
Key Characteristics of Scratchpad Prompting
Scratchpad Prompting is a technique that allocates a section of the model's context window as a 'scratchpad' for intermediate calculations or reasoning traces, keeping the working memory explicit. It is a foundational method within Chain-of-Thought reasoning paradigms.
Explicit Working Memory
The core mechanism is the dedicated context allocation for intermediate steps. Unlike a standard prompt where reasoning is implicit, the scratchpad provides a structured space (e.g., demarcated by tags like <<scratchpad>>) where the model writes its step-by-step logic before producing a final answer. This separates the reasoning process from the final output, making the model's 'working memory' transparent and inspectable. This is crucial for debugging complex reasoning and ensuring faithful chain-of-thought.
Deterministic Output Formatting
Scratchpad prompting enforces a strict output schema. The model is explicitly instructed to first use the scratchpad area and then provide a final answer in a specified format. Common patterns include:
- Dual-section prompts:
Reasoning: [scratchpad]\n###\nFinal Answer: [answer] - Programmatic separation: Using XML tags or code block fences to isolate the scratchpad. This structured approach is a precursor to more advanced structured output generation techniques like JSON or XML enforcement, reducing variability and improving parsing reliability for downstream systems.
Intermediate State Persistence
The scratchpad acts as a non-volatile buffer within the context window. For multi-turn interactions or long, complex problems, the model can reference its own earlier scratchpad notes, simulating a form of short-term memory. This is distinct from the model's internal hidden states; it's an explicit, human-readable record. This persistence is key for tasks requiring iterative refinement or self-correction, as the model can review and amend its own prior reasoning steps explicitly listed in the scratchpad.
Reduction of Reasoning Errors
By externalizing the reasoning chain, scratchpad prompting mitigates reasoning collapse and operational errors. The model is less likely to skip steps or make silent arithmetic mistakes when it must write each step. This aligns with process supervision principles. It also allows for the application of stepwise verification, where each line of the scratchpad can be checked programmatically or by a secondary agent. This characteristic directly supports techniques like Chain-of-Verification (CoVe) and Self-Critique Prompting.
Foundation for Advanced Techniques
Scratchpad prompting is not an endpoint but a foundational primitive for more sophisticated reasoning frameworks:
- Program of Thoughts (PoT): The scratchpad naturally evolves to contain executable code snippets.
- ReAct (Reasoning + Acting): The scratchpad holds the 'Reasoning' step before an 'Action' (tool call) is taken.
- Tree of Thoughts (ToT): Multiple scratchpads can represent different branches in a reasoning tree.
- Self-Ask: The scratchpad holds the generated sub-questions and their answers. It provides the structural template upon which these agentic cognitive architectures are built.
Context Window Management
Implementing scratchpad prompting requires careful context budget allocation. The scratchpad consumes tokens from the same fixed context window as the instruction and the final answer. Effective use involves:
- Instructional clarity to keep the scratchpad focused and avoid verbose meandering.
- Potential use of context compression techniques for very long reasoning traces.
- Strategic placement within the prompt to minimize recency bias. Poor management can lead to the scratchpad itself causing context truncation, defeating its purpose. This ties directly to the broader engineering challenge of context window management.
How Scratchpad Prompting Works: Mechanism and Implementation
Scratchpad Prompting is a technique that allocates a section of the model's context window as a 'scratchpad' for intermediate calculations or reasoning traces, keeping the working memory explicit.
Scratchpad Prompting is a Chain-of-Thought technique that explicitly reserves part of a prompt's context window for intermediate reasoning. The model is instructed to use this designated area—the scratchpad—for step-by-step calculations, variable tracking, or logical deductions before producing a final answer. This mechanism externalizes the model's working memory, making the reasoning process transparent and less prone to error propagation within its internal state. It is particularly effective for multi-step arithmetic, code debugging, and logical planning tasks.
Implementation involves clear instructional demarcation within the prompt, such as ## Scratchpad: or **Working:**. The model writes its stepwise reasoning under this header, and the final answer is placed in a separate, designated section like ## Final Answer:. This structured separation prevents the reasoning trace from contaminating the output and allows for post-hoc verification. It is a foundational pattern for ReAct frameworks and Program-Aided Language Models (PAL), where the scratchpad may contain executable code snippets or tool-call plans.
Example Use Cases for Scratchpad Prompting
Scratchpad Prompting is a versatile technique for complex reasoning. These cards detail specific domains where allocating explicit working memory in the context window provides significant performance gains.
Mathematical and Symbolic Reasoning
Scratchpad Prompting is foundational for solving multi-step arithmetic, algebra, and calculus problems. The model uses the allocated scratchpad to:
- Perform intermediate calculations step-by-step, reducing cumulative error.
- Track variable substitutions and algebraic manipulations.
- Execute generated code snippets in a
Program of Thoughts(PoT) style, where Python code for calculation is written to the scratchpad before producing a final numeric answer. This method transforms the model's context from a static input to a dynamic worksheet, crucial for problems like "If a train leaves Station A at 60 mph..." where multiple interdependent values must be tracked.
Multi-Hop Question Answering
This technique is essential for questions requiring synthesis of information from multiple, disparate pieces of context. The scratchpad acts as a working memory buffer where the model can:
- Explicitly list extracted facts from different parts of the provided documents.
- Draw logical connections between these facts to build a reasoning chain.
- Record sub-questions and their answers before synthesizing a final response.
For example, when asked "What was the economic policy of the leader who succeeded the inventor of the lightbulb?", the model would use the scratchpad to note:
1. Lightbulb inventor: Thomas Edison. 2. Edison's successor in relevant context: [Extracted Name]. 3. That leader's economic policy: [Extracted Policy].
Algorithmic and Code Tracing
When tasked with explaining, debugging, or simulating code execution, a scratchpad allows the model to mimic a programmer's mental model. Key uses include:
- Manually tracing variable states through loops and conditional branches.
- Writing pseudo-execution logs (e.g.,
i=0, arr[0]=5, sum=5; i=1, arr[1]=3, sum=8;). - Breaking down complex recursive calls by stacking activation records. This provides a transparent, step-by-step audit trail for the model's understanding, making its final explanation or bug diagnosis more reliable and verifiable than an intuitive, single-output response.
Planning and Strategic Breakdown
For tasks requiring the generation of a multi-step plan—such as project timelines, game strategies, or procedural instructions—the scratchpad serves as a dedicated planning space. The model can:
- List high-level goals and constraints.
- Decompose goals into sequential or parallel sub-tasks using a
Least-to-Mostapproach. - Evaluate potential dependencies or conflicts between steps.
- Iteratively refine the plan before outputting a finalized, structured list. This separates the messy, iterative planning process from the clean, final directive presented to the user.
Logical Deduction and Constraint Satisfaction
Puzzles like logic grid puzzles ("Einstein's Riddle"), syllogisms, or scheduling problems with multiple constraints are ideally suited for scratchpad prompting. The model uses the space to:
- Create and populate a visual reasoning grid using text characters.
- Systematically apply constraints (e.g., "The blue house is not next to the doctor") to eliminate possibilities.
- Track positive deductions and propagate their implications. This externalizes the working memory needed to manage combinatorial possibilities, preventing the model from losing track of intermediate deductions in a long, complex chain of reasoning.
Scientific and Causal Reasoning
In domains like physics, biology, or economics, scratchpad prompting helps models reason through causal chains and system interactions. The model can:
- Diagram simple systems using text (e.g.,
A -> B -> Cfor causal links). - Perform qualitative reasoning about equilibrium states or feedback loops.
- List known principles (e.g., laws of thermodynamics) and apply them stepwise to a scenario.
- Separate observation from inference, reducing the tendency to confabulate. This structured approach is a step toward more faithful Chain-of-Thought, where each step in the scratchpad has a verifiable role in reaching the conclusion.
Scratchpad Prompting vs. Related Techniques
A feature comparison of Scratchpad Prompting against other prominent Chain-of-Thought reasoning techniques, highlighting differences in mechanism, output, and tool use.
| Feature / Mechanism | Scratchpad Prompting | Chain-of-Thought (CoT) | ReAct (Reasoning + Acting) | Program of Thoughts (PoT) |
|---|---|---|---|---|
Primary Goal | Explicitly allocate context for intermediate working memory | Elicit a step-by-step reasoning trace before the final answer | Interleave reasoning with external tool/API actions | Generate executable code as the reasoning intermediary |
Output Structure | Dedicated 'scratchpad' section within the single response | Free-form reasoning text followed by a final answer | Iterative cycles of 'Thought:', 'Action:', 'Observation:' | Code block (e.g., Python) with execution results and final answer |
External Tool Integration | Not inherent; tools can be simulated in the scratchpad | Not inherent; reasoning is internal | Core to the framework; actions are tool executions | Core to the framework; code is executed in an interpreter |
Context Window Usage | Structured partitioning (prompt + scratchpad + answer) | Sequential consumption for reasoning and answer | Expands with each action/observation cycle | Compact; code often more token-efficient than verbose reasoning |
Deterministic Formatting | High (explicit section headers and delimiters) | Low to Medium (free-form text, though often patterned) | High (strict template for thought/action/observation) | High (structured code syntax and comment conventions) |
Hallucination Risk in Steps | Medium (internal reasoning, no external verification) | High (purely internal, unverified reasoning) | Lower (actions grounded by external observations) | Lowest (calculations offloaded to deterministic code runtime) |
Best Suited For | Multi-step arithmetic, symbolic manipulation, keeping work organized | General complex reasoning (math, logic, commonsense QA) | Tasks requiring dynamic information lookup (e.g., search, DB query) | Problems requiring precise computation, algorithms, or data manipulation |
Example Trigger/Instruction | "Use the scratchpad below for your calculations." | "Let's think step by step." or few-shot examples with reasoning | "Determine the next action. Use tools if needed." | "Write a Python program to solve this problem." |
Frequently Asked Questions
Scratchpad Prompting is a technique that allocates a section of the model's context window as a 'scratchpad' for intermediate calculations or reasoning traces, keeping the working memory explicit.
Scratchpad Prompting is a Chain-of-Thought (CoT) technique that explicitly reserves a dedicated section within a language model's prompt or context window for intermediate reasoning, calculations, or step-by-step working memory. Unlike standard CoT where reasoning is interleaved with the final answer, scratchpad prompting structures the output to separate the 'scratchpad' area from the final, polished response. This method forces the model to externalize its working process, making the reasoning trace a first-class citizen in the generation task. It is particularly effective for complex, multi-step problems in mathematics, coding, and logical deduction where maintaining state across steps is crucial.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Scratchpad Prompting is part of a broader family of techniques designed to structure a model's internal reasoning process. These related methods focus on eliciting, managing, and verifying step-by-step cognitive traces.
Chain-of-Thought Prompting (CoT)
The foundational technique that Scratchpad Prompting operationalizes. Chain-of-Thought (CoT) explicitly instructs a language model to articulate its intermediate reasoning steps before delivering a final answer. This decomposes complex problems, making the model's 'thinking' visible and significantly improving performance on arithmetic, commonsense, and symbolic reasoning tasks.
- Core Mechanism: Adds the instruction 'Let's think step by step' or provides few-shot examples with reasoning traces.
- Key Benefit: Transforms the model's output from an opaque answer to an interpretable reasoning chain.
- Direct Relationship: Scratchpad Prompting provides a dedicated, structured space within the context window where this CoT reasoning is performed and maintained.
Program of Thoughts (PoT)
A specialized reasoning paradigm where the model's 'scratchpad' is used to generate executable code. In Program of Thoughts (PoT), the language model writes code snippets (e.g., Python) as its intermediate reasoning step, which is then executed by an interpreter to obtain precise computational results.
- Scratchpad as Code Editor: The allocated context is used for writing, debugging, and sometimes explaining the generated program.
- Use Case: Ideal for mathematical calculations, algorithmic problems, and data manipulation where symbolic precision is critical.
- Advantage over Pure CoT: Offloads exact computation to a deterministic runtime, eliminating arithmetic hallucinations common in pure language-based reasoning.
Self-Consistency
A decoding strategy that leverages multiple reasoning 'scratchpads' to arrive at a more robust answer. Self-Consistency runs a Chain-of-Thought or Scratchpad prompt multiple times, sampling a diverse set of reasoning paths. The final answer is selected by a majority vote over the conclusions from each independent scratchpad.
- Process: 1. Generate N distinct reasoning traces (scratchpads). 2. Extract the final answer from each. 3. Choose the most frequent answer.
- Purpose: Mitigates the variability and potential errors in any single reasoning chain.
- Architectural Implication: Requires the model to generate and the system to manage multiple, separate reasoning contexts, highlighting the importance of scratchpad isolation and comparison.
ReAct (Reasoning + Acting)
A framework that extends the scratchpad concept to interleave reasoning with external actions. In ReAct, the model's working memory is used to maintain a trace of Thoughts, Actions, and Observations. The scratchpad tracks the plan, the executed tool/API call, and the result, creating a loop for dynamic problem-solving.
- Scratchpad Structure:
Thought: I need to find the current weather. Action: search_api('London weather'). Observation: The API returns '22°C and sunny'. - Key Difference: The scratchpad is not just for internal calculation but serves as the control flow and state memory for an interactive agent.
- Application: Enables reliable tool use, web navigation, and multi-step information gathering tasks.
Tree of Thoughts (ToT)
A prompting framework that generalizes the linear scratchpad into a searchable graph of reasoning states. Tree of Thoughts (ToT) frames reasoning as a search problem where each 'thought' (node) is a coherent language sequence that serves as an intermediate step. The model uses its scratchpad to evaluate, explore, and backtrack through different reasoning branches.
- Beyond Linear Chains: Allows for exploration of multiple solution paths simultaneously.
- Scratchpad Role: Holds the current state of the search tree, candidate thoughts, and evaluation metrics.
- Use Case: Complex planning, creative writing, and strategic game play where a single chain of thought is insufficient.
Faithful Chain-of-Thought
A quality benchmark for the content generated within a scratchpad. Faithful Chain-of-Thought refers to a reasoning trace where the intermediate steps are logically coherent, factually correct, and genuinely instrumental in deriving the final answer—not a post-hoc rationalization.
- Critical Evaluation: Not all step-by-step output is faithful; models can generate plausible-but-incorrect reasoning.
- Implication for Scratchpad Design: Prompts must be engineered to elicit causal reasoning, not just descriptive narration.
- Verification Techniques: Methods like Stepwise Verification and Chain-of-Verification (CoVe) are used to check the faithfulness of each scratchpad step.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us