Lune

ICML2026Top-tier venue

Doc-to-LoRA: Learning to Instantly Internalize Contexts

Rujikorn Charakorn, Edoardo Cetin, Shinnosuke Uesaka, Robert Lange

Abstract

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 nearperfect zero-shot accuracy at sequence lengths exceeding the target LLM's native context window by more than 4×. 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. Checkout our project at github.com/SakanaAI/doc-to-lora. *S. Uesaka contributed while he was an intern at Sakana AI.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

3 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Learning to Compress Prompts with Gist Tokens cites Language Models are Few-Shot Learners
  • LoRAGen: Structure-Aware Weight Space Learning for LoRA Generation cites SHINE: A Scalable In-Context Hypernetwork for Mapping Context to LoRA in a Single Pass
  • SHINE: A Scalable In-Context Hypernetwork for Mapping Context to LoRA in a Single Pass cites LongBench: A Bilingual, Multitask Benchmark for Long Context Understanding
  • SHINE: A Scalable In-Context Hypernetwork for Mapping Context to LoRA in a Single Pass cites Understanding LoRA as Knowledge Memory: An Empirical Analysis
  • SHINE: A Scalable In-Context Hypernetwork for Mapping Context to LoRA in a Single Pass cites Language Models are Few-Shot Learners
  • Understanding LoRA as Knowledge Memory: An Empirical Analysis cites Language Models are Few-Shot Learners
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers3

  1. SHINE: A Scalable In-Context Hypernetwork for Mapping Context to LoRA in a Single PassYewei Liu, Xiyuan Wang, Yansheng Mao, Yoav Gelberg et al.ICML 2026 · 11 citations
  2. Understanding LoRA as Knowledge Memory: An Empirical AnalysisSeungju Back, Dongwoo Lee, Naun Kang, Taehee Lee et al.ICML 2026 · 10 citations
  3. LoRAGen: Structure-Aware Weight Space Learning for LoRA GenerationHao Huang, Jingtao Ding, Mengqi Liao, Xin Wang et al.ICLR 2026

Builds on21

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. Machine UnlearningLucas Bourtoule, Varun Chandrasekaran, Christopher A. Choquette-Choo, Hengrui Jia et al.S&P 2021 · 1,381 citations
  3. Learning to Compress Prompts with Gist TokensJesse Mu, Xiang Li, Noah D. GoodmanNeurIPS 2023 · 488 citations
  4. Continual learning with hypernetworksJohannes von Oswald, Christian Henning, João Sacramento, Benjamin F. GreweICLR 2020 · 412 citations
  5. LongBench: A Bilingual, Multitask Benchmark for Long Context UnderstandingYushi Bai, Xin Lv, Jiajie Zhang, Hongchang Lyu et al.ACL 2024 · 94 citations

Related papers

  1. Text-to-LoRA: Instant Transformer AdaptionRujikorn Charakorn, Edoardo Cetin, Yujin Tang, Robert Tjarko LangeICML 2025
  2. LLoCO: Learning Long Contexts OfflineSijun Tan, Xiuyu Li, Shishir G. Patil, Ziyang Wu et al.EMNLP 2024 · 3 citations
  3. PERK: Long-Context Reasoning as Parameter-Efficient Test-Time LearningZeming Chen, Angelika Romanou, Gail Weiss, Antoine BosselutICLR 2026 · 4 citations
  4. Drag-and-Drop LLMs: Zero-Shot Prompt-to-WeightsZhiyuan Liang, Dongwen Tang, Yuhao Zhou, Xuanlei Zhao et al.NeurIPS 2025 · 22 citations
  5. Generative Adapter: Contextualizing Language Models in Parameters with A Single Forward PassTong Chen, Hao Fang, Patrick Xia, Xiaodong Liu et al.ICLR 2025
Dusk over the sea between two cliffs drawn in fine vertical lines