Introduction
Bidirectional representations, popularized by BERT, have set new standards in Natural Language Processing. However, applying these models to unsupervised tasks like $N$-best list reranking or semantic similarity often incurs a massive computational penalty. Because BERT’s Masked Language Modeling (MLM) objective requires masking tokens, obtaining a full sentence representation typically involves $n$ separate passes for a sentence of length $n$, leading to $O(n^3)$ complexity. This paper introduces the Transformer-based Text Autoencoder (T-TA), which achieves deep bidirectional context in a single $O(n^2)$ pass, offering up to a 12x speedup on CPU.
The Language Autoencoding Objective
The core innovation of T-TA is the Language Autoencoding (LAE) training objective. Unlike Causal Language Modeling (which looks only at the past) or Masked Language Modeling (which hides tokens from the input), LAE aims to predict every token in a sequence simultaneously using all other tokens as context.
As shown in Figure 4(c), the LAE objective allows each output position to attend to the entire input sequence except for itself. This "self-unknown" property is critical; without it, the model would simply learn a trivial identity function by copying the input directly to the output.
Architectural Innovations
To implement the LAE objective efficiently within a deep Transformer framework, the authors introduce two structural modifications:
- Diagonal Masking: The self-attention mechanism is modified so that the $i$-th query cannot attend to the $i$-th key. This ensures that the representation for a word is built entirely from its surrounding context.
- Input Isolation: In standard Transformers, residual connections allow information from the $i$-th input token to "leak" into the $i$-th hidden state in subsequent layers. To prevent this and maintain the "self-unknown" constraint, T-TA fixes the Key ($K$) and Value ($V$) vectors to the initial embeddings for all layers. Only the Query ($Q$) vector is transformed as it moves through the network.
Performance and Efficiency
T-TA was evaluated on ASR reranking (LibriSpeech), NMT reranking (WMT13), and semantic similarity (STS-B).
- Speed: T-TA provides a dramatic efficiency gain. On CPU, it is 6.35x faster for reranking and 12.7x faster for semantic similarity compared to BERT-based approaches. While the gap narrows on GPUs due to parallel batching capabilities, T-TA remains nearly twice as fast.
- Accuracy: Despite its smaller footprint, a 3-layer T-TA outperformed a 12-layer BERT-base on LibriSpeech ASR reranking (12.38 vs 12.46 WER). In unsupervised semantic similarity, T-TA achieved a Pearson’s $r$ of 62.27, significantly higher than BERT’s 54.22, suggesting that the LAE objective captures sentence-level semantics more effectively for zero-shot tasks.
Conclusion
T-TA demonstrates that the computational bottleneck of bidirectional models is not a fundamental limitation of the Transformer architecture, but a consequence of the training objective. By internalizing the masking process through Diagonal Masking and Input Isolation, T-TA provides a high-performance, low-latency alternative for real-time unsupervised NLP applications.
Summary updated