Retrieval-Augmented Generation for Scientific Code Understanding

📅 2026-09-10
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
研究通过构建检索增强生成系统,利用小型开源模型和离线解析处理,解决大型云托管模型在科学代码理解中的高成本和隐私问题。
📝 Abstract
Large language models have become central to modern coding assistants, but state-of-the-art systems such as Claude Code or Codex rely on very large, cloud-hosted models with significant computational cost and data-privacy implications. This work investigates whether a useful, fully local coding agent can be built around small open-source models by shifting the computational burden away from inference. We develop a Retrieval-Augmented Generation (RAG) system for scientific code understanding that strictly separates an expensive offline ingestion stage parsing, structural graph construction, LLM-generated entity explanations, and embedding from a lightweight online answering stage. The system is evaluated on a 100-question benchmark spanning eleven categories over the IPPL scientific codebase written in C++, with answers scored by an independent frontier model as the judge. Across seven answering models, we find that model family and retrieval quality matter more than parameter count, i.e. a 9B model achieves the highest average score (0.795), outperforming both larger models within our pipeline and the same models embedded in the Claude Code retrieval architecture. The results indicate that front-loading code understanding into a reusable, codebase-specialised vector store enables small local models to deliver grounded and repository-specific answers, making the agent well suited as a privacy-preserving development tool for in-house scientific codebases.
Problem

Research questions and friction points this paper is trying to address.

local coding agent
small open-source models
computational cost
data-privacy
Innovation

Methods, ideas, or system contributions that make the work stand out.

Retrieval-Augmented Generation (RAG)
offline ingestion stage
codebase-specialised vector store
privacy-preserving
🔎 Similar Papers
A
Aaron Nobile
Department of Physics, ETH Zürich, 8093 Zürich, Switzerland
A
Andreas Adelmann
Paul Scherrer Institute, 5232 Villigen PSI, Switzerland
M
Mohsen Sadr
Paul Scherrer Institute, 5232 Villigen PSI, Switzerland; Massachusetts Institute of Technology, Cambridge, MA 02139, USA