Papers › Doc-to-LoRA: Learning to Instantly Internalize Contexts

Doc-to-LoRA: Learning to Instantly Internalize Contexts

13 Feb 2026ICMLarXiv:2602.15902added by Syntology

Rujikorn Charakorn, Edoardo Cetin, Shinnosuke Uesaka, Robert Tjarko Lange

Title, abstract, authors and date from arXiv's metadata (CC0); this paper is not in the Papers with Code archive (frozen 2025-07-28).

Long input sequences are central to in-context learning, document understanding, and multi-step reasoning of Large Language Models (LLMs). However, the quadratic attention cost of Transformers makes inference memory-intensive and slow. While context distillation (CD) can transfer information into model parameters, per-prompt distillation is impractical due to training costs and latency. To address these limitations, we propose Doc-to-LoRA (D2L), a lightweight hypernetwork that meta-learns to perform approximate CD within a single forward pass. Given an unseen prompt, D2L generates a LoRA adapter for a target LLM, enabling subsequent queries to be answered without re-consuming the original context, reducing latency and KV-cache memory consumption during inference of the target LLM. On a long-context needle-in-a-haystack task, D2L successfully learns to map contexts into adapters that store the needle information, achieving near-perfect zero-shot accuracy at sequence lengths exceeding the target LLM's native context window by more than 4x. On real-world QA datasets with limited compute, D2L outperforms standard CD while significantly reducing peak memory consumption and update latency. We envision that D2L can facilitate rapid adaptation of LLMs, opening up the possibility of frequent knowledge updates and personalized chat behavior.

PaperPDFCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2602.15902")

Code

Syntology Ran 18 of 32 code samples harvested from 1 repository linked to this paper; 14 have no recorded run. Of those that ran: 5 ran · our draft was wrong; 1 ran · fixture could not drive it; 12 ran with no contract checked.

By repository: found in paper text by Syntology: 32 samples from 1 repository, 18 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

SakanaAI/doc-to-lora found in paper text by Syntology report

Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

32 samples harvested; 18 ran; 0 honoured the contract we drafted; 14 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

5ran · our draft was wrong
1ran · fixture could not drive it
12ran
14unverified

Licence: 0 of the 32 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from SakanaAI/doc-to-lora. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

DiscreteOneHotTaskEncoder SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology ran · metamorphic tier: deterministic fingerprinted MIT (permissive) · 21cbf833527e000d · report
MLPResidualBlock SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology ran · metamorphic tier: invariant fingerprinted MIT (permissive) · 96865de164c308ad · report
SoftmaxTaskEncoder SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology ran · metamorphic tier: deterministic fingerprinted MIT (permissive) · aeca7914797f1f3a · report
TaskEncoder SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology ran · metamorphic tier: deterministic fingerprinted MIT (permissive) · 656b1d9383fc1abf · report
VQTaskEncoder SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology ran MIT (permissive) · 2c3f7d0ccd979162 · report
add_full_stop SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology ran · our draft was wrong fingerprinted MIT (permissive) · e6ae5d7b6ce64ac3 · report
apply_rotary_pos_emb SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology ran · our draft was wrong fingerprinted MIT (permissive) · 22f75dc2bea7b46e · report
cls_pool SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology ran MIT (permissive) · ed175170e2628076 · report
embed_texts SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology ran MIT (permissive) · 895bcd8257169039 · report
embed_tokens SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology ran MIT (permissive) · 464adbe41baffcdb · report
get_emb_model_and_fns SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology ran MIT (permissive) · a449079623eb8c90 · report
get_in_out_features SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology ran MIT (permissive) · 8cbf94593c76c7d4 · report
get_layers SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology ran · our draft was wrong MIT (permissive) · eb1fa1a3b994be5d · report
get_pooling_fn SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology ran · our draft was wrong MIT (permissive) · f6bfe8f5c075f8d0 · report
last_token_pool SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology ran · fixture could not drive it MIT (permissive) · b6c4cb90c7bfeae1 · report
lora_state_dict_to_tensor_dict SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology ran MIT (permissive) · 4eb352ce41bff2cc · report
lora_tensor_dict_to_param_dict SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology ran · our draft was wrong MIT (permissive) · 1fc5218833c6c6ea · report
zero_lora_param_dict SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology ran MIT (permissive) · 4731a23d7470dc77 · report
HyperModulator SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology unverified MIT (permissive) · c9a3604b537bfc0e · report
TextToLoRA SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology unverified MIT (permissive) · 81a8f2d7a29f3811 · report
_embed_tokens_single_batch SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology unverified MIT (permissive) · 9a22c2784acf8fe5 · report
apply_lora_to_layers SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology unverified MIT (permissive) · 937d38a0e976d855 · report
create_hypermod SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology unverified MIT (permissive) · 6e23d59c5480daea · report
get_init_peft_weights SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology unverified MIT (permissive) · b0fb60a036b8e6ee · report
get_lora_module_names SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology unverified MIT (permissive) · 7572df21036527e9 · report
get_model SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology unverified MIT (permissive) · 122a565cbe1f2d83 · report
get_model_and_tokenizer SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology unverified MIT (permissive) · d38e50d952d93469 · report
get_peft_modules SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology unverified MIT (permissive) · 4b6e8a0361945762 · report
get_tokenizer SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology unverified MIT (permissive) · f3fb84a5a6d3b065 · report
load_hypermod SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology unverified MIT (permissive) · 177a916196a3d9b2 · report
load_hypermod_checkpoint SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology unverified MIT (permissive) · 4dc184dbfb1660e4 · report
lora_forward SakanaAI/doc-to-lora/src/ctx_to_lora/modeling/text_to_lora.py found in paper text by Syntology unverified MIT (permissive) · f8caf753f4a6cb6a · report

Results from the paper

The Papers with Code archive ends with its 2025-07-28 snapshot. This paper's arXiv identifier, 2602.15902, was issued in February 2026, after that date, so the archive has no leaderboard rows for it.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections