Recent advances in large language models (LLMs) have transformed software development by automatically generating code from natural language. Yet challenges remain in generating fully correct code that aligns with user intent. Our study reveals that LLMs tend to pay less attention to user prompts as more code tokens are generated. We hypothesize that this attention dilution issue is an important reason for code generation errors. To mitigate this issue, we propose Selective Prompt Anchoring (SPA) to guide code LLMs to pay more attention to user intent when generating code. We evaluate SPA using six base LLMs across six benchmarks. Our results demonstrate that SPA enhances Pass@1 by up to 12.9%, consistently outperforming SOTA code generation methods in all settings. Our code is available at https://github.com/magic-YuanTian/Selective-Prompt-Anchoring.
AnchorBench: A Multi-Pathway Benchmark for the Anchoring Effect in LLMs
Saarland University(萨尔大学);Hamburg University of Technology(汉堡工业大学);Helmholtz-Zentrum Hereon(亥姆霍兹中心赫伦);German Research Centre for Artificial Intelligence (DFKI)(德国人工智能研究中心(DFKI))
Sub-SA: Strengthen In-context Learning via Submodular Selective Annotation
School of Electrical and Electronic Engineering, Nanyang Technological University(南洋理工大学电气与电子工程学院);School of Automation, Southeast University(东南大学自动化学院);State Key Laboratory of ASIC and System, Fudan University(复旦大学专用集成电路与系统国家重点实验室)
Beyond the Hivemind: Escaping LLM Homogeneity via Meta-Persona Anchoring and Sequential Temperature Scaling
Politecnico di Milano(米兰理工大学);Information Processing and Telecommunications Center(信息处理与电信中心);Universidad Politécnica de Madrid(马德里理工大学);Banco de España(西班牙银行)
Beyond Prompt Engineering: A Systematic Analysis of Prompt Lexical Sensitivity and Its Impacts on Quality
Shenzhen Technology University(深圳技术大学);The Hong Kong Polytechnic University(香港理工大学);Zhejiang Lab(之江实验室);The Chinese University of Hong Kong(香港中文大学);HKUST (Guangzhou)(香港科技大学(广州))
CannyEdit: Selective Canny Control and Dual-Prompt Guidance for Training-Free Image Editing
Huawei Hong Kong AI Framework & Data Technologies Lab(华为香港AI框架与数据技术实验室);The Hong Kong University of Science and Technology(香港科技大学);Shanghai University of Finance and Economics(上海财经大学)
S$^4$R: Selective Sampling, Subspaces, and Sparse Reconstruction for Compressed Long-Context KV Caching
School of Information Science and Technology, ShanghaiTech University(上海科技大学信息科学与技术学院);Shanghai Engineering Research Center of Intelligent Vision and Imaging(上海智能视觉与成像工程研究中心)
PragLocker: Protecting Agent Intellectual Property in Untrusted Deployments via Non-Portable Prompts
Zhejiang University(浙江大学);Management Center, School of Software Technology (Ningbo), Zhejiang University(浙江大学软件学院(宁波)管理中心);University of Science and Technology of China(中国科学技术大学);Chang'an University(长安大学);Washington University in St. Louis(圣路易斯华盛顿大学)
Selecting What Matters: Semantic Compression-Guided Selective Pooling for Long-Context Embeddings
State Key Laboratory for Novel Software Technology, Nanjing University(南京大学计算机软件新技术国家重点实验室);National University of Singapore(新加坡国立大学);Nanjing University of Posts and Telecommunications(南京邮电大学)
Request Order Matters: Cache-History Sensitivity in Selective KV-Cache Reuse for Rolling Agents
Carnegie Mellon University(卡内基梅隆大学);Capital One(第一资本);University of Chicago(芝加哥大学);University of California, Berkeley(加州大学伯克利分校);University of Southern California(南加州大学);University of Washington(华盛顿大学)
Faithful or Fabricated? A Causal Framework for Rationalization Bias in LLM Judges
School of Computing and Electrical Engineering(计算与电子工程学院);Indian Institute of Technology (IIT) Mandi(印度理工学院(IIT)曼迪);London U.K.(伦敦英国);Warwick Manufacturing Group U.K.(沃里克制造集团英国)
Ministry of Education Key Laboratory of Bioinformatics, BNRIST Bioinformatics Division, Department of Automation, Tsinghua University(教育部生物信息学重点实验室、BNRIST生物信息学分部、自动化系、清华大学);School of Computing and Artificial Intelligence, Fuyao University of Science and Technology(计算与人工智能学院、福耀科技大学);Department of Computer Science and Engineering, Southern University of Science and Technology(计算机科学与工程系、南方科技大学)
TACOMORE: Exploring a replicable prompting protocol for LLM-assisted corpus analysis
Department of Linguistics and Communication, University of Birmingham(伯明翰大学语言学与传播系);Department of Information Engineering and Computer Science, University of Trento(特伦托大学信息工程与计算机科学系);Institute of Foreign Languages and Cultures, University of Tartu(塔尔图大学外国语言与文化研究所)
Seeing is Believing: Robust Vision-Guided Cross-Modal Prompt Learning under Label Noise
Institute of Computing Technology, Chinese Academy of Sciences(中国科学院计算技术研究所);University of Chinese Academy of Sciences(中国科学院大学);Institute of Information Engineering, Chinese Academy of Sciences(中国科学院信息工程研究所);PCALab, VCIP, College of Computer Science, Nankai University(南开大学计算机学院PCALab, VCIP)