Code2LoRA: Hypernetwork-Generated Adapters for Code Language Models under Software Evolution
AuthorsLiliana Hotsko, Yinxi Li, Yuntian Deng, Pengyu Nie
Resources
Code2LoRA turns code repositories into lightweight, updateable adapters so code models can learn project-specific context without stuffing the prompt or retraining for every repo.
Key results
Python repositories used to construct the benchmark
Assertion-completion training tasks on the static track
Commit-derived training tasks for Code2LoRA-Evo
Code2LoRA-Static on cross-repo static-track test
Code2LoRA-Evo on cross-repo evolution-track test
Code2LoRA-Evo on the 92-repository temporal holdout
What the paper found
Code2LoRA, from the University of Waterloo, reframes repository-level code adaptation as hypernetwork-generated LoRA rather than retrieval or per-repository fine-tuning, using a frozen Qwen2.5-Coder-1.5B backbone and a frozen Qwen3-Embedding-0.6B repository encoder to emit adapters with zero inference-time token overhead. The paper introduces two modes: Code2LoRA-Static maps one repository snapshot to adapters for stable codebases, while Code2LoRA-Evo adds a GRU over sequential code diffs to refresh the adapter as software evolves. To evaluate this idea, the authors build RepoPeftBench, a benchmark of 604 Python repositories with 39,612 static training tasks, 215,129 evolution-track training tasks, and a 92-repository temporal holdout. On the static track, Code2LoRA-Static reaches 63.8% cross-repo exact match and 66.2% in-repo exact match, beating the strongest baseline by 9.9 percentage points and matching the per-repository LoRA upper bound. On the evolution track, Code2LoRA-Evo reaches 60.3% cross-repo exact match and 64.5% in-repo exact match, improving by 5.2 points over a single shared LoRA and outperforming static snapshot adaptation under commit-level drift. The paper also reports that Code2LoRA-Evo remains strongest on the 92-repository out-of-distribution holdout at 74.1% exact match, while preserving the key deployment advantage of no extra inference tokens.
Original abstract
Code language models need repository-level context to resolve imports, APIs, and project conventions. Existing methods inject this knowledge as long inputs (retrieved through RAG or dependency analysis) or through per-repository fine-tuning and LoRA -- costly at repository scale and brittle to evolving codebases. We introduce Code2LoRA, a hypernetwork framework that generates repository-specific LoRA adapters, effectively injecting repository knowledge with zero inference-time token overhead. Code2LoRA supports two usage scenarios: Code2LoRA-Static converts a single repository snapshot into an adapter, suitable for comprehension of stable codebases; while Code2LoRA-Evo maintains an adapter backed by a GRU hidden state updated per code diff, suitable for active development of evolving codebases. To evaluate Code2LoRA against parameter-efficient fine-tuning baselines, we build RepoPeftBench, a benchmark of 604 Python repositories with two tracks: a static track with 40K training and 12K test assertion-completion tasks, and an evolution track with 215K commit-derived training and 87K commit-derived test tasks. On the static track, Code2LoRA-Static achieves 63.8% cross-repo and 66.2% in-repo exact match, matching the per-repository LoRA upper bound; on the evolution track, Code2LoRA-Evo achieves 60.3% cross-repo exact match (+5.2 pp over a single shared LoRA). Code2LoRA's code can be found at https://anonymous.4open.science/r/code2lora-6857; the model checkpoints and RepoPeftBench datasets can be found at https://huggingface.co/code2lora.
Read the original paperMore in Code Generation
Browse all 52 papers →CompoundingKernel: Self-Improving from Zero to First
Qian Qu, Hongyang Wang, Wenbo Chen, Yichuan Li, Jingguo Liu, Xian Li, Xuan Wang, Ruochen Wen, Leo Fan, Yiming Yan, Zheshen Wang, Benoit Dumoulin
CompoundingKernel uses parallel agents and an archive of successful attempts to discover fast, correct GPU kernels.
CoReMem: Cost-Internalizing Memory for Successive Coding Tasks with Prospective Valuation
Peiwen Li, Harshit Verma, Sophia Zhou, Haiwen Wang, Ngoc Bui, Heng Chang, Fei Fei, David van Dijk, Rex Ying
CoReMem helps coding agents carry forward useful repository knowledge while accounting for the cost of writing and using memory.
From Repositories to Training Environments: Scaling Long-Horizon Coding Agents with Environment Evolution Loop
Yang Tian, Tianyu Zheng, Xiyuan Yang, Yaxin Du, Chengran Yang, Bo Zhao, Jian Yang, Bryan Dai
RepoFactory turns real software repositories into training environments and iteratively improves them to help coding agents tackle longer, more realistic projects.