让分词懂语义,长文本处理更快更省
SemToken: Semantic-Aware Tokenization for Efficient Long-Context Language Modeling
- 基于语义聚类合并相似词元,减少冗余
- 在内容丰富处细分、重复处粗略,提升效率2.4倍
- 可无缝接入现有模型,适合长文本任务
分词在语言建模中至关重要,但现有方法如字节对编码(BPE)或WordPiece仅依赖频率统计,忽视文本的语义结构,导致长文本中语义冗余部分过度分词,上下文连贯性未被充分利用。本文提出SemToken,一种语义感知的分词框架,通过轻量级编码器提取上下文语义嵌入,进行局部语义聚类以合并语义等价的词元,并根据语义密度动态分配不同粒度:内容丰富的区域细分,重复或低熵区域粗略压缩。该方法可无缝集成至现代语言模型及注意力加速技术。在WikiText-103和LongBench等长文本建模基准上,SemToken实现最高2.4倍的词元数量减少与1.9倍的速度提升,困惑度与下游准确率几乎无损失。结果表明,语义结构为优化大模型分词与计算提供了新方向。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。