NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Attention Is All You Need for Chinese Word Segmentation

Sufeng Duan, Hai Zhao

Abstract

Chinese Word Segmentation (CWS) has traditionally faced a trade-off between decoding speed and segmentation accuracy. Researchers from Shanghai Jiao Tong University introduce the Gaussian-masked Directional (GD) Transformer, a model that eliminates the need for complex recurrent networks and slow structural decoders like CRFs. By incorporating Gaussian-masked attention to enforce localness and a parallel directional pipeline, the model achieves state-of-the-art (SOTA) performance using a simple greedy decoder and unigram features, significantly outperforming traditional methods in inference speed.

Introduction

Chinese Word Segmentation is a fundamental NLP task involving the identification of word boundaries in continuous character sequences. Existing approaches often rely on computationally expensive structural decoders (e.g., Viterbi or Beam Search) to achieve high accuracy, or complex n-gram feature engineering to capture context. The authors argue that a sufficiently powerful encoder can represent character dependencies well enough to make greedy decoding both fast and highly accurate, effectively proving that "attention is all you need" for CWS.

Methodology

The core of the proposed system is the GD-Transformer, which adapts the standard Transformer architecture for the specific requirements of word segmentation.

GD-Transformer Architecture

The architecture consists of three parallel pipelines—Forward, Backward, and Central—to capture information flow from different directions relative to potential word boundaries. To facilitate training and improve representation learning, the authors introduce HiRED (Hidden Representations for Early Decoding), a virtual hidden layer that allows the model to practice decoding at an intermediate stage.

Overall architecture of the GD-Transformer featuring HiRED and Biaffine Attention Scorers.

Gaussian-masked Attention

While standard self-attention captures global dependencies, CWS is inherently a local problem where a character's immediate neighbors provide the most critical segmentation cues. The authors implement Gaussian-masked Attention, which applies a Gaussian weight to the attention matrix. This forces the model to prioritize local context, effectively "soft-limiting" the attention span to the most relevant nearby characters.

Detailed view of the Gaussian-masked Directional Multi-Head Attention mechanism.

Biaffine Attention Scorer

Instead of a standard classification layer, the model employs a Biaffine Attention Scorer. This component predicts the probability of a boundary between two characters by modeling the interaction between the "front" representation of one potential word and the "rear" representation of another.

Experiments and Results

The model was evaluated on the SIGHAN Bakeoff 2005 benchmark datasets (PKU, MSR, AS, and CITYU) under the strict "closed test" setting.

Performance and Speed

The GD-Transformer achieved new SOTA F1-scores on several datasets, notably 97.6% on MSR and 95.7% on AS. Crucially, the move to a greedy decoder resulted in massive speed improvements. On the PKU dataset, the model completed testing in just 4 seconds, significantly faster than the 25–105 seconds required by other modern neural baselines.

Key Insights

  • Localness as an Inductive Bias: Ablation studies showed that removing the Gaussian mask led to a significant drop in F1 score (0.8 on PKU), confirming that local context is vital for CWS.
  • Encoder Complexity vs. Decoder Simplicity: By shifting complexity into the encoder, the model can make high-quality "greedy" decisions without the need for global optimization during inference.
  • Unigram Sufficiency: The results demonstrate that a deep attention-based encoder can extract sufficient context from single characters, removing the need for manual n-gram feature engineering.

Conclusion

The GD-Transformer demonstrates that the Transformer architecture, when modified with appropriate inductive biases like Gaussian masking and directional pipelines, can outperform complex sequence labeling models in both speed and accuracy for CWS. Future work may explore applying this architecture to other local-context-dependent tasks such as Part-of-Speech tagging and Named Entity Recognition.

Summary updated

BibTeX
@inproceedings{duan2020attention,
  author = {Sufeng Duan and Hai Zhao},
  title = {{Attention Is All You Need for Chinese Word Segmentation}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2020},
  doi = {10.18653/v1/2020.emnlp-main.317},
}
Figure