Large language models for code grapple with the critical need for repository-level context—understanding imports, APIs, and project conventions. Traditional approaches, relying on extensive retrieval-augmented generation (RAG) or per-repository fine-tuning, impose significant computational costs and struggle with dynamic codebases. This limitation is now addressed by Code2LoRA, a novel hypernetwork framework.
Injecting Repository Knowledge with Zero Inference Overhead
Code2LoRA generates repository-specific LoRA adapters on the fly. This ingenious method injects crucial repository knowledge without increasing inference-time token consumption, a substantial departure from prior methods that either bloat input sequences or require costly fine-tuning. The framework offers two distinct modes: Code2LoRA-Static is optimized for static code snapshots, ideal for analyzing stable projects. Code2LoRA-Evo, on the other hand, dynamically maintains and updates adapters via a GRU hidden state, directly responding to code differences (diffs) and thus perfectly suited for actively developing projects.