HyperAIHyperAI

Command Palette

Search for a command to run...

大規模言語モデルにおけるハイパーネットワークに基づく知識注入のスケーリング則

Nischay Dhankhar Dos Baha Abulhair Saparov

概要

ハイパーネットワークは、大規模な知識注入に対して有望な解決策を提供する。ハイパーネットワークは通常、テスト時適応に適用されるが、本研究では学習時知識注入におけるその利用を探求する。具体的には、大規模な事実コーパスが与えられた際に、固定されたLoRAアダプタを生成するようにハイパーネットワークを訓練し、そのアダプタを対象モデルに挿入することで、モデルがそれらの事実に関する質問に回答できるようにする。本研究では、ハイパーネットワークが学習時知識注入に利用可能かどうか、そしてその能力が規模に応じてどのように変化するかを調査する。ハイパーネットワーク自体のスケーリング挙動は、ほとんど研究されていない。我々の設計は、ハイパーネットワークの注入能力を対象モデルの汎用能力から切り離すことで、知識注入の文脈におけるハイパーネットワークアーキテクチャのスケーリング則に関する、厳密かつ制御された研究を初めて可能にする。我々は、損失、推論精度、および分布外汎化が、ハイパーネットワークの深さ、幅、および対象ネットワークサイズの関数としてどのように変化するかを特徴付ける。この目的のために、Wikidata5Mの事例から構築された39の知識ドメインにわたる数千万件の多段階質問応答事例を含む大規模データセットMegaWikiQAを構築した。結果は以下を明らかにする。(i) ハイパーネットワークに基づく注入は、全てのアーキテクチャ軸に沿って広範な予測的べき乗則スケーリングを示す。(ii) ハイパーネットワークは、規模の増大に伴い、未見のエンティティや関係に対する信頼性の高い分布外汎化が可能であり、これはハイパーネットワーク適応が、LoRAファインチューニングや完全ファインチューニングといった他の学習時適応手法に代わる有望な選択肢を提供し、全ての分布外評価においてより急峻なスケーリング指数を示すことを示唆している。これらの結果は総じて、ハイパーネットワークを学習時知識注入のための原理的かつスケーラブルな基盤として確立し、大規模言語モデルにおける事実推論のためのハイパーネットワーク設計を導く、初めての経験的に裏付けられたスケーリング則を提供する。

One-sentence Summary

Researchers from Nace AI and Purdue University establish scaling laws for hypernetwork-based train-time knowledge injection, wherein a hypernetwork generates LoRA adapters to enable factual reasoning in large language models, revealing power-law scaling with hypernetwork depth, width, and target model size and reliable out-of-distribution generalization that outperforms LoRA fine-tuning, supported by their large-scale MegaWikiQA dataset.

Key Contributions

  • MegaWikiQA, a large-scale dataset of tens of millions of deterministic multi-hop question-answer examples across 39 knowledge domains, is introduced for controlled scaling experiments and out-of-distribution evaluation in knowledge injection.
  • The first systematic scaling laws for hypernetwork architectures in train-time knowledge injection are presented, characterizing power-law scaling of loss, reasoning accuracy, and out-of-distribution performance with hypernetwork width, depth, target model size, and number of injected facts.
  • Hypernetwork-based injection yields steeper scaling exponents and more reliable out-of-distribution generalization to unseen entities and relations than LoRA fine-tuning or full fine-tuning under matched capacity, establishing it as a principled and scalable method for factual reasoning in large language models.

Introduction

Large language models must reliably internalize and generalize domain-specific factual knowledge for sensitive applications like medicine, law, and finance, where full fine-tuning is costly and even parameter-efficient methods (e.g., LoRA) suffer from catastrophic forgetting and poor out-of-distribution generalization. Hypernetworks offer an alternative by generating LoRA-style weight adaptations conditioned on a corpus of facts, without modifying the base model parameters, but their scaling behavior remained unknown. The authors present the first systematic empirical scaling laws for hypernetwork-based knowledge injection, analyzing how performance varies with hypernetwork width, depth, target model size, and the number of injected facts, using a new large-scale dataset called MegaWikiQA. They find that hypernetwork adaptation exhibits smooth predictable scaling and substantially better out-of-distribution generalization than standard finetuning approaches as model size grows.

Dataset

The authors construct MegaWikiQA, a large-scale dataset for studying knowledge injection, entirely from the Wikidata5M knowledge graph.

  • Sources and foundation: Wikidata5M contains ~4.6M entities, 822 relations, and over 22 million triplets. Its graph structure and unambiguous triplets support deterministic generation of both single-hop and multi-hop question-answer pairs.
  • Question generation: k-hop walks (k = 1–4) are randomly sampled across the graph. A grammar-based pipeline converts each walk into a natural-language question and answer using manually curated templates for each relation. Only one-to-one and many-to-one relations are retained to guarantee deterministic, unambiguous answers.
  • Filtering and balancing: Every example is assigned to one of 39 knowledge domains through a two-stage domain classifier. Examples with uncertain domain labels are removed. The initial pool of roughly 10 million examples per hop count is then balanced across domains and hop counts, yielding a final training set of 1.25 million samples.
  • Fact injection protocol during training: Each training sample consists of an injected fact set, a query, and a ground-truth answer. The fact set includes one relevant fact (drawn from the k-hop walk that generated the query) and N-1 distractor facts sampled uniformly at random from the full fact collection. Models must reason over this set to answer.
  • Evaluation splits:
    • In-distribution (ID): 10,000 examples, stratified by domain and hop count, with no triplet overlap with the training set.
    • Out-of-distribution (OOD): 10,000 examples drawn exclusively from three held-out domains (philosophy, linguistics, civil engineering). This set includes both original grammar-based questions and GPT-4.1 rephrased versions to probe generalization beyond surface form.
    • MCQ split: constructed from the same OOD examples, where each question offers four choices (one correct plus three random distractors).

