Manuscript Offprint

arXiv:2610.11715

Internalizer: Portable Context-to-Parameter Mapping for Very Large Language Models

Peter Devine, Nick Ryan, Benjamin Sirb, Alex Chiocchi

Abstract

Hypernetworks that map a context directly to a LoRA adapter let a large language model carry that context in its weights, but prior work has demonstrated them only on base models of up to 14 billion parameters.

We present the Internalizer, a state-of-the-art, portable Context-to-Parameter Mapping hypernetwork that generates document-specific LoRA adapters for the frozen 284B-parameter DeepSeek v4 Flash, a target twenty times larger than in any previous work. Most of its parameters live in a model-agnostic trunk with only thin entry and exit layers per base model, so it trains cheaply against small models before being ported to the large one.

On unseen documents of up to 4096 tokens, the generated adapters reach 84.9% top-1 and 97.8% top-5 teacher-forced accuracy against 63.4% and 83.5% for the base model, with nothing in the context window but a three-word instruction.

Once the hypernetwork is trained, a single forward pass turns any document into an adapter for such a model, which could be served alone for speed or alongside the document in the window to raise accuracy further.

1 Introduction

Large Language Models (LLMs) have become widely used in commercial and information-technology pipelines (Bick et al., 2024), largely because they offer higher accuracy and lower cost than human labour in many areas (Gilardi et al., 2023).

However, these advantages do not extend to all tasks, as for many use cases LLM inference remains too expensive (Zhou et al., 2024), or model accuracy too low (Huang et al., 2025), to justify deployment.

Three major causes of high cost and low accuracy are bloated context windows (Jiang et al., 2023), the inefficiency of in-context learning (Brown et al., 2020; Mu et al., 2023), and the impracticality of per-task training (Hu et al., 2022).

Commercial tasks often fill the context window with task-relevant information, raising the latency, and thus the cost, of inference, while the "lost-in-the-middle" phenomenon erodes accuracy as context length grows (Liu et al., 2024).

In-context learning of complex tasks requires task explanations and worked examples in the window, and often long chain-of-thought traces before an output, driving up cost further.

Fine-tuning primes a model for a specific task, but it is too expensive and slow for all but the most important repeated tasks (Han et al., 2024). Even then, the resulting task adapter knows nothing of the particular input it will be used on.

To tackle these three challenges, previous work has proposed Context-to-Parameter Mapping, a hypernetwork framework that generates a context-specific LoRA adapter for a given task (Gao et al., 2026). The context can be a document, a code file, a set of table schemas, an image, or any other tokenizable LLM input. The hypernetwork converts this context into a LoRA adapter, and at inference time the model input, a user question, command, or instruction relating to that context, produces the model output as in ordinary LLM use.

The adapter is computed once per context and can be pre-generated and cached, effectively internalizing the context within the LLM. Since the hypernetwork is meta-learned, this adaptation is cheap and near-instant even for very large language models, in contrast to per-task fine-tuning. The adapter can then be served in two ways. In a speed mode it replaces the context in the window, reducing inference time and cost, or in an accuracy mode the context stays in the window and the adapter is served alongside it, which is the setting we expect to matter most in practice.

Accuracy improves because the adapters are not only specialised for a given task (e.g. document

Figure

Figure 1: System architecture, with the shared trunk in light green and the thin model-specific entry and exit layers in dark green.

QA, code generation, table traversal, image QA) but also carry knowledge of the specific context they will be used on. This is, in effect, a superset of standard LoRA training, with the adapter conditioned on the context as well as the task. Previous work has shown that such adapters can outperform in-context use of the very context they were generated from (Yu et al., 2026), and an adapter served alongside that context has both sources to draw on.

However, Context-to-Parameter Mapping has only ever been demonstrated on small models and academic benchmarks, and no prior work has targeted a language model beyond 14 billion parameters. This limits its applicability to commercial tasks, which often require the accuracy of far larger models.

We present the Internalizer, a state-of-the-art, portable Context-to-Parameter Mapping hypernetwork that scales to LLMs with hundreds of billions of parameters. Its largely model-agnostic architecture allows the hypernetwork to be re-used across LLMs, massively reducing re-training cost, and enables application to much larger language models than was previously feasible.

Four main design choices carry this result. Oversized entry and exit projections decouple the trunk’s representational capacity from any target model’s hidden width. Adapter slots are restricted to the gated MLP projections that virtually every modern backbone shares, which is what lets one trunk serve many base models. An error-gated loss focuses training on the hard tokens, such as names and numbers, that downstream tasks depend on. Finally, a strategy we call reverse distillation does the bulk of the learning cheaply against small base models before porting to the expensive target.

In our experiments, we internalize documents up to 4096 tokens long into a 284B-parameter model (DeepSeek v4 Flash 0731 (DeepSeek-AI, 2026)) at 84.9% top-1 teacher-forced accuracy against 63.4% for the base model, demonstrating that this approach is tractable even for some of the largest state-of-the-art LLMs. This is a target model twenty times larger than in any previous research (Muhtar et al., 2024), which to our knowledge makes the Internalizer the state-of-the-art hypernetwork for context internalization.

This makes Context-to-Parameter Mapping much more practically useful. At the scale of prior work, models are small enough that their accuracy often falls short of commercial requirements, so a context-specific adapter has little to build on. At the scale of state-of-the-art models the base accuracy is high enough that a further gain is worth having, and training an individual LoRA per task or context grows more expensive with model size, exactly where a single hypernetwork forward pass replaces it. The training cost is paid once, and from then on any document, schema, or code file becomes a context-informed LoRA adapter on demand, whether served alone in speed mode or in accuracy mode alongside the context it was generated from. The Internalizer is fully model-agnostic, and we aim to apply it to improve accuracy, and where the context can be dropped to reduce inference cost, across a variety of real-world use cases.

This paper sets out our architecture, pre-training strategy, and vision for how this technology can be used.

References (12)