SemToken: Semantic-Aware Tokenization for Efficient Long-Context Language Modeling

Dong Liu, Yanxuan Yu
8/21/2025
cs.CLcs.AI

No official code found. Best implementation: FastLM/SemToken (5 stars, last commit 2025-09-21).

Abstract

Tokenization plays a critical role in language modeling, yet existing approaches such as Byte-Pair Encoding (BPE) or WordPiece operate purely on frequency statistics, ignoring the underlying semantic structure of text. This leads to over-tokenization of semantically redundant spans and underutilization of contextual coherence, particularly in long-context scenarios. In this work, we propose \textbf{SemToken}, a semantic-aware tokenization framework that jointly reduces token redundancy and improves computation efficiency. SemToken first extracts contextual semantic embeddings via lightweight encoders and performs local semantic clustering to merge semantically equivalent tokens. Then, it allocates heterogeneous token granularity based on semantic density, allowing finer-grained tokenization in content-rich regions and coarser compression in repetitive or low-entropy spans. SemToken can be seamlessly integrated with modern language models and attention acceleration methods. Experiments on long-context language modeling benchmarks such as WikiText-103 and LongBench show that SemToken achieves up to $2.4\times$ reduction in token count and $1.9\times$ speedup, with negligible or no degradation in perplexity and downstream accuracy. Our findings suggest that semantic structure offers a promising new axis for optimizing tokenization and computation in large language models.

View on arXivView PDF

Code Implementations(1)

FastLM/SemTokenCommunity67%

[IWCS 2025 Oral] SemToken: Semantic-Aware Tokenization for Efficient Long-Context Language Modeling

50PythonSep 21, 20251 years ago

Similar Papers

Cite this paper

@article{liu2025semtoken,
  title  = {SemToken: Semantic-Aware Tokenization for Efficient Long-Context Language Modeling},
  author = {Dong Liu and Yanxuan Yu},
  year   = {2025},
  eprint = {2508.15190},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2508.15190v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2508.15190.svg)](https://codeofpaper.com/paper/2508.15190)

Discussion