[Paper Review] Efficient Contextual Representation Learning Without Softmax Layer
This paper proposes a method to accelerate contextual representation learning by replacing the computationally expensive softmax output layer with a Semfit layer that leverages pre-trained word embeddings, reducing training time by 4x and eliminating 80% of trainable parameters in ELMo while maintaining competitive performance on downstream tasks.
Contextual representation models have achieved great success in improving various downstream tasks. However, these language-model-based encoders are difficult to train due to the large parameter sizes and high computational complexity. By carefully examining the training procedure, we find that the softmax layer (the output layer) causes significant inefficiency due to the large vocabulary size. Therefore, we redesign the learning objective and propose an efficient framework for training contextual representation models. Specifically, the proposed approach bypasses the softmax layer by performing language modeling with dimension reduction, and allows the models to leverage pre-trained word embeddings. Our framework reduces the time spent on the output layer to a negligible level, eliminates almost all the trainable parameters of the softmax layer and performs language modeling without truncating the vocabulary. When applied to ELMo, our method achieves a 4 times speedup and eliminates 80% trainable parameters while achieving competitive performance on downstream tasks.
Motivation & Objective
- Address the high computational cost and long training time of contextual representation models like ELMo, which are dominated by the softmax output layer.
- Reduce the training burden of large vocabulary sizes (e.g., 800K words) that severely impact efficiency and scalability.
- Decouple context encoder learning from word prediction by replacing the softmax layer with a parameter-efficient, dimension-reduction-based alternative.
- Enable efficient training on large-scale corpora without vocabulary truncation or subword tokenization, while preserving model performance.
- Demonstrate that the Semfit layer enables faster, scalable training with minimal impact on downstream task accuracy.
Proposed method
- Replace the standard softmax output layer in language modeling with the Semfit layer, which predicts the target word embedding directly instead of a probability distribution.
- Use pre-trained word embeddings as a fixed lookup table, eliminating the need to learn a large embedding matrix W ∈ ℝ^{V×m} in the output layer.
- Train the contextual encoder by minimizing the L2 distance between its output representation and the pre-trained word embedding of the ground-truth word.
- Leverage the Semfit layer’s constant-time complexity and low memory footprint to scale efficiently to large vocabularies.
- Apply the framework to ELMo by replacing its softmax layer with Semfit, while keeping the rest of the architecture (LSTM encoder) unchanged.
- Use dimension reduction implicitly through the Semfit layer’s mechanism, which projects the context vector to match the pre-trained embedding space.
Experimental results
Research questions
- RQ1Can we eliminate the softmax output layer in contextual representation learning without sacrificing performance on downstream tasks?
- RQ2How does replacing the softmax layer with a Semfit layer affect training speed and parameter efficiency in models like ELMo?
- RQ3To what extent can pre-trained word embeddings be used to decouple context and word representation learning in a way that maintains model accuracy?
- RQ4How does the Semfit layer scale in terms of computational efficiency across different vocabulary sizes and GPU configurations?
- RQ5Does the proposed method outperform subword-level language modeling approaches in terms of training speed and resource efficiency?
Key findings
- The proposed method achieves a 4x speedup in training ELMo compared to the original model with a softmax layer.
- The method eliminates approximately 80% of the trainable parameters in ELMo by removing the large embedding matrix of the softmax layer.
- On SentEval, SST-5, and NER, the model achieves performance comparable to ELMo with a softmax layer (ELMo-S_OneB), demonstrating competitive downstream performance.
- On Coref and SNLI, the model underperforms relative to ELMo-S_OneB and even fails to outperform FastText on SNLI, indicating limitations in certain tasks.
- The Semfit layer shows superior scalability on multi-GPU setups, with speedup increasing from one to four GPUs, especially for large vocabularies.
- For a 2M-word vocabulary, the Semfit layer achieves significant speedup even on a single GPU, while adaptive softmax becomes counter-productive due to communication overhead on multiple GPUs.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.