EMNLP 2026 System Demonstration — under review

Code2LoRA: Hypernetworks for Repository-Conditioned
and Commit-Streaming Adapters of Code Language Models

A hypernetwork trained once, across hundreds of repositories, that maps your repository's commit history directly to a LoRA adapter for a frozen code LLM — repository knowledge with zero inference-time token overhead, updated in O(1) per commit, and deployable on a laptop, fully offline.

Liliana Hotsko · Yinxi Li · Yuntian Deng · Pengyu Nie

University of Waterloo

ADAPTER GENERATION — CPU-ONLY, BASE LLM NEVER LOADED QUANTIZED SERVING git repository first-parent history commit mining kept: new-assertion commits production-code diffs snapshot @ c₀ initial repo state Qwen3-Embedding-0.6B frozen encoder diff → 2048-d Commit GRU (2048) h₀ ← snapshot · hₜ ← diffₜ O(1) update per commit task embedding (64-d) assert_rhs · qa hypernetwork head [hₜ ; task] → LoRA(A,B) rank 16 · α = 32 LoRA adapter · ~18M params · ~37 MB q/k/v/o + up/gate/down · PEFT or GGUF export inject Qwen2.5-Coder-1.5B frozen · quantized attention: q, k, v, o +LoRA MLP: gate, up, down +LoRA fp16 · int8 · NF4 · GGUF Q4_K_M c2lt REPL / c2l CLI assertion completion · repository Q&A completions / answers new commit → 1 embed + 1 GRU step
The c2l-terminal / Code2LoRA-Evo pipeline. Left: adapter generation walks the commit history — each production-code diff is embedded by a frozen encoder and folded into a GRU state initialized from the repository snapshot; a task-conditioned head emits the LoRA. This stage never loads the base LLM and runs on CPU. Right: the ~37 MB adapter is injected into the frozen, quantized Qwen2.5-Coder-1.5B for serving. New commits update the cached GRU state in O(1).
TL;DR — Injecting repository knowledge into a code LLM usually means long retrieved contexts (paid on every request) or per-repository fine-tuning (infeasible at scale). Code2LoRA trains a hypernetwork once that generates a repository-specific LoRA adapter in a single pass. On RepoPeftBench it reaches 63.8% exact match on held-out repositories (pretrained backbone: 45.7%; full fine-tuning: 51.4%; RAG: 39.7%), and 78.9% on repositories created after the training-data cutoff. The commit-streaming variant updates the adapter in one GRU step per commit. c2l-terminal ships all of it as a pip-installable, offline-capable terminal assistant.

News

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: 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 in one forward pass — suited to comprehension of stable codebases.

Code2LoRA-Evo (GRU)

Maintains an adapter backed by a GRU hidden state updated per commit diff — O(1) per commit, suited to active development, IDE and CI integration.

We evaluate on RepoPeftBench, a benchmark of 512 Python repositories with 62K assertion-completion tasks spanning cross-repository (CR), in-repository (IR), and a held-out post-cutoff out-of-distribution (OOD) suite of 92 repositories created strictly after the training-scrape cutoff. Code2LoRA achieves 63.8% CR exact match — outperforming the pretrained Qwen2.5-Coder-1.5B backbone (45.7%), full fine-tuning (51.4%), retrieval-augmented generation (39.7%), and in-context learning (42.2%) — while adding zero inference tokens. On post-cutoff OOD repositories, Code2LoRA-GRU reaches 78.9% EM, a +33.3 absolute gain over the same pretrained backbone, evidencing that hypernetwork-generated adapters generalize to repositories that did not exist at training time.

c2l-terminal — the on-device demo system

c2l-terminal packages Code2LoRA-Evo as a self-contained, Claude-Code-style terminal assistant that runs entirely on a developer laptop. It walks your repository's commit history, generates a repository- and task-specific LoRA adapter in minutes on CPU (the base LLM is never loaded during generation), and serves completions from a quantized Qwen2.5-Coder-1.5B with that adapter injected.

c2lt — python-saml
$ pip install code2lora
$ cd ~/work/python-saml && c2lt --task qa --backend gguf

c2l-terminal — quantized Code2LoRA · base: Qwen2.5-Coder-1.5B (Q4_K_M)

c2l> /adapt
  mining commits ... 86 kept (new-assertion commits)
  embedding diffs + GRU walk ... done
  adapter ready for SAML-Toolkits/python-saml  ·  task: qa  ·  ~37 MB LoRA

