From Token to Line: Enhancing Code Generation with a Long-Term Perspective
Not on the map. Why?
Abstract (arXiv)
The emergence of large language models (LLMs) has significantly promoted the development of code generation task, sparking a surge in pertinent literature. Current research is hindered by redundant generation results and a tendency to overfit local patterns in the short term. Although existing studies attempt to alleviate the issue by adopting a multi-token prediction strategy, there remains limited focus on choosing the appropriate processing length for generations. By analyzing the attention between tokens during the generation process of LLMs, it can be observed that the high spikes of the attention scores typically appear at the end of lines. This insight suggests that it is reasonable to treat each line of code as a fundamental processing unit and generate them sequentially. Inspired by this, we propose the LSR-MCTS algorithm, which leverages MCTS to determine the code line-by-line and select the optimal path. Further, we integrate a self-refine mechanism at each node to enhance diversity and generate higher-quality programs through error correction. Extensive experiments and comprehensive analyses on three public coding benchmarks demonstrate that our method outperforms the state-of-the-art performance approaches.
Key facts. Cited by 4 papers in the map (data through 14 Oct 2026). Builds on 51 of its 72 references that are in the map. First posted on arXiv 10 Apr 2025.
Builds on
51 of 72 references.
References · 51
- 2023GPT-4 Technical Reportcited by 18,396
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,132
- 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,695
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,326
- 2023Reflexion: Language Agents with Verbal Reinforcement Learningcited by 4,276
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2023Self-Refine: Iterative Refinement with Self-Feedbackcited by 3,442
- 2023Mistral 7Bcited by 3,164
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2024Mixtral of Expertscited by 1,823
38 more
- 2022Competition-Level Code Generation with AlphaCodecited by 1,462
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
- 2023PaLM 2 Technical Reportcited by 1,162
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 885
- 2023StarCoder: may the source be with you!cited by 799
- 2023Large Language Modelscited by 780
- 2021Cross-Task Generalization via Natural Language Crowdsourcing Instructionscited by 699
- 2023Language Agent Tree Search Unifies Reasoning Acting and Planning in Language Modelscited by 574
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 498
- 2023OPERA: Alleviating Hallucination in Multi-Modal Large Language Models via Over-Trust Penalty and Retrospection-Allocationcited by 478
- 2024Better & Faster Large Language Models via Multi-token Predictioncited by 360
- 2023CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-Xcited by 300
- 2021CodeNet: A Large-Scale AI for Code Dataset for Learning a Diversity of Coding Taskscited by 200
- 2023Planning with Large Language Models for Code Generationcited by 182
- 2023Large Language Models as Analogical Reasonerscited by 107
- 2024Natural Language Understanding and Inference with MLLM in Visual Question Answering: A Surveycited by 76
- 2024Benchmarking Multimodal Retrieval Augmented Generation with Dynamic VQA Dataset and Self-adaptive Planning Agentcited by 65
- 2022The Past Mistake is the Future Wisdom: Error-driven Contrastive Probability Optimization for Chinese Spell Checkingcited by 56
- 2023On the (In)Effectiveness of Large Language Models for Chinese Text Correctioncited by 54
- 2024Make Every Move Count: LLM-based High-Quality RTL Code Generation Using MCTScited by 43
- 2023Hot or Cold? Adaptive Temperature Sampling for Code Generation with Large Language Modelscited by 38
- 2022Learning from the Dictionary: Heterogeneous Knowledge Guided Fine-tuning for Chinese Spell Checkingcited by 31
- 2022Contrastive Learning with Hard Negative Entities for Entity Set Expansioncited by 26
- 2022Linguistic Rules-Based Corpus Generation for Native Chinese Grammatical Error Correctioncited by 25
- 2024Perception Compressor: A Training-Free Prompt Compression Framework in Long Context Scenarioscited by 23
- 2025DAST: Context-Aware Compression in LLMs via Dynamic Allocation of Soft Tokenscited by 22
- 2022Automatic Context Pattern Generation for Entity Set Expansioncited by 21
- 2023Vision, Deduction and Alignment: An Empirical Study on Multi-modal Knowledge Graph Alignmentcited by 19
- 2023SeqGPT: An Out-of-the-box Large Language Model for Open Domain Sequence Understandingcited by 18
- 2023A Frustratingly Easy Plug-and-Play Detection-and-Reasoning Module for Chinese Spelling Checkcited by 15
- 2025Refine Knowledge of Large Language Models via Adaptive Contrastive Learningcited by 15
- 2022Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checkingcited by 14
- 2024VerMCTS: Synthesizing Multi-Step Programs using a Verifier, a Large Language Model, and Tree Searchcited by 14
- 2025One Example Shown, Many Concepts Known! Counterexample-Driven Conceptual Reasoning in Mathematical LLMscited by 14
- 2023Correct Like Humans: Progressive Learning Framework for Chinese Text Error Correctioncited by 13
- 2023MESED: A Multi-modal Entity Set Expansion Dataset with Fine-grained Semantic Classes and Hard Negative Entitiescited by 13
- 2022Embracing Ambiguity: Improving Similarity-oriented Tasks with Contextual Synonym Knowledgecited by 12
50 most cited of 51 All 51 (JSON)
Built on by
Citing papers per year: 2025: 3; 2026: 1.
4 papers.
- 2025Optimizing Prompt Sequences using Monte Carlo Tree Search for LLM-Based Optimizationcited by 9
- 2025AdmTree: Compressing Lengthy Context with Adaptive Semantic Treescited by 8
- 2026SemantiCache: Efficient KV Cache Compression via Semantic Chunking and Clustered Mergingcited by 5
- 2025RPM-MCTS: Knowledge-Retrieval as Process Reward Model with Monte Carlo Tree Search for Code Generationcited by 1
- 2026SemantiCache: Efficient KV Cache Compression via Semantic Chunking and Clustered Merging15 Mar 2026
- 2025AdmTree: Compressing Lengthy Context with Adaptive Semantic Trees4 Dec 2025
- 2025RPM-MCTS: Knowledge-Retrieval as Process Reward Model with Monte Carlo Tree Search for Code Generation25 Nov 2025
- 2025Optimizing Prompt Sequences using Monte Carlo Tree Search for LLM-Based Optimization8 Aug 2025