arXiv:2503.17247cs.CLcs.AI2025-03被引 6

专为法律金融文本设计的高效分词器,减少token数量并保持术语准确

KL3M Tokenizers: A Family of Domain-Specific and Character-Level Tokenizers for Legal, Financial, and Preprocessing Applications

  • 针对法律金融领域定制BPE分词器,提升术语压缩效率
  • 对法律术语可少用83% token,金融术语少用39%,且词表更小
  • 支持OCR纠错任务,保持错误与正确文本分词边界一致

我们提出KL3M分词器家族,专为法律、金融和政府文本设计。现有分词研究多集中通用领域,专业场景仍待深入。本文贡献有二:其一,构建法律、金融及政府文本专用的BPE分词器。kl3m-004-128k-cased分词器在领域文档上比GPT-4o和Llama3少用9-17%的token,尽管词表更小;对专业术语,该分词器在法律术语上最多节省83%的token,在金融术语上节省39%。其二,开发字符级BPE分词器(4K、8K、16K词表),用于如OCR后处理等文本修正任务,确保错误文本与正确文本间分词边界一致,便于模型学习纠正模式。这些分词器通过减少上下文占用、降低计算开销、保留术语语义,显著提升长篇法律与金融文档处理效率。所有分词器及代码已开源至GitHub与Hugging Face,推动专业化分词研究。

原文摘要 · Abstract (English)

We present the KL3M tokenizers, a family of specialized tokenizers for legal, financial, and governmental text. Despite established work on tokenization, specialized tokenizers for professional domains remain understudied. Our paper offers two main contributions to this area. First, we introduce domain-specific BPE tokenizers for legal, financial, and governmental text. Our kl3m-004-128k-cased tokenizer uses 9-17% fewer tokens than GPT-4o and Llama3 for domain-specific documents, despite having a smaller vocabulary. For specialized terminology, our cased tokenizer is even more efficient, using up to 83% fewer tokens for legal terms and 39% fewer tokens for financial terms. Second, we develop character-level BPE tokenizers (4K, 8K, and 16K vocabulary sizes) for text correction tasks like OCR post-processing. These tokenizers keep consistent token boundaries between error-containing and correct text, making it easier for models to learn correction patterns. These tokenizers help professional applications by fitting more text in context windows, reducing computational needs, and preserving the meaning of domain-specific terms. Our analysis shows these efficiency gains directly benefit the processing of long legal and financial documents. We release all tokenizers and code through GitHub and Hugging Face to support further research in specialized tokenization.

分词器法律文本金融文本OCR纠错

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。