TL;DR
This paper introduces "Projected Networks" (PN), a novel architecture that allows a large, high-capacity model to be efficiently "projected" into smaller, specialized models. This approach aims to achieve good performance on specialized tasks with limited in-domain data and tight inference budgets, outperforming traditional methods like distillation and hard mixtures of experts.
What Problem Does This Paper Address?
Large Language Models (LLMs) are incredibly powerful but come with a significant drawback: high inference costs due to their massive size. This makes them impractical for applications with limited computational resources or tight budgets. While smaller language models (SLMs) are efficient, they typically struggle to achieve high performance unless trained on a large, specialized dataset, which is often costly and difficult to obtain. This paper tackles the challenge of building specialized SLMs that perform well even when in-domain training data is scarce and inference budgets are constrained.
Methods
The core innovation is the Projected Network (PN) architecture. During generic pretraining, a large PN model is trained. However, each training example only interacts with a projection of the model's parameters onto a smaller SLM. This projection is achieved by decomposing layer weight matrices into smaller, shared components.
Specifically, for a layer $l$, the weight matrix $W^{(l,i)}$ for the $i$-th expert (a small model) is computed as:
$W^{(l,i)} = \sum_{q=1}^{h} \sum_{r=1}^{m} E_i^{(q,r)} M^{(l,q)} T^{(l,r)}$
where $E_i$ is an expert-specific vector, $M^{(l)}$ is a layer-specific matrix, and $T^{(l)}$ is a parameter tensor. This allows the PN to have a large capacity during pretraining while ensuring that any instantiated SLM (by selecting a specific expert $i$) operates within a predefined size limit.
For specialization, one of these projected SLMs is selected and fine-tuned on the target domain data. This is in contrast to distillation, where a large "teacher" model trains a smaller "student" model, and hard mixtures of experts, where separate SLMs are trained on different data clusters.
Datasets
- Generic Pretraining: The paper uses the
c4dataset, a large collection of English text derived from Common Crawl. - Specialization: The models are specialized on nine domains from the Pile dataset, including
arxiv(science),europarl(parliamentary proceedings),freelaw(legal text),gutenberg(old books),opensubtitles(theatrical subtitles),openwebtext2(forum),pubmed-abstracts(medical abstracts),stackexchange(Q&A), andwikipedia(encyclopedia articles). - Data Sizes: For specialization, datasets of size 1 million, 8 million, and 64 million tokens were used.
Key Insights and Ideas
- Decoupling Pretraining Capacity from Inference Size: The PN architecture elegantly separates the need for high capacity during generic pretraining from the strict inference size constraints of the final specialized model.
- Efficient Specialization: Fine-tuning a single projected expert is computationally much cheaper than retraining a full SLM or training a hard mixture of experts, especially when specialization data is limited.
- Pretraining Matters, Even for Small Models: Even though the projected experts are small, pretraining them within the PN framework on a large generic dataset significantly improves their performance on specialized tasks compared to training from scratch on limited domain data.
- Clustering as a Proxy for Specialization: The paper leverages clustering of the generic pretraining data to define "experts," suggesting that these clusters can act as proxies for specialized domains, even when the exact specialization data is unknown during pretraining.
- Distillation is Less Competitive: The paper shows that distillation, while a common technique for model compression, is not as competitive as PN or hard mixtures of experts in terms of perplexity per training cost.
Key Results
- Improved Perplexity: Projected Networks (SLM-pn) consistently achieve better specialized perplexity than vanilla SLMs trained on generic data (SLM-generic) or only on specialized data (SLM-nopt), especially when specialization data is scarce (1M tokens).
- Competitive with Hard Mixtures: SLM-pn performs comparably to or better than hard mixtures of experts (SLM-mix) across various settings, often with a more efficient pretraining process.
- Scalability: The paper explores varying the number of experts (k) and capacity multiplier (h) in PN, showing that these can be tuned independently to balance pretraining cost and performance.
- Fine-tuning Efficiency: Fine-tuning projected experts is efficient, with costs growing roughly 10x when the specialization set size grows 8x. LLMs require fewer but more expensive fine-tuning steps.
Limitations and Future Work
- Clustering Impact: The paper notes that the effectiveness of PN and hard mixtures might be influenced by the clustering of the pretraining data. Domains with high entropy (i.e., data spread across many clusters) might be less amenable to this expert-based approach. The authors suggest further research into clustering methods.
- Domain Specificity: While PN and hard mixtures show benefits, they don't always outperform a fully pre-trained and fine-tuned SLM (SLM-pt) on domains like Wikipedia and OpenWebText2, especially when larger specialization datasets are available. This suggests that for very large specialized datasets, a direct fine-tuning approach might still be superior.
- Generalizability: The authors express interest in extending their methodology to other modalities beyond language modeling, such as computer vision, where inference constraints are also critical.
Summary updated