Researchers introduced Code2LoRA on June 4, 2026, a hypernetwork framework that generates repository-specific LoRA adapters for code language models without inference-time token overhead. The approach eliminates the need for retrieval-augmented generation or per-repository fine-tuning by dynamically creating adapters that inject repository knowledge directly into model weights.
Static and Evolution Modes Address Different Development Scenarios
Code2LoRA supports two distinct usage scenarios. Code2LoRA-Static converts a single repository snapshot into an adapter, suitable for understanding stable codebases. Code2LoRA-Evo maintains an adapter backed by a GRU hidden state that updates with each code diff, enabling the system to track repository evolution during active development. This evolution mode allows the adapter to reflect changes in APIs, imports, and project conventions as the codebase develops.
RepoPeftBench Benchmark Shows Matching Per-Repository Fine-Tuning Performance
The framework was evaluated using RepoPeftBench, a new benchmark comprising 604 Python repositories across two tracks. The static track includes 40,000 training tasks and 12,000 test assertion-completion tasks. The evolution track contains 215,000 commit-derived training tasks and 87,000 commit-derived test tasks. Code2LoRA-Static achieved 63.8% cross-repository and 66.2% in-repository exact match scores, matching the performance of per-repository LoRA fine-tuning. Code2LoRA-Evo achieved 60.3% cross-repository exact match, representing a 5.2 percentage point improvement over a single shared LoRA.
Hypernetwork Decouples Repository Encoding from Adapter Generation
The technical innovation lies in using a hypernetwork to decouple repository encoding from adapter generation. A single model can generate adapters for any repository without requiring per-repository training. For the evolution scenario, the GRU state tracks the repository's development history and updates the adapter as code changes occur. This approach eliminates the computational cost of RAG retrieval and long context windows at inference time, making it practical for real-time IDE integration.
Key Takeaways
- Code2LoRA generates repository-specific LoRA adapters through a hypernetwork, eliminating inference-time token overhead from RAG or long contexts
- Code2LoRA-Static achieved 66.2% in-repository exact match on RepoPeftBench, matching per-repository LoRA fine-tuning performance
- Code2LoRA-Evo tracks repository evolution with a GRU hidden state, achieving 60.3% cross-repository exact match with 5.2 percentage point improvement over shared LoRA
- RepoPeftBench includes 604 Python repositories with 40,000 static training tasks and 215,000 commit-derived evolution tasks
- The approach enables on-demand adapter generation without per-repository training, reducing computational costs for repository-aware code completion