paper-with-me

홈 › Papers

Inference-Time Safety For Code LLMs Via Retrieval-Augmented Revision

2026-03-02 · Manisha Mukherjee, Vincent J. Hellendoorn arxiv

Large Language Models (LLMs) are increasingly deployed for code generation in high-stakes software development, yet their limited transparency in security reasoning and brittleness to evolving vulnerability patterns raise critical trustworthiness concerns. Models trained on static datasets cannot readily adapt to newly discovered vulnerabilities or changing security standards without retraining, leading to the repeated generation of unsafe code. We present a principled approach to trustworthy code generation by design that operates as an inference-time safety mechanism. Our approach employs retrieval-augmented generation to surface relevant security risks in generated code and retrieve related security discussions from a curated Stack Overflow knowledge base, which are then used to guide an LLM during code revision. This design emphasizes three aspects relevant to trustworthiness: (1) interpretability, through transparent safety interventions grounded in expert community explanations; (2) robustness, by allowing adaptation to evolving security practices without model retraining; and (3) safety alignment, through real-time intervention before unsafe code reaches deployment. Across real-world and benchmark datasets, our approach improves the security of LLM-generated code compared to prompting alone, while introducing no new vulnerabilities as measured by static analysis. These results suggest that principled, retrieval-augmented inference-time interventions can serve as a complementary mechanism for improving the safety of LLM-based code generation, and highlight the ongoing value of community knowledge in supporting trustworthy AI deployment.

📄 PDF Abstract BibTeX arXiv:2603.01494

Code (0)

등록된 구현이 없습니다.

Tasks

Code Generation

Similar Papers 제목 키워드 기반

Safety and accuracy follow different scaling laws in clinical large language models

2026-05-05 · Sebastian Wind, Tri-Thien Nguyen, Jeta Sopa, Mahshad Lotfinia 외 arxiv

Clinical LLMs are often scaled by increasing model size, context length, retrieval complexity, or inference-time compute, with the implicit expectation that higher accuracy implies safer behavior. This assumption is inco…

Steering Over-refusals Towards Safety in Retrieval Augmented Generation

2025-10-12 · Utsav Maskey, Mark Dras, Usman Naseem arxiv

Safety alignment in large language models (LLMs) induces over-refusals -- where LLMs decline benign requests due to aggressive safety filters. We analyze this phenomenon in retrieval-augmented generation (RAG), where bot…

Towards Inference-time Category-wise Safety Steering for Large Language Models

2024-10-02 · Amrita Bhattacharjee, Shaona Ghosh, Traian Rebedea, Christopher Parisien

While large language models (LLMs) have seen unprecedented advancements in capabilities and applications across a variety of use-cases, safety alignment of these models is still an area of active research. The fragile na…

Safety Alignment

Do Reasoning LLMs Refuse What They Infer in Long Contexts?

2026-02-09 · Yu Fu, Haz Sameen Shahgir, Huanli Gong, Zhipeng Wei 외 arxiv

Long-context LLMs can infer objectives that are not stated explicitly. This capability is useful for reasoning over documents, code, retrieved evidence, and tool traces, but it also creates a safety risk: harmful intent …

LightRetriever: A LLM-based Hybrid Retrieval Architecture with 1000x Faster Query Inference

2025-05-18 · Guangyuan Ma, Yongliang Ma, Xuanrui Gou, Zhenpeng Su 외

Large Language Models (LLMs)-based hybrid retrieval uses LLMs to encode queries and documents into low-dimensional dense or high-dimensional sparse vectors. It retrieves documents relevant to search queries based on vect…

GPURetrieval