Lune

ICML2025Top-tier venue

PENCIL: Long Thoughts with Short Memory

Chenxiao Yang, Nathan Srebro, David McAllester, Zhiyuan Li

Abstract

While state-of-the-art LLMs have demonstrated great promise of using long Chains-of-Thought (CoT) to boost reasoning, scaling it up to more challenging problems at test-time is fundamentally limited by suboptimal memory usage -intermediate computations accumulate indefinitely in context even no longer needed for future thoughts. We introduce PENCIL, which incorporates a novel reduction mechanism into the autoregressive generation process that recursively clean up intermediate thoughts based on patterns learned from training. By iteratively generating and erasing thoughts, PENCIL can think deeper to solve harder problems using shorter context and less computes. Empirically, we observe PENCIL is significantly more effective and efficient than CoT. For example, we demonstrate PENCIL with a small 25M-parameter transformer and 2048 context length solves Einstein's puzzle -a task that challenges much larger models like GPT-4. Theoretically, we prove PENCIL can perform universal efficient computation by simulating any Turing machines with optimal time and space complexity, and thus can solve arbitrary computable tasks that are otherwise intractable for vanilla CoT. Response : Let's break this problem down into parts! First, let's figure out how many toys were in all blue bags. Looking at the blue bags, they made 3 bags with 5 toys in each, so multiplying 3 × 5 = 15. There were 15 toys in all blue bags. That's just part of the story though -we still need to know how many toys were in all red bags. Looking at the red bags, they made 2 bags with 4 toys in each, so multiplying 2 × 4 = 8. There were 8 toys in all red bags. Now that we know both amounts, we can find the total toys by adding the toys from blue and red bags together: 15 + 8 = 23. There were 23 toys used in total. ...[EndOfPrompt][CALL]Let's break this problem down into parts! [CALL] First, let's figure out how many toys were in all blue bags. Looking at the blue bags, they made 3 bags with 5 toys in each, so multiplying 3 × 5 = 15. [SEP] There were 15 toys in all blue bags. [RETURN] Response : There were 23 toys used in total. Chain-of-Thought PENCIL ...[EndOfPrompt][CALL]Let's break this problem down into parts! There were 15 toys in all blue bags. ...[EndOfPrompt][CALL]Let's break this problem down into parts! There were 15 toys in all blue bags. [CALL] That's just part of the story though -we still need to know how many toys were in all red bags. Looking at the red bags, they made 2 bags with 4 toys in each, so multiplying 2 × 4 = 8. [SEP] There were 8 toys in all red bags. [RETURN] ...[EndOfPrompt][CALL]Let's break this problem down into parts! There were 15 toys in all blue bags. There were 8 toys in all red bags. Now that we know both amounts, we can find the total toys by adding the toys from blue and red bags together: 15 + 8 = 23. [SEP]There were 23 toys used in total. [RETURN]

Ask Lune

Ask anything. The answer quotes the paper.

Lune reads all of it and the papers around it, then shows you the passages behind every answer.

Questions to start from

Lune answers from

the full paper · 4 top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Cited by top-tier papers4

  1. Constant Bit-size Transformers Are Turing CompleteQian Li, Yuyi WangNeurIPS 2025 · 21 citations
  2. Efficient Turing Machine Simulation with TransformersQian Li, Yuyi WangICLR 2026 · 5 citations
  3. Do LLMs Encode Functional Importance of Reasoning Tokens ?Janvijay Singh, Dilek Hakkani-TürACL 2026 · 3 citations
  4. Beyond the Context Window: Scaling Agentic RL via End-to-end Optimized Context CompressionMiao Lu, Weiwei Sun, Weihua Du, Zhan Ling et al.ACL 2026

Builds on25

  1. Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
  2. Large Language Models are Zero-Shot ReasonersTakeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo et al.NeurIPS 2022 · 8,168 citations
  3. Tree of Thoughts: Deliberate Problem Solving with Large Language ModelsShunyu Yao, Dian Yu, Jeffrey Zhao, Izhak Shafran et al.NeurIPS 2023 · 5,068 citations
  4. Self-Refine: Iterative Refinement with Self-FeedbackAman Madaan, Niket Tandon, Prakhar Gupta, Skyler Hallinan et al.NeurIPS 2023 · 4,972 citations
  5. Efficiently Modeling Long Sequences with Structured State SpacesAlbert Gu, Karan Goel, Christopher RéICLR 2022 · 3,482 citations

Related papers

  1. Chain-of-Thought Provably Enables Learning the (Otherwise) UnlearnableChenxiao Yang, Zhiyuan Li, David WipfICLR 2025
  2. Towards Revealing the Mystery behind Chain of Thought: A Theoretical PerspectiveGuhao Feng, Bohang Zhang, Yuntian Gu, Haotian Ye et al.NeurIPS 2023 · 470 citations
  3. Recursion of Thought: A Divide-and-Conquer Approach to Multi-Context Reasoning with Language ModelsSoochan Lee, Gunhee KimACL Findings 2023 · 9 citations
  4. Analyzing the Power of Chain of Thought through Memorization CapabilitiesLijia Yu, Xiao-Shan Gao, Lijun ZhangNeurIPS 2025 · 2 citations
  5. Correct, Concise and Complete: Multi-stage Training For Adaptive ReasoningNathanaël Carraz Rakotonirina, Ren Pang, Neha Anna John, Michael Bohlke-Schneider et al.ACL Findings 2026
Dusk over the sea between two cliffs drawn in fine vertical lines