RAILS-DK: Dynamic Knowledge Management for Retrieval-Augmented Code Repair in Scientific Computing
Abstract
Retrieval-augmented techniques improve automated code repair by grounding generation in external programming knowledge, but most prior approaches assume a static knowledge base. This assumption is problematic in scientific computing, where libraries, APIs, and dependencies evolve continuously. This paper presents RAILS-DK, a dynamic knowledge management framework for retrieval-augmented code repair that treats programming knowledge as an explicit, evolving artifact. RAILS-DK uses a topic-driven registry to control domain-specific APIs and deterministically regenerate documentation and retrieval indices, ensuring verified, environment-aligned, and reproducible repair. We evaluate RAILS-DK on two benchmarks comprising over six hundred compilation- and execution-validated repair instances across Java and Python. The first extends a Java import-resolution benchmark with a synthetic scientific API to isolate knowledge effects from pretrained memorization; the second evaluates execution-level import failures in representative Python scientific kernels. Across both settings, prompt-only and static retrieval fail on unseen or evolving APIs, while RAILS-DK consistently retrieves correct bindings and achieves successful repair, typically within two iterations. These results show that dynamic knowledge management is critical for reliable retrievalaugmented code repair in scientific computing workflows.