Method

The authors study the problem of knowledge injection, where a large corpus of facts Ω\OmegaΩ is injected into a frozen language model Mθ\mathcal{M}_\thetaMθ with fixed parameters θ\thetaθ. The core objective is to produce an answer aaa consistent with a relevant fact from an injected fact set F\mathcal{F}F, without modifying the base model parameters θ\thetaθ at any point. Only the hypernetwork parameters ϕ\phiϕ are updated during training, which helps mitigate the high cost of fine-tuning and facilitates out-of-distribution generalization.

As shown in the figure below, the proposed framework utilizes a transformer-based hypernetwork gϕg_\phigϕ to generate contextual weight adaptations for the target model. The hypernetwork maps an input fact set F\mathcal{F}F to a collection of LoRA-style weight adaptations, which are applied to the frozen target model during the forward pass. The target model remains fully frozen throughout both training and inference.

The hypernetwork is initialized entirely from random weights to avoid conflating the effect of pretraining with architectural capacity. It employs a LoRA rank of r=4r = 4r=4 and a scaling factor of α=8\alpha = 8α=8. The authors systematically scale the transformer hypernetwork along three independent axes to characterize scaling laws: depth (varying the number of transformer layers LHNL_{\text{HN}}LHN), width (varying the hidden dimension dmodeld_{\text{model}}dmodel), and fact count (varying the number of injected facts NNN per example).

During training, each example consists of a natural language query qqq and a set of NNN injected facts F={f1,,fN}Ω\mathcal{F} = \{f_1, \dots, f_N\} \subset \OmegaF={f1,,fN}Ω. Exactly one fact in F\mathcal{F}F is relevant to answering qqq, randomly selected from the k-hop sequence of facts used to generate the question-answer pair. The remaining N1N - 1N1 facts are negative facts sampled uniformly at random from Ω\OmegaΩ. This setup encourages the hypernetwork to identify and utilize the relevant fact from a noisy input context, translating it into weight adaptations that steer the frozen target model toward the correct answer. The authors fix N=4N = 4N=4 facts per example across most experiments, studying the effect of varying NNN in dedicated scaling experiments.

Experiment

Using a comprehensive suite of scaling experiments on the MegaWikiQA dataset with frozen Qwen2.5 language models, the paper examine how hypernetwork width, depth, target model size, and injected fact count influence in-distribution loss and three forms of out-of-distribution generalization. All dimensions show smooth power-law improvements, but scaling the target model yields the steepest gains per unit compute, while linguistic robustness to rephrased questions remains the most difficult to improve across any single axis. When comparing knowledge injection via hypernetworks versus direct finetuning (LoRA and full), the hypernetwork’s advantage on out-of-distribution tests grows monotonically with target model size, making it increasingly favorable for reliable generalization at scale.

Target model size is the most effective scaling axis, yielding steeper loss reductions than hypernetwork width, depth, or fact count. In-distribution scaling favors fine-tuning methods slightly, but the hypernetwork scales better on all out-of-distribution metrics, with its relative advantage increasing at larger model sizes. OOD rephrased evaluation consistently shows the flattest scaling, indicating that robustness to linguistic variation is the hardest to improve through scaling. Target model size scaling produces the steepest exponents across all metrics, with hypernetwork target scaling reaching −0.226 on in-distribution validation, compared to −0.096 for width, −0.088 for depth, and −0.080 for fact count. OOD rephrased metrics have the shallowest exponents across every axis (e.g., −0.036 for HN width, −0.028 for fact count), making linguistic robustness the least responsive to scaling. On in-distribution validation, LoRA fine-tuning (−0.250) and full fine-tuning (−0.249) scale slightly more favorably than the hypernetwork (−0.226). On all OOD splits, the hypernetwork exhibits steeper scaling than fine-tuning, notably on OOD rephrased (−0.107 vs. −0.083 LoRA, −0.069 full FT) and OOD MCQ (−0.171 vs. −0.119 and −0.101). The OOD advantage of the hypernetwork widens as target model size grows, so the hypernetwork paradigm becomes increasingly beneficial at larger scales.

This study scales target model size, hypernetwork width and depth, and knowledge facts, comparing a hypernetwork-based approach to LoRA and full fine-tuning on in-distribution and out-of-distribution generalization. Target model size emerges as the most effective axis for loss reduction across all methods. While fine-tuning scales slightly better in-distribution, the hypernetwork shows steeper improvement on all out-of-distribution metrics, with its advantage widening at larger model sizes; linguistic robustness to rephrasing remains the hardest capability to improve through any scaling dimension.


AIでAIを構築

アイデアからローンチまで — 無料のAIコーディング支援、すぐに使える環境、最高のGPU価格でAI開発を加速。

AI コーディング補助
すぐに使える GPU
最適な料金体系

HyperAI Newsletters

最新情報を購読する
北京時間 毎週月曜日の午前9時 に、その週の最新情報をメールでお届けします
メール配信サービスは MailChimp によって提供されています