Back to Blog
AI Agents

RAG Retrieves. Fine-Tuning Forgets. HyperNetworks Inject — and Now We Have the Scaling Laws.

Nace AI's new paper establishes the first scaling laws for HyperNetwork-based knowledge injection into LLMs — a third path beyond RAG and fine-tuning that doesn't touch base weights, doesn't forget, and generalizes better at scale.

V
VSBD Engineering Team
·2026-07-28·6 min read

There are two mainstream answers to the question "how do I get my LLM to reliably use proprietary data?" RAG retrieves relevant chunks at inference time. Fine-tuning bakes new knowledge into the weights. Both are widely deployed. Both have well-documented failure modes that nobody talks about enough.

A new paper from Nace AI and Purdue University proposes a third path — and backs it up with the first systematic scaling laws for the approach. The technique: HyperNetwork-based knowledge injection. The short version: instead of modifying the LLM, you train a second network whose job is to generate LoRA adapters from a batch of facts. The base model never changes.

Why Fine-Tuning Is a Harder Problem Than It Looks

Fine-tuning works. Until it doesn't. The specific failure modes:

  • Catastrophic forgetting. Updating weights on new facts degrades existing capabilities. The more you inject, the more you risk erasing.
  • OOD generalization failure. Fine-tuned models struggle to generalize to new entity combinations not explicitly seen during training — a serious problem in real deployments where new names, regulations, and relationships appear constantly.
  • Instability at scale. Knowledge editing methods like ROME and MEMIT perform fine up to ~1,000 injected facts. Past that, they break unpredictably.
  • Hallucination amplification. New facts that contradict pretraining are learned slowly — and as they are eventually learned, they increase hallucination rates on related queries.

LoRA reduces the cost of fine-tuning but shares the same structural problems. You're still modifying weights. You still forget.

The HyperNetwork Alternative

The paper — "Scaling Laws for HyperNetwork-Based Knowledge Injection in Large Language Models" by Dhankhar, Baha, and Saparov — introduces a clean architectural separation.

A HyperNetwork is a secondary model conditioned on a set of input facts. Instead of updating any weights in the target LLM, the HyperNetwork generates LoRA adapters (ΔW) that are inserted into the target model at inference time. The base model is frozen. Always.

The specific architecture:

  • Fact batch ℱ enters the HyperNetwork as a sequence
  • Transformer encoder (no causal mask, Post-LayerNorm, RoPE) processes the full fact context
  • Mean pooling → linear projection → ΔW (LoRA rank 4, α=8)
  • Adapters inserted only into the upper half of the target model's layers (not the first l/2)
  • Target model answers queries conditioned on the generated adapters

Only the HyperNetwork trains. The target LLM is untouched.

Fine-Tuning / LoRA
Fact Corpus
Gradient Updates
Modifies base weights
Forgetting + OOD Failures
Unpredictable at scale
HyperNetwork Injection
Fact Batch ℱ
HyperNetwork B_θ(ℱ)
Generates LoRA ΔW · Frozen LLM
Steeper OOD Scaling
Power-law · Gap widens at scale

The Scaling Laws

To study scaling rigorously, the team built MegaWikiQA — a benchmark of 10M+ multi-hop question-answer pairs derived from Wikidata5M (4.6M entities, 822 relations, 22M+ triplets across 39 knowledge domains). Questions span 1–4 hops, generated deterministically without LLM involvement, with explicit OOD evaluation splits for unseen entities and relations.

They ran hypernetworks from 167M to 2.8B parameters across multiple target model sizes. Four findings:

  1. Power-law scaling everywhere. Loss, reasoning accuracy, and OOD generalization all follow smooth predictable power laws across hypernetwork depth, width, and target model size. No sharp failure modes.
  2. Scaling the target model beats scaling the hypernetwork. Want better performance? Upgrade the LLM you're adapting — not the injector.
  3. Depth ≈ Width for hypernetwork scaling. Both yield comparable improvements per parameter budget. Choose based on your compute topology.
  4. Better OOD generalization than LoRA fine-tuning at scale. The hypernetwork exhibits steeper OOD scaling curves than both LoRA and full fine-tuning across target model sizes — and the advantage grows as the target model gets larger.

The OOD result is the important one. Fine-tuned models see new entity combinations and fail. The hypernetwork, having learned to read facts and generate appropriate adapters, generalizes — because it never memorized specific entity-weight associations to begin with.

What This Means for Enterprise AI Deployments

Most enterprise AI teams are wrestling with a version of this problem right now: proprietary knowledge that can't go into pretraining (sensitivity, IP), too dynamic for static fine-tuning, and too specific for general RAG to handle reliably.

The hypernetwork approach addresses this structurally:

  • No base model modification → no forgetting, no instability, no vendor lock-in on the training process
  • Predictable scaling → you can estimate performance improvements before committing compute budgets
  • OOD generalization → new regulations, new entity names, new combinations handled without retraining
  • Separation of concerns → the LLM capability layer and the knowledge injection layer are independently upgradable

The practical caveat: this is still a train-time method. You train the HyperNetwork on a fixed fact corpus upfront. It's not zero-shot "plug in any document" like RAG. But the scaling laws suggest that a well-trained HyperNetwork generalizes across fact types far better than an equivalently-trained fine-tuned model.

The Bigger Picture

RAG solves retrieval. Fine-tuning solves internalization but at a cost in stability and generalization. HyperNetworks are beginning to look like a third path: train a network whose job is to learn how to generate weight adaptations from facts — not to memorize the facts themselves.

The scaling laws matter because they make this concrete. "HyperNetworks might generalize better" is a hypothesis. "HyperNetworks exhibit steeper OOD scaling exponents than LoRA fine-tuning, with the gap widening at larger target model scales, following smooth power laws" is a design principle you can engineer around.

That's a different kind of AI infrastructure than most teams are building. It's worth watching closely.

Paper: arxiv.org/abs/2607.19604 · Code & data: huggingface.co/collections/nace-ai/hypernetwork-datasets

Ready to build your PropTech platform?

VSBD has delivered AI-powered real estate platforms across Europe and the USA — on time, within budget, and to award-winning quality.

Get in Touch