Existing large language model-based code generation pipelines typically use beam search or sampling algorithms during the decoding process. Although the programs they generate achieve high token-matching-based scores, they often fail to compile or generate incorrect outputs. The main reason is that conventional Transformer decoding algorithms may not be the best choice for code generation. In this work, we propose a novel Transformer decoding algorithm, Planning-Guided Transformer Decoding (PG-TD), that uses a planning algorithm to do lookahead search and guide the Transformer to generate better programs. Specifically, instead of simply optimizing the likelihood of the generated sequences, the Transformer makes use of a planner to generate candidate programs and test them on public test cases. The Transformer can therefore make more informed decisions and generate tokens that will eventually lead to higher-quality programs. We also design a mechanism that shares information between the Transformer and the planner to make our algorithm computationally efficient. We empirically evaluate our framework with several large language models as backbones on public coding challenge benchmarks, showing that 1) it can generate programs that consistently achieve higher performance compared with competing baseline methods; 2) it enables controllable code generation, such as concise codes and highly-commented codes by optimizing modified objective.
PaT: Planning-after-Trial for Efficient Test-Time Code Generation
Department of Computer Science and Engineering, POSTECH, South Korea(韩国POSTECH计算机科学与工程系);Graduate School of Artificial Intelligence, POSTECH, South Korea(韩国POSTECH人工智能研究生院);Microsoft Research Asia, Beijing, China(中国北京微软亚洲研究院)
Content Planning for Neural Story Generation with Aristotelian Rescoring
Information Sciences Institute, University of Southern California(南加州大学信息科学研究所);University of Edinburgh(爱丁堡大学);Columbia University(哥伦比亚大学);University of California Los Angeles(加州大学洛杉矶分校)
Non-myopic Generation of Language Models for Reasoning and Planning
The University of Hong Kong(香港大学);Peking University(北京大学);Zhejiang University(浙江大学);Westlake University(西湖大学);The Hong Kong University of Science and Technology(香港科技大学)
PlanningBench: Generating Scalable and Verifiable Planning Data for Evaluating and Training Large Language Models
Gaoling School of Artificial Intelligence, Renmin University of China(中国人民大学人工智能学院 Gallagher 学校);LLM Department, Hunyuan Team, Tencent(腾讯 Hunyuan 团队 LLM 部门);Beijing Academy of Artificial Intelligence(北京人工智能研究院);The Chinese University of Hong Kong(香港中文大学)
Towards Feedback-to-Plan Decisions for Self-Evolving LLM Agents in CUDA Kernel Generation
Department of Computer Science and Technology, Tsinghua University, Beijing, China(清华大学计算机科学与技术系);Beijing National Research Center for Information Science and Technology, Beijing, China(北京信息科学国家研究中心)
Tree-of-Code: A Hybrid Approach for Robust Complex Task Planning and Execution
Global Innovation Exchange Institution, Tsinghua University(清华大学全球创新学院);Institute of Automation, Chinese Academy of Sciences(中国科学院自动化研究所);Baidu, Inc.(百度公司)
Long and Diverse Text Generation with Planning-based Hierarchical Variational Model
Institute for Artificial Intelligence(人工智能研究院);Beijing National Research Center for Information Science and Technology(北京信息科学与技术国家研究中心);Tsinghua University(清华大学);Baozun(宝尊)
Planning-Query-Guided Model Generation for Model-Based Deformable Object Manipulation
Department of Computer Science, Stevens Institute of Technology(斯蒂文斯理工学院计算机科学系);Department of Robotics, University of Michigan(密歇根大学机器人学系);Robotics Institute, Carnegie Mellon University(卡内基梅隆大学机器人研究所)