c2l> Which new public method was introduced in OneLogin_Saml2_Auth
     for retrieving an attribute by FriendlyName?
`get_attribute_by_friendly_name(self, friendly_name)` was added. It returns
the first attribute whose friendly_name matches the provided value, or `None`
if no matching attribute is found.

c2l> /task assert_rhs
c2l> self.assertEqual(len(friendlyname_attributes),
0)

c2l> /adapt            # after a new commit: one embedding + one GRU step
  1 new commit folded into cached GRU state — adapter updated in seconds

Generation ≠ serving

Adapter generation needs only the 0.6B encoder + GRU + head — minutes on CPU. The quantized base model loads only when you ask for completions.

Incremental by design

GRU endpoint state is cached per repository and task. A push with k new commits costs exactly k embeddings + GRU steps. /adapt --local even tracks uncommitted working-tree changes.

Runs on a laptop

Three interchangeable backends: GGUF/llama.cpp (pure CPU, ~1 GB base), bitsandbytes 4-bit/8-bit, or full-precision HF. Minimum: 8 GB RAM, ~5 GB disk.

Offline & private

C2L_OFFLINE=1 disables all network access after models are cached. Your code never leaves the machine — repository knowledge lives in weights, not in prompts sent to a hosted service.

Two tasks, one checkpoint

Test-assertion completion and free-form repository Q&A, switched with one command (/task). The QA head was grown from the single-task model with a warm start that is output-identical at initialization.

Scriptable CLI

Besides the c2lt REPL, the c2l CLI exposes adapt / run / export / verify for automation, plus PEFT- and GGUF-format adapter export.

Install

Published on PyPI as code2lora (Python ≥ 3.9, MIT license); installs the c2lt REPL and the c2l CLI:

# from PyPI
pip install code2lora

# optional: 4-/8-bit inference via bitsandbytes
pip install "code2lora[quant]"

# or from source
pip install git+https://github.com/lilianahotsko/c2l_terminal.git

Quick start (CPU laptop, GGUF backend)

# one-time: build llama.cpp and grab the quantized base model (~1 GB)
git clone https://github.com/ggerganov/llama.cpp ~/llama.cpp
cmake -B ~/llama.cpp/build -S ~/llama.cpp && cmake --build ~/llama.cpp/build -j
huggingface-cli download Qwen/Qwen2.5-Coder-1.5B-GGUF --include "*Q4_K_M*" \
    --local-dir ~/models/qwen-coder-gguf

export C2L_LLAMACPP=~/llama.cpp
export C2L_BASE_GGUF=~/models/qwen-coder-gguf/<the-q4-file>.gguf

# run inside any git repository
cd /path/to/your/repo
c2lt --device cpu --backend gguf
# c2l> /adapt          → generate the adapter (encoder + checkpoint auto-download, ~3 GB)
# c2l> /export-gguf    → convert the adapter for llama.cpp
# c2l> type a code prefix, or a question with /task qa

On a GPU (or with bitsandbytes ≥ 0.43 on CPU) you can skip llama.cpp entirely and use --backend 4bit. Full instructions, REPL command reference, and troubleshooting live in the GitHub README.

REPL commands

CommandEffect
/adapt [repo]Generate or incrementally update the adapter (only new commit diffs)
/adapt --localFold uncommitted working-tree changes into the adapter
/task [name]Switch between assert_rhs (test completion) and qa (repository Q&A)
/backend [name]4bit · 8bit · hf · gguf
/export-gguf [path]Convert the adapter to a GGUF LoRA for llama.cpp
/context add <file>Pin a file as standing context (@file.py injects once)
/tokens · /status · /helpSession control

Method

1

Commit mining

Streaming walk of first-parent git history selects commits that introduce new test assertions

2

Diff embedding

Each commit's production-code diff is embedded by frozen Qwen3-Embedding-0.6B (2048-d)

3

GRU state

A GRU, initialized from the repository snapshot embedding, folds the diff sequence — O(1) per commit

4

LoRA head

A task-conditioned hypernetwork head emits rank-16 LoRA matrices for all attention & MLP projections

5

Quantized serving

The adapter is injected into frozen Qwen2.5-Coder-1.5B — fp16, 4/8-bit, or GGUF on CPU

