paper-with-me

홈 › Papers

A Semantic-based Optimization Approach for Repairing LLMs: Case Study on Code Generation

2025-03-17 · Jian Gu, Aldeida Aleti, Chunyang Chen, Hongyu Zhang

Language Models (LMs) are widely used in software engineering for code generation, but they may produce code with errors. Rather than repairing the generated code, an alternative way is to address the underlying failures of models. LM repair offers a lightweight solution to this challenge: it requires minimal data, reduces computational costs, and reduces the side effects. Unlike retraining, LM repair focuses on applying tailored updates to targeted neurons, making it ideal for scenarios with limited resources, high-performance demands, or strict safety requirements. In this paper, we propose \ul{S}emantic \ul{T}argeting for \ul{A}nalytical \ul{R}epair (\textsc{STAR}), a pioneering and novel semantic-based optimization approach for repairing LLMs. \textsc{STAR} realizes main operations in LM repair methods in an optimization process, including locating `buggy neurons'', solving neuron patches'', and patching `buggy neurons''. Correspondingly, it computes the deltas of weight matrix as the prior information to guide optimization; and attributes the targeted layers and neurons leveraging statistical insights. The neuron patches are computed with a solid semantic-based analytical formula, which directly bridges the changes to logits with the deltas of neurons, by steering latent representations. Compared to the prior work of LM repair (\textsc{MINT}) and optimization methods (\textsc{SGD}), \textsc{STAR} integrates their strengths while mitigating their limitations. \textsc{STAR} supports solving multiple failures together, significantly improving the usefulness. Evaluated on three code generation tasks using popular code LMs, \textsc{STAR} demonstrates superior effectiveness. Additionally, \textsc{STAR} exhibits better efficiency. In terms of side effects, namely the balance between generalization and specificity, \textsc{STAR} outperforms prior work by a significant margin.

📄 PDF Abstract BibTeX arXiv:2503.12899

Code (0)

등록된 구현이 없습니다.

Tasks

Code GenerationSpecificity

Methods 이 논문이 사용한 방법론

Patching Activation patching studies the model's computation by altering its latent representations, the token embeddings in transformer-based language models, during the inference process

Similar Papers 제목 키워드 기반

A Study of In-Context-Learning-Based Text-to-SQL Errors

2025-01-16 · Jiawei Shen, Chengcheng Wan, Ruoyi Qiao, Jiazhen Zou 외

Large language models (LLMs) have been adopted to perform text-to-SQL tasks, utilizing their in-context learning (ICL) capability to translate natural language questions into structured query language (SQL). However, suc…

In-Context LearningText to SQLText-To-SQL

"Oops, Did I Just Say That?" Testing and Repairing Unethical Suggestions of Large Language Models with Suggest-Critique-Reflect Process

2023-05-04 · Pingchuan Ma, Zongjie Li, Ao Sun, Shuai Wang

As the popularity of large language models (LLMs) soars across various applications, ensuring their alignment with human values has become a paramount concern. In particular, given that LLMs have great potential to serve…

Moral Scenarios

How Well Do Large Language Models Serve as End-to-End Secure Code Agents for Python?

2024-08-20 · Jianian Gong, Nachuan Duan, Ziheng Tao, Zhaohui Gong 외

The rapid advancement of large language models (LLMs) such as GPT-4 has revolutionized the landscape of software engineering, positioning these models at the core of modern development practices. As we anticipate these m…

LLM For Loop Invariant Generation and Fixing: How Far Are We?

2025-11-09 · Mostafijur Rahman Akhond, Saikat Chakraborty, Gias Uddin arxiv

A loop invariant is a property of a loop that remains true before and after each execution of the loop. The identification of loop invariants is a critical step to support automated program safety assessment. Recent adva…

SR-OOD: Out-of-Distribution Detection via Sample Repairing

2023-05-26 · Rui Sun, Andi Zhang, Haiming Zhang, Jinke Ren 외

Out-of-distribution (OOD) detection is a crucial task for ensuring the reliability and robustness of machine learning models. Recent works have shown that generative models often assign high confidence scores to OOD samp…

Generative Adversarial NetworkOut-of-Distribution DetectionOut of Distribution (OOD) Detection