[Paper Review] BP-Transformer: Modelling Long-Range Context via Binary Partitioning
BP-Transformer uses a binary-partitioned multi-scale graph attention mechanism to model long-range context with O(k · n log(n/k)) connections, achieving strong performance on long-text NLP tasks while improving efficiency.
The Transformer model is widely successful on many natural language processing tasks. However, the quadratic complexity of self-attention limit its application on long text. In this paper, adopting a fine-to-coarse attention mechanism on multi-scale spans via binary partitioning (BP), we propose BP-Transformer (BPT for short). BPT yields $O(k\cdot n\log (n/k))$ connections where $k$ is a hyperparameter to control the density of attention. BPT has a good balance between computation complexity and model capacity. A series of experiments on text classification, machine translation and language modeling shows BPT has a superior performance for long text than previous self-attention models. Our code, hyperparameters and CUDA kernels for sparse attention are available in PyTorch.
Motivation & Objective
- Motivate improving long-text modeling beyond quadratic self-attention cost.
- Introduce a hierarchical, fineto-coarse attention bias over multi-scale spans.
- Balance model capacity with reduced computational cost via sparse, structured connections.
- Represent input as a graph with token and span nodes updated by graph self-attention.
- Demonstrate effectiveness across sentence- and document-level NLP tasks.
Proposed method
- Partition input sequences into multi-scale spans using binary partitioning, forming a hierarchical graph.
- Construct two edge types: affiliated edges (span-to-contained tokens) and contextual edges (fineto-coarse right-context connections) with density controlled by k.
- Update node representations via Graph Self-Attention across the constructed graph layers.
- Generalize relative positional encoding to tree structures to capture position bias on the BP-tree.
- Incorporate relative tree-based positional representations into attention computations (shared across heads).
- Provide CUDA kernels for sparse attention and report training/inference efficiency improvements.
Experimental results
Research questions
- RQ1Can BP-Transformer efficiently model long-range dependencies with sparse, hierarchical connections?
- RQ2Does fineto-coarse attention via binary partitioning improve performance over vanilla Transformer and other sparse-attention models on long text?
- RQ3How does BP-Transformer perform on sentence- and document-level NLP tasks (classification, translation, language modeling) compared to strong baselines?
Key findings
- BP-Transformer achieves strong results across language modeling, translation, and text classification, surpassing baselines on long text.
- In text classification, BP-Transformer yields SST-5: 52.71% (0.32) and IMDB: 92.12% (0.11) with k=2/4; outperforms Transformer and Star Transformer on IMDB.
- Character-level language modeling with Enwiki8/Text8 shows state-of-the-art performance with 1.02/1.11 bits-per-character (context length up to 8192) using k=64.
- Document-level translation on IWSLT Zh-En improves BLEU to 19.84 with BP-T, compared to 18.91 (sentence-level Transformer) and 17.78 (HAN-NMT).
- Sentence-level WMT14 English-German with BP-T achieves BLEU up to 27.6 (k=4), matching or exceeding Transformer baselines with the same parameter count.
- BP-Transformer reduces GPU memory footprint and maintains steady throughput for long sequences, outperforming vanilla Transformer as sequence length grows.
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.