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 ranMethod as code

In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

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

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 32 code samples harvested from 1 repository linked to this paper: 18 ran (of which 0 constructed an object rather than computing a result; 7 with no instrument failure: 2 honoured, 0 violated, 5 with no contract checked; 11 where Syntology's instrument failed) · 14 unverified. Where Syntology's instrument failed: 8 where our contract draft was wrong; 3 where the contract check could not run; failures of Syntology's instrument, not of the code.

By repository: found in paper text by Syntology: 32 samples from 1 repository, 18 ran (7 with no instrument failure; 11 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

Levels written between 2026-09-22 and 2026-09-24 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed.

SakanaAI/doc-to-lora found in paper text by SyntologySyntology: 32 samples, 18 ran (11 instrument-failed) · 14 unverified 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 (of which 0 constructed an object rather than computing a result; 7 with no instrument failure: 2 honoured, 0 violated, 5 with no contract checked; 11 where Syntology's instrument failed) · 14 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page last changed ; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

2ran · honoured contract
8ran · our draft was wrong
3ran; the contract check could not run
5ran
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. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (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 are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. 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 six 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; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. 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.

A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity. A census tag appears when Syntology's census ran implementations with that name on one shared input per bucket: it gives how many were compared, from how many papers, and how many distinct outputs they produced, and names this sample's bucket when this sample was one of them.

SakanaAI/doc-to-lora found in paper text by Syntology 32 samples, 18 ran (11 instrument-failed) · 14 unverified
DiscreteOneHotTaskEncoder src/ctx_to_lora/modeling/text_to_lora.py ran · metamorphic tier: deterministic fingerprinted MIT (permissive) · 21cbf833527e000d · report fixture: signature x:Tensor/2/float · returned dict · level recorded 2026-09-22
MLPResidualBlock src/ctx_to_lora/modeling/text_to_lora.py ran · metamorphic tier: invariant fingerprinted MIT (permissive) · 96865de164c308ad · report fixture: signature x:Tensor/2/float · returned Tensor · level recorded 2026-09-22
SoftmaxTaskEncoder src/ctx_to_lora/modeling/text_to_lora.py ran · metamorphic tier: deterministic fingerprinted MIT (permissive) · aeca7914797f1f3a · report fixture: signature x:Tensor/2/float · returned dict · level recorded 2026-09-22
TaskEncoder src/ctx_to_lora/modeling/text_to_lora.py ran · metamorphic tier: deterministic fingerprinted MIT (permissive) · 656b1d9383fc1abf · report fixture: signature x:Tensor/2/float · returned dict · level recorded 2026-09-22
VQTaskEncoder src/ctx_to_lora/modeling/text_to_lora.py ran MIT (permissive) · 2c3f7d0ccd979162 · report fixture: signature x:Tensor/2/float · returned dict · level recorded 2026-09-22
add_full_stop src/ctx_to_lora/modeling/text_to_lora.py ran · our draft was wrong fingerprinted MIT (permissive) · e6ae5d7b6ce64ac3 · report fixture: signature s:str/0/str · returned str · level recorded 2026-09-22
apply_rotary_pos_emb in 393 papers
census: 14 implementations from 15 papers, 8 distinct outputs across 7 buckets, one shared input per bucket this sample: bucket 6 of 7, arg 1: rank 2, kind float, dtype float32 · arg 2: rank 2, kind float, dtype float32 · arg 3: rank 2, kind float, dtype float32
src/ctx_to_lora/modeling/text_to_lora.py ran · our draft was wrong fingerprinted MIT (permissive) · 22f75dc2bea7b46e · report fixture: signature x:Tensor/2/float, cos:Tensor/2/float, sin:Tensor/2/float · returned Tensor · level recorded 2026-09-22
cls_pool src/ctx_to_lora/modeling/text_to_lora.py ran; the contract check could not run (RAISES) MIT (permissive) · ed175170e2628076 · report fixture: signature outputs:dict/0/?, attention_mask:Tensor/2/int · returned Tensor · level recorded 2026-09-22
embed_texts src/ctx_to_lora/modeling/text_to_lora.py ran · honoured contract MIT (permissive) · 895bcd8257169039 · report fixture: signature texts:list/1/str, emb_model:callable/0/?, emb_tokenizer:callable/0/?, task_desc_format_fn:callable/0/?, pooling_fn:callable/0/?, device:str/0/str, batch_size:NoneType/0/? · returned Tensor · level recorded 2026-09-22
embed_tokens src/ctx_to_lora/modeling/text_to_lora.py ran · honoured contract MIT (permissive) · 464adbe41baffcdb · report fixture: signature tokenized_texts:dict/0/?, emb_model:callable/0/?, pooling_fn:callable/0/?, device:str/0/str, batch_size:int/0/int · returned Tensor · level recorded 2026-09-22
get_emb_model_and_fns src/ctx_to_lora/modeling/text_to_lora.py ran · our draft was wrong MIT (permissive) · a449079623eb8c90 · report fixture: signature emb_model_name:str/0/str, device:str/0/str · returned tuple · level recorded 2026-09-24
get_in_out_features src/ctx_to_lora/modeling/text_to_lora.py ran; the contract check could not run (DEP_MISSING) MIT (permissive) · 8cbf94593c76c7d4 · report fixture: signature model:callable/0/?, peft_config:NoneType/0/? · returned tuple · level recorded 2026-09-24
get_layers in 20 papers src/ctx_to_lora/modeling/text_to_lora.py ran · our draft was wrong MIT (permissive) · eb1fa1a3b994be5d · report fixture: signature model:callable/0/? · returned Sequential · level recorded 2026-09-22
get_pooling_fn src/ctx_to_lora/modeling/text_to_lora.py ran · our draft was wrong MIT (permissive) · f6bfe8f5c075f8d0 · report fixture: signature pooling_type:str/0/str · returned function · level recorded 2026-09-22
last_token_pool in 18 papers src/ctx_to_lora/modeling/text_to_lora.py ran; the contract check could not run (RAISES) MIT (permissive) · b6c4cb90c7bfeae1 · report fixture: signature outputs:dict/0/?, attention_mask:Tensor/2/int · returned Tensor · level recorded 2026-09-22
lora_state_dict_to_tensor_dict src/ctx_to_lora/modeling/text_to_lora.py ran · our draft was wrong MIT (permissive) · 4eb352ce41bff2cc · report fixture: signature lora_sd:dict/0/?, target_modules:list/1/str, layer_indices:list/1/int, device:str/0/str · returned dict · level recorded 2026-09-24
lora_tensor_dict_to_param_dict src/ctx_to_lora/modeling/text_to_lora.py ran · our draft was wrong MIT (permissive) · 1fc5218833c6c6ea · report fixture: signature lora_tensor_dict:dict/0/?, requires_grad:bool/0/bool · returned ParameterDict · level recorded 2026-09-22
zero_lora_param_dict src/ctx_to_lora/modeling/text_to_lora.py ran · our draft was wrong MIT (permissive) · 4731a23d7470dc77 · report fixture: signature target_modules:list/1/str, n_layers:int/0/int, rank:int/0/int, in_features:dict/0/?, out_features:dict/0/? · returned ParameterDict · level recorded 2026-09-24
HyperModulator src/ctx_to_lora/modeling/text_to_lora.py unverified MIT (permissive) · c9a3604b537bfc0e · report
TextToLoRA src/ctx_to_lora/modeling/text_to_lora.py unverified MIT (permissive) · 81a8f2d7a29f3811 · report
_embed_tokens_single_batch src/ctx_to_lora/modeling/text_to_lora.py unverified MIT (permissive) · 9a22c2784acf8fe5 · report
apply_lora_to_layers src/ctx_to_lora/modeling/text_to_lora.py unverified MIT (permissive) · 937d38a0e976d855 · report
create_hypermod src/ctx_to_lora/modeling/text_to_lora.py unverified MIT (permissive) · 6e23d59c5480daea · report
get_init_peft_weights src/ctx_to_lora/modeling/text_to_lora.py unverified MIT (permissive) · b0fb60a036b8e6ee · report
get_lora_module_names src/ctx_to_lora/modeling/text_to_lora.py unverified MIT (permissive) · 7572df21036527e9 · report
get_model in 368 papers src/ctx_to_lora/modeling/text_to_lora.py unverified MIT (permissive) · 122a565cbe1f2d83 · report
get_model_and_tokenizer in 15 papers src/ctx_to_lora/modeling/text_to_lora.py unverified MIT (permissive) · d38e50d952d93469 · report
get_peft_modules src/ctx_to_lora/modeling/text_to_lora.py unverified MIT (permissive) · 4b6e8a0361945762 · report
get_tokenizer in 156 papers src/ctx_to_lora/modeling/text_to_lora.py unverified MIT (permissive) · f3fb84a5a6d3b065 · report
load_hypermod src/ctx_to_lora/modeling/text_to_lora.py unverified MIT (permissive) · 177a916196a3d9b2 · report
load_hypermod_checkpoint src/ctx_to_lora/modeling/text_to_lora.py unverified MIT (permissive) · 4dc184dbfb1660e4 · report
lora_forward src/ctx_to_lora/modeling/text_to_lora.py unverified MIT (permissive) · f8caf753f4a6cb6a · report

Method as code Syntology

What Syntology's graph records as this paper's claimed method, lifted into code: each assembly names its bricks (functions and classes), each with its own role and its own verification level. An assembly is not a check that the code implements the method correctly or reproduces the paper's results. Levels are each brick's own verification level in Syntology's graph (level 0: no recorded run), listed brick by brick and never combined into one level; “ran” means the brick executed on a synthesized input, not that its output is correct, and the instrument figure counts failures of Syntology's instrument, not of the code. Where a model read the code against the paper's claim, each assembly's label verdict is one model's judgement, kept in this page's JSON twin; it is not calibrated, so no card prints it.

1 assembly on this paper: 1 harvested, 0 generated.

harvested Assembly for Doc-to-LoRA (graph method: Doc-to-LoRA). 33 bricks; individually on a fixture: 19 ran (of which 0 constructed an object rather than computing a result; 7 with no instrument failure: 2 honoured, 0 violated, 5 with no contract checked; 12 where Syntology's instrument failed) · 14 unverified. The assembly has not been run end-to-end.

  1. TextToLoRA entry · level 0 · unverified · 81a8f2d7a29f3811
  2. apply_lora_to_layers helper · level 0 · unverified · 937d38a0e976d855
  3. embed_texts data_transform · level 1 · ran · honoured contract · 895bcd8257169039
  4. get_layers helper · level 1 · ran · our draft was wrong · eb1fa1a3b994be5d
  5. get_peft_modules helper · level 0 · unverified · 4b6e8a0361945762
  6. load_hypermod model · level 0 · unverified · 177a916196a3d9b2
  7. lora_forward helper · level 0 · unverified · f8caf753f4a6cb6a
  8. embed_tokens helper · level 1 · ran · honoured contract · 464adbe41baffcdb
  9. load_hypermod_checkpoint helper · level 0 · unverified · 4dc184dbfb1660e4
  10. _embed_tokens_single_batch helper · level 0 · unverified · 9a22c2784acf8fe5
  11. add_full_stop helper · level 1 · ran · our draft was wrong · e6ae5d7b6ce64ac3
  12. create_hypermod helper · level 0 · unverified · 6e23d59c5480daea
  13. get_emb_model_and_fns helper · level 1 · ran · our draft was wrong · a449079623eb8c90
  14. get_model_and_tokenizer helper · level 0 · unverified · d38e50d952d93469
  15. get_pooling_fn helper · level 1 · ran · our draft was wrong · f6bfe8f5c075f8d0
  16. HyperModulator model · level 0 · unverified · c9a3604b537bfc0e
  17. get_lora_module_names helper · level 0 · unverified · 7572df21036527e9
  18. lora_state_dict_to_tensor_dict helper · level 1 · ran · our draft was wrong · 4eb352ce41bff2cc
  19. get_model helper · level 0 · unverified · 122a565cbe1f2d83
  20. get_tokenizer helper · level 0 · unverified · f3fb84a5a6d3b065
  21. cls_pool helper · level 1 · ran; the contract check could not run (RAISES) · ed175170e2628076
  22. last_token_pool helper · level 1 · ran; the contract check could not run (RAISES) · b6c4cb90c7bfeae1
  23. DiscreteOneHotTaskEncoder helper · level 1 · ran · 21cbf833527e000d
  24. MLPResidualBlock helper · level 1 · ran · 96865de164c308ad
  25. SoftmaxTaskEncoder helper · level 1 · ran · aeca7914797f1f3a
  26. TaskEncoder helper · level 1 · ran · 656b1d9383fc1abf
  27. VQTaskEncoder helper · level 1 · ran · 2c3f7d0ccd979162
  28. apply_rotary_pos_emb helper · level 1 · ran · our draft was wrong · 22f75dc2bea7b46e
  29. get_in_out_features helper · level 1 · ran; the contract check could not run (DEP_MISSING) · 8cbf94593c76c7d4
  30. get_init_peft_weights helper · level 0 · unverified · b0fb60a036b8e6ee
  31. lora_tensor_dict_to_param_dict helper · level 1 · ran · our draft was wrong · 1fc5218833c6c6ea
  32. zero_lora_param_dict helper · level 1 · ran · our draft was wrong · 4731a23d7470dc77
  33. rotate_half helper · level 1 · ran · our draft was wrong · e03d53ba9d4f9ae5

Each brick ends with its code_sha256, Syntology's identity for that exact code; click one to copy the get_code call that returns it. For agents, on Syntology's MCP service: assembly(arxiv_id="2602.15902") returns these assemblies with each brick's role and wiring (how to connect).

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