Doc-to-LoRA Analysis: Query Conditioning, Wrong Facts, and Distractor Interference

Jesper DerehagarXiv 2026

TL;DR

Imagine if you could "upload" a textbook directly into an AI’s weights instead of making it read the text every time you ask a question. Doc-to-LoRA (D2L) tries to do exactly that by "compiling" documents into tiny model updates, but this paper finds that the "brain upload" is currently a bit of a mess—the AI gets confused, mixes up facts, and struggles when you try to upload more than one document at a time.

What Problem Does This Paper Address?

Large Language Models (LLMs) have a "context window" problem. If you want a model to remember your personal history or a specific set of documents, you usually have to paste that text into every single prompt. This is slow, expensive, and wastes "compute" because the model has to re-process that same text over and over.

Doc-to-LoRA (D2L) is a clever alternative. It uses a secondary network (a hypernetwork) to "digest" a document and turn it into a LoRA adapter—a small set of mathematical weights that can be plugged into the main model. In theory, once a document is "compiled" into an adapter, the model "knows" it without needing the text in the prompt.

The authors of this paper wanted to know: Does this actually work in the real world? Specifically, they looked at interference—what happens when you plug in multiple adapters at once? Does the model get "distracted" by irrelevant documents?

Methods

The researchers put D2L through the wringer using two popular open-source models: Gemma-2-2B and Qwen3-4B.

The core D2L pipeline works like this:

  1. Write Time: A "Perceiver" hypernetwork reads a document and generates LoRA factors ($A$ and $B$ matrices) for the model's layers.
  2. Serving Time: When a user asks a question, the document text is gone. Instead, the model uses the generated LoRA weights to modify its internal activations.
The Doc-to-LoRA pipeline: documents are compiled into adapters once, then used during inference without the original text.

To understand why D2L fails, the authors performed "layer-wise interventions." They would manually silence certain adapters in specific layers or "transplant" perfect information from a teacher model to see where the logic breaks down. They also tried building "Trained Readers"—extra neural layers designed to help the model pick the right information from a pile of summed adapters.

Datasets

The study used several standard benchmarks and one production-style dataset:

  • SQuAD, DROP, and ROPES: Standard factual question-answering datasets.
  • PersonaMem-v2: A dataset designed to test how well models handle long-term user "memories" and preferences.

Key Insights and Ideas

  • The Attribution Crisis: When D2L gets a question wrong, it’s not just making things up. In 46% of errors, the model actually gives a correct answer... but to a different question from the same document. It knows the facts; it just forgot which question they belong to.
  • Interference is Cumulative: Distractor documents (irrelevant ones) don't just cause a one-off error. Their "damage" accumulates as the signal moves deeper into the model. Interestingly, the early layers are surprisingly sensitive to this noise.
  • The "Readout" Gap: Even when a specialized probe could "see" the correct answer hidden in the model's internal states, the model itself often failed to generate that answer. There is a disconnect between "storing" a fact in weights and "retrieving" it for a response.
  • FLOPs vs. Reality: While D2L technically does fewer mathematical operations (FLOPs) than reading full text, the actual speedup on a GPU is often disappointing. This is because modern hardware is often limited by memory access speeds rather than raw math, and managing many small adapters adds its own overhead.

Key Results

The results were a bit of a cold shower for the "compiled memory" dream.

  1. The Accuracy Drop: Even with just one document, D2L is significantly less accurate than simply putting the text in the prompt (In-Context Learning).
  2. The Multi-Doc Collapse: As you add more documents (the "bank size" $K$), performance plummets. For Gemma, moving from 1 document to 16 caused the F1 score (a measure of accuracy) to crash from ~0.75 to nearly zero.
Figure 2. Accuracy as the number of documents K increases: token F1 for Gemma and answer containment for Qwen. D2L falls below ICL already at K = 1. ICL stays relatively stable as distractors are added, while native D2L, normalization, and the readers all degrade. All plotted readers are mixed-K. Gemma includes all three readers; Qwen includes post-block and gated readers. Gated readers use one seed, the other Gemma readers three.
  1. Throughput Gains: Throughput improvements were modest and highly dependent on batch size. At small batch sizes, D2L was actually slower than standard text processing on some models.
Figure 5. Recurring compute and serving throughput. (a) Gemma, one document, 40 question tokens and 32 output tokens. (b) One A100, four documents per user and 64 output tokens per user. Each batch contains one request per user, with distinct user-specific memory. Throughput includes prefill and decoding; ICL performs full prefill per request. Compilation is excluded.

Limitations and Future Work

The authors admit they only tested two specific model families and one type of hypernetwork. It's possible that a different architecture might handle "distractor interference" better.

However, their findings suggest that "compiling" static text into weights might be the wrong path. Instead, they point toward online learning—methods where the model learns from actual interactions (where it sees both the question and the memory) rather than just trying to memorize a document in a vacuum. This would help the model learn not just the facts, but the associations between questions and answers.

Summary updated

BibTeX
@misc{derehag2026doc,
  author = {Jesper Derehag},
  title = {{Doc-to-LoRA Analysis: Query Conditioning, Wrong Facts, and Distractor Interference}},
  year = {2026},
  eprint = {2611.30825},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.30825},
}
Figure