Abstract
While Transformer architectures like GPT and BERT dominate natural language processing benchmarks, they often prove suboptimal for pure language modeling tasks. This is primarily due to their difficulty in capturing fine-grained, word-level sequential context compared to recurrent models. This paper introduces Coordinate Architecture Search (CAS), an efficient method that grafts LSTM layers onto pre-trained Transformers and selectively freezes weights. CAS achieves state-of-the-art perplexity on standard benchmarks at a fraction of the computational cost required by traditional neural architecture search.
Introduction
Language modeling—the task of predicting the next word in a sequence—requires a deep understanding of historical context. Recurrent Neural Networks (RNNs), specifically LSTMs, are inherently designed for this by explicitly maintaining a sequential state. In contrast, Transformers rely on self-attention and positional encodings. While excellent at capturing long-range dependencies and enabling parallel training, they often lack the strict word-order sensitivity necessary for optimal next-word prediction.
Furthermore, the search for improved hybrid architectures is typically constrained by massive computational costs. Training large-scale models from scratch for architecture search is often prohibitively expensive. The authors address this by proposing a method to adapt existing, pre-trained Transformers for language modeling efficiently.
Methodology: Coordinate Architecture Search (CAS)
To combine the strengths of Transformers and LSTMs, the authors modify pre-trained GPT and BERT models. For BERT, which is bidirectional, the standard self-attention heads are replaced with masked self-attention to create an autoregressive model suitable for language modeling.
The core of the approach is Coordinate Architecture Search (CAS). Instead of searching an entire architecture space from scratch, CAS iteratively applies three specific transformations to a pre-trained baseline:
- AddLinear: Appends a linear output layer.
- AddLSTM: Inserts an LSTM block to provide sequential context.
- FixSubset: Randomly freezes a subset of Transformer blocks during fine-tuning. This serves as a regularizer, preventing overfitting when fine-tuning large models on smaller datasets like Penn TreeBank.
CAS uses a greedy random-sampling strategy to navigate these modifications, making it significantly faster than traditional Reinforcement Learning or genetic algorithm-based Neural Architecture Search (NAS).
Experimental Results
The models were evaluated on three standard benchmarks: Penn TreeBank (PTB), WikiText-2 (WT-2), and WikiText-103 (WT-103). Because the models leverage pre-trained weights, they utilize sub-word tokenization (BPE for GPT, WordPiece for BERT).
Performance and Efficiency
The architectures discovered by CAS, particularly BERT-CAS, significantly outperformed previous state-of-the-art models like AWD-LSTM-MoS, improving perplexity by an average of 12.0 points. Notably, BERT-Large-CAS (395M parameters) achieved a perplexity of 31.34 on PTB, outperforming the much larger 1.5B parameter GPT-2 model.
The search efficiency of CAS is a major highlight. Finding the optimal architecture on PTB required only 0.15 GPU days, compared to 0.5 GPU days for ENAS and upwards of 1,000 CPU days for standard NAS.
Discussion and Conclusion
The success of CAS highlights several key insights. First, Transformers are not a universal solution; they benefit significantly from the local, fine-grained context provided by LSTMs. Second, freezing weights is an effective strategy for fine-tuning large models on small datasets, acting as a powerful regularizer. Finally, constrained search using strong priors (pre-trained models) can democratize architecture search by drastically reducing compute requirements.
Future work includes applying CAS to models like Transformer-XL to capture even longer context windows and exploring these hybrid architectures for other sequence-sensitive tasks like Named Entity Recognition (NER).
Summary updated