Growing new tasks without forgetting — by construction

The shipped checkpoint started as a single-task assertion-completion model. We added free-form repository question answering by (1) generating 73,829 commit-grounded Q&A pairs over the training repositories with a batch LLM API for $28.50, and (2) growing the head with a zero-padded warm start: the new task-conditioning columns of the first trunk layer are initialized to zero, so the grown head is byte-identical to the source model for every task id at initialization — verified by a unit test on the generated LoRA tensors. Any forgetting is therefore attributable to fine-tuning drift alone, not to the surgery.

Results

Static track — cross-repository test (held-out repositories)

MethodExact Match (%)Inference-time token overhead
Pretrained Qwen2.5-Coder-1.5B45.7
Retrieval-augmented generation (RAG)39.7thousands of tokens / request
In-context learning42.2thousands of tokens / request
Full fine-tuning51.4
Code2LoRA-Static63.8zero
per-repo LoRA (upper bound; IR only)64.0 (IR)

Per-repo LoRA requires a training run per repository and is undefined on unseen (CR/OOD) repositories — Code2LoRA matches its in-repo upper bound while generalizing across repositories with a single forward pass.

Evolution track — commit-streaming (GRU)

MethodCR test EM (%)IR test EM (%)
Single shared LoRA (best baseline)55.1
Code2LoRA-Evo (GRU)60.364.5

Out-of-distribution — repositories created after the training cutoff

MethodOOD EM (%)
Pretrained Qwen2.5-Coder-1.5B45.6
Code2LoRA-GRU78.9 (+33.3)

92 GitHub repositories created strictly after the training-scrape cutoff — direct evidence that the hypernetwork captures repository structure rather than memorizing training-time repositories.

Repository question answering (multi-task checkpoint)

QA metricCR testIR test
QA quality (mean of ROUGE-L and token F1)0.2220.220
ROUGE-10.2940.290
Token F1 (SQuAD normalization)0.2220.219

14,762 held-out commit-grounded Q&A pairs. The model reliably names the correct file and symbol; the strongest demo repositories retain 0.62–0.77 assertion EM after the QA fine-tune (e.g., jpsca/jinjax 0.77, fastapi/sqlmodel 0.75, SAML-Toolkits/python-saml 0.69). Full tables and ablations are in the papers.

Demo video

2.5-minute screencast coming with the EMNLP 2026 demo submission:
install → /adapt on a real repository → Q&A → assertion completion → incremental commit update → fully offline rerun.

Artifacts

Everything is released under the MIT license on the 🤗 code2lora organization and GitHub. The benchmark datasets are paper-exact: they contain precisely the rows consumed by the reported experiments, post quality-filter.

ArtifactWhat it is
code2loraPyPI pip install code2lora — the c2l-terminal package: c2lt REPL + c2l CLI, vendored SDK, GGUF/4-bit/8-bit backends
c2l_terminalcode Source repository for the PyPI package
code2lora-gru-demospace Browser demo: paste a repo URL, watch the GRU walk its history and the adapter beat the base model
code2lora-grumodel The Code2LoRA-Evo hypernetwork checkpoint (GRU + LoRA-generation head, ~2.85 GB)
code2lora-directmodel The Code2LoRA-Static (direct projection) checkpoint
code2lora-staticdataset RepoPeftBench static track: 62K assertion-completion QnAs over 512 repositories
code2lora-evodataset Evolution track: per-commit diff + repo-state embeddings and capped training QnAs
code2lora-static-anchordataset Anchor-snapshot variant used in the per-commit evolution comparisons
code2lora-data-qarelease upcoming 73,829 commit-grounded question–answer pairs (LLM-generated, provenance-tagged) powering the qa task

Citation

If you use Code2LoRA, RepoPeftBench, or c2l-terminal, please cite:

@article{hotsko2026code2lora,
  title  = {Code2LoRA: Hypernetworks for Repository-Conditioned and
            Commit-Streaming Adapters of Code Language Models},
  author = {Hotsko, Liliana},
  year   = {2026},
  note   = {Under review}
}

@inproceedings{hotsko2026c2lterminal,
  title  = {c2l-terminal: An On-Device Coding Assistant that Generates
            Repository- and Task-Specific LoRA Adapters from Commit History},
  author = {Hotsko, Liliana},
  year   = {2026},
  note   = {EMNLP 2026 System Demonstrations, under review}
}