CAUS-RAG: Algorithmic Interceptor for Mitigating Positional Bias in Technical Code Generation
编号:63
访问权限:仅限参会人
更新:2026-07-22 16:09:34 浏览:33次
Online
摘要
Retrieval-Augmented Generation (RAG) revolutionised the fields of Large Language Models (LLMs) and Natural Language Processing by helping to fetch the latest external knowledge while generating responses. However, standard RAG faces a critical challenge when it comes to technical code genera tion, as it depends solely on semantic similarity, which often leads to failure in retrieving the correct lexical API tokens. The “Lost in-the-Middle” phenomenon in RAG further causes the model to neglect information placed in the middle of a long query prompt. The proposed framework, CAUS-RAG (Confidence Aware Adaptive U-Shape), solves this problem by being an algorithmic interceptor that helps in achieving accurate retrieval and effective context placement. It works based on two principles. Firstly, the framework makes use of a Hybrid Confidence Scoring (HCS) mechanism that aggregates both semantic scores and lexical cues to achieve more code-oriented document retrieval. Secondly, the architecture employs a model-aware U-shaped position permutation tuned through a Position Sensitivity Index (PSI) score in order to place the retrieved chunks based on the model’s positional attention bias. Experiments conducted based on a PyTorch API benchmark across different models such as Phi-3.5 (3.8B), Mistral (7B), and Qwen-2.5 (7B) show a significant performance improvement measured in terms of Exact Match (EM). CAUS-RAG boosts the Exact Match accuracy of Qwen 2.5 from 17.3% to 86.5% and Phi-3.5 from 11.5% to 71.2%
关键词
—Retrieval-Augmented Generation, Positional Bias, Code Generation, Large Language Models, Lost in the Middle, Hybrid Retrieval, BM25
稿件作者
Mithun Martin
SRM Institute of Science and Technology *
Aritra Roy
SRM Institute of Science and Technology *
Grace Shalini T
SRM Institute of Science and Technology *
发表评论