This is the 131,072 token variant of the KL3M (Kelvin Legal Large Language Model) multi-word tokenizer family v2, optimized for legal domain text with hierarchical vocabulary nesting.
Overview
The KL3M multi-word tokenizers v2 are an improved family of byte-pair encoding (BPE) tokenizers trained on ~44GB of legal domain text from the KL3M dataset (copyright-clean legal corpus from the ALEA Institute). These tokenizers:
Capture multi-word phrases as single tokens (e.g., "United States", "set forth", "accordance with")
Encode complex legal terms efficiently (e.g., "Licensee", "hereinafter", "indemnification" as single tokens)
Use hierarchical vocabulary nesting where smaller vocabularies are proper subsets of larger ones
Outperform GPT-4 on legal text with 7.5% better compression on legal documents
Enable vocabulary expansion experiments and transfer learning across vocabulary sizes
What's New in v2
Cleaner special token design: 7 special tokens (removed experimental symbols)
Improved legal domain optimization: Better encoding of common legal terminology
Superior compression: 5.32 chars/token on legal text (vs 4.92 for GPT-4)
Smaller file sizes: More efficient tokenizer representation
Multi-Word Tokenization Examples
What is multi-word tokenization? Unlike standard tokenizers that split text into subword pieces, these tokenizers capture multiple words as single tokens. This is especially powerful for legal text with common multi-word phrases.
Example: "The United States Department of Transportation is responsible for"
[The][ Sup][reme][ Court][ of the][ United][ States][ held][ that]
128K vocabulary (7 tokens) - "United States" is ONE token!
[The][ Supreme][ Court][ of the][ United States][ held][ that]
Why This Matters
Shorter sequences = faster inference and training
Semantic coherence = "United States" as one unit, not two separate words
Better legal understanding = common legal phrases encoded atomically
Efficient compression = 7.5% fewer tokens than GPT-4 on legal text
Performance Comparison
On a realistic 3,743-character legal document (Software License Agreement):
Tokenizer
Vocab Size
Tokens
Chars/Token
vs GPT-4
KL3M v2-128K
131,072
704
5.32
-7.5%
GPT-4o/5
200,019
757
4.94
+0.5%
GPT-4
100,277
761
4.92
baseline
GPT-2
50,257
858
4.36
+12.7%
KL3M v2-64K
65,536
802
4.67
+5.4%
KL3M v2-32K
32,768
943
3.97
+23.9%
Legal Terminology Efficiency
Common legal terms as single tokens (128K vocab):
Term
KL3M v2-128K
GPT-4
GPT-4o/5
"Licensee"
1 token
2 tokens
2 tokens
"hereinafter"
1 token
3 tokens
3 tokens
"indemnification"
1 token
4 tokens
3 tokens
"arbitration"
1 token
3 tokens
3 tokens
"WHEREAS"
1 token
2 tokens
2 tokens
"non-exclusive"
1 token
2 tokens
2 tokens
Tokenizer Family
This tokenizer is part of a hierarchically nested family. Token IDs in smaller vocabularies are identical across all larger vocabularies, enabling seamless vocabulary expansion:
Legal text contains frequent multi-word phrases that benefit from being treated as single tokens. The larger vocabularies capture increasingly sophisticated legal terminology:
4K vocabulary examples:
Common legal particles: "herein", "thereof", "pursuant"