scaling-laws ood-generalization llm-adaptation large-scale-datasets knowledge-injection fact-reasoning hypernetworks lora-adapter
Abstract
Injecting factual knowledge into large language models (LLMs) reliably and at scale remains an open challenge. Hypernetworks provide a promising solution to large-scale knowledge injection. Although hypernetworks are typically applied for test-time adaptation, we explore their use in train-time knowledge injection, where, given a large corpus of facts, we train a hypernetwork to generate a fixed LoRA adapter that, when inserted into the target model, enable the model to answer questions about those facts. In this work, we investigate whether hypernetworks can be used to perform train-time knowledge injection and how this ability varies with scale. The scaling behavior of hypernetworks remains largely unstudied. Our design decouples the hypernetwork's injection capacity from the target model's general capability, enabling, for the first time, a rigorous study of scaling laws for hypernetwork architectures. We characterize how loss, reasoning accuracy, and out-of-distribution (OOD) generalization vary with hypernetwork depth, width, and target network size. We construct a large-scale dataset, called MegaWikiQA, containing tens of millions of multi-hop question-answer examples across 39 domains constructed from examples in Wikidata5M. Our results reveal: (i) hypernetwork-based injection exhibits broadly predictive power law scaling along all architecture axes; and (ii) hypernetworks are capable of reliable OOD generalization at increasing scales, suggesting that hypernetwork provides a promising alternative to other train-time adaptation methods such as LoRA finetuning and full fine-tuning, exhibiting steeper scaling exponents in all OOD evaluations. Together, these results establish hypernetworks as a principled and scalable substrate for train-time adaptation, and provide the first empirically grounded scaling laws to guide hypernetworks for factual reasoning in large language models.
한국어 요약
한 줄 요약
하이퍼네트워크 기반 지식 주입이 대규모 언어 모델에서 예측 가능한 스케일링 법칙과 우수한 OOD 일반화를 보인다.
핵심 기여도
- 하이퍼네트워크를 사용한 트레인타임 지식 주입의 스케일링 법칙을 첫 번째로 실증적으로 분석.
- MegaWikiQA 데이터셋(39개 도메인, 수십억 개의 멀티홉 QA)을 구축하여 체계적 실험 가능.
- 하이퍼네트워크의 깊이, 너비, 주입된 사실 수에 따른 성능 변화를 파워로우로 정량화.
- OOD 일반화에서 하이퍼네트워크가 LoRA와 full fine-tuning보다 더 가파른 스케일링 지수를 보임.
핵심 아이디어
기존 지식 주입 방법은 파라미터 수정을 통해 이루어지며, 이는 카테고리컬 포팅이나 OOD 일반화에 약점을 가진다. 본 연구는 하이퍼네트워크를 활용하여, **LoRA 어댑터를 생성하는 방식**으로 기존 모델 파라미터를 수정하지 않고 지식을 주입하는 새로운 접근법을 제안한다. 이는 **트레인타임 지식 내재화**(train-time knowledge internalization)를 목표로 하며, 주입된 사실에 조건을 주어 어댑터를 생성하는 방식으로, **기본 모델의 파라미터를 보존**하면서도 새로운 지식을 학습한다.
핵심 통찰은 하이퍼네트워크가 **트랜스포머 아키텍처 내에서 깊이, 너비, 주입된 사실 수에 따라 예측 가능한 성능 향상**을 보인다는 점이다. 특히, OOD 일반화에서 하이퍼네트워크가 기존 PEFT 방법보다 더 빠르게 성능이 향상된다는 점이 주목할 만하다.
기술적 접근법
- **하이퍼네트워크 아키텍처**: 트랜스포머 기반, 깊이(1~16층), 너비(32~1024 차원)를 조절하며 실험.
- **주입 방식**: 주입된 사실에 조건을 주어 **LoRA 어댑터**를 생성.
- **데이터셋**: MegaWikiQA (Wikidata5M 기반, 39개 도메인, 수십억 개의 멀티홉 QA).
- **평가 지표**: ID/ODD loss, OOD 리퍼레이즈 질문, OOD MCQ.
- **모델**: Qwen2.5-1.5B-Instruct를 고정된 타겟 모델로 사용.
- **하이퍼파라미터 스케일링**: 하이퍼네트워크 크기 167M~2.8B 파라미터 범위에서 실험.
주요 결과
- **하이퍼네트워크 너비 스케일링**: 너비가 32에서 1024로 증가할 때, OOD 일반화 성능이 가파르게 향상됨.
- **하이퍼네트워크 깊이 스케일링**: 1~16층으로 증가시켰을 때, 성능 향상이 지속되며, 8~16층에서 가장 큰 개선.
- **타겟 모델 스케일링**: Qwen2.5-1.5B에서 14B로 확장할수록 OOD 성능이 크게 향상됨.
- **주입된 사실 수 증가**: 예시당 주입된 사실 수가 증가할수록 정확도가 향상됨.
- **OOD 일반화**: 하이퍼네트워크는 LoRA와 full fine-tuning 대비 **더 가파른 스케일링 지수**를 보이며, 특히 OOD MCQ에서 10% 이상의 성능 개선.
의의 및 한계
본 연구는 하이퍼네트워크 기반 지식 주입의 **스케일링 법칙을 체계적으로 분석**하여, 대규모 언어 모델의 지식 주입 전략에 실질적 지침을 제공한다. 특히, 하이퍼네트워크가 **기존 PEFT 방법보다 OOD 일반화에서 우수한 성능**을 보인다는 점은 실용적 가치가 크다.
그러나, 하이퍼네트워크 자체의 파라미터 수가 타겟 모델과 비슷한 수준(예: 2.5B vs. 1.5B)에 도달하면 **배포성 문제가 발생**하며, 이는 효율적인 하이퍼네트워크 아키텍처 설계를 위한 추가 연구가 필요하다는 한계를 드러낸다. 또한, **멀티홉 추론의 깊이**가 증가할 경우 하이퍼네트워크의 성능 변화는 아직 분석되지 않았다.
실용적 활용
본 연구는 **의료, 법률, 금융** 등 민감한 도메인에서의 지식 주입에 적합한 방식을 제시한다. 특히, **로컬 모델에 지식을 내재화**하면서도 외부 데이터에 접근하지 않는 방식은 데이터 보안과 일반화 능력을 동시에 확보할 수 있다. 또한, **대규모 지식 베이스를 활용한 QA 시스템**이나 **사후 트레이닝**(post-training) 과정에도 활용 가능하다.