Segment First or Comprehend First? Explore the Limit of Unsupervised Word Segmentation with Large Language Models

Zihong Zhang, Liqi He, Zuchao Li, Lefei Zhang, Hai Zhao, Bo Du

Introduction

In many Asian languages, such as Chinese, Japanese, and Thai, text is written as a continuous stream of characters without explicit word delimiters. Traditionally, Natural Language Processing (NLP) pipelines for these languages begin with Word Segmentation (WS). This "segment first, comprehend later" approach assumes that a sentence must be broken into discrete units before its meaning can be extracted. However, this creates a fundamental "chicken-and-egg" problem: many linguistic structures are ambiguous and can only be correctly segmented if the context is already understood.

While supervised models trained on human-annotated data have long been the standard, they are limited by domain specificity and the high cost of manual labeling. This paper investigates a paradigm shift: leveraging the vast contextual knowledge of Large Language Models (LLMs) to perform unsupervised word segmentation. By flipping the script—comprehending the context first to inform segmentation—the authors introduce LLACA (Large Language Model-Inspired Aho-Corasick Automaton), a framework that combines the deep understanding of LLMs with the computational efficiency of classical algorithms.

The LLACA Framework

The researchers explore two primary methodologies for LLM-based segmentation. The first, LLM-WS, involves direct prompting, where an LLM is asked to insert spaces into raw text. While highly accurate, this method is computationally prohibitive for large-scale applications.

To address this, the authors propose LLACA, a hybrid approach that "distills" the LLM's knowledge into a high-speed automaton. The process follows four key stages:

  1. Sampling and Prompting: A representative subset of the target corpus is processed by an LLM to generate initial segmentations.
  2. Statistical Filtering: To mitigate potential LLM "hallucinations," the candidate words are filtered using Pointwise Mutual Information (PMI). This ensures that the identified segments are statistically coherent and likely to be genuine lexical units.
  3. Automaton Construction: The filtered vocabulary is used to build an Aho-Corasick (AC) automaton, a data structure optimized for rapid pattern matching across large volumes of text.
  4. Dynamic N-gram Decoding: LLACA utilizes the LLM’s insights to inform a dynamic n-gram model. It then employs Viterbi decoding to identify the most probable segmentation path through a sentence, balancing the LLM's semantic guidance with statistical probability.

Experimental Evaluation

The study evaluates performance across four languages using several benchmark datasets:

  • Chinese: MSR, PKU, AS, and CITYU (from the SIGHAN Bakeoff).
  • Japanese: KWDLC and UD_JA.
  • Korean: UD_KO.
  • Thai: BEST and UD_TH.

The experiments utilized the Qwen1.5 model series (ranging from 0.5B to 110B parameters) and GPT-4 as a high-end baseline for comparison.

Key Insights

The Scaling Law of Segmentation

The research identifies a clear scaling law: as the parameter count of the LLM increases, so does its segmentation accuracy. Smaller models (under 7B parameters) often struggle with prompt adherence or character-level hallucinations. In contrast, models with 7B or more parameters demonstrate a sophisticated grasp of word boundaries and contextual nuances.

Comprehension vs. Hallucination

A fascinating observation occurred when the Chinese-centric Qwen model processed Traditional Chinese text. The model occasionally outputted Simplified Chinese characters. While technically a "hallucination" in the context of a segmentation task, this behavior provides evidence of deep comprehension; the model was translating and understanding the text's meaning rather than merely performing mechanical character splitting.

Efficiency and Speed

The primary advantage of LLACA is its efficiency. Direct inference with a 14B parameter LLM on the MSR dataset required approximately 3.65 hours. By contrast, the LLACA framework—using the same model's insights to build an automaton—completed the task in just 2.01 seconds. This represents a massive speedup, making LLM-driven segmentation viable for production environments.

Conclusion and Future Work

LLACA consistently outperformed existing unsupervised baselines (such as nVBE and NPY-3) across multiple languages, proving that a "comprehend first" approach is both effective and language-agnostic. However, the authors note that performance remains tied to the LLM's pre-training data; for instance, Qwen excelled in Chinese but was outperformed by GPT-4 in Thai and Japanese.

Furthermore, the study highlights the inherent subjectivity of word segmentation. Future research should focus on developing evaluation metrics that measure how segmentation improves downstream tasks, such as machine translation or sentiment analysis, rather than relying solely on static "gold standard" datasets that may not reflect modern linguistic usage.

Summary updated

BibTeX
@inproceedings{zhang2025segment,
  author = {Zihong Zhang and Liqi He and Zuchao Li and Lefei Zhang and Hai Zhao and Bo Du},
  title = {{Segment First or Comprehend First? Explore the Limit of Unsupervised Word Segmentation with Large Language Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure