pypi / sentencepiece
sentencepiece
What changed in sentencepiece 0.2, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-27.
3 breaking2 security6 new APIs and options3 performance1 behavior and defaults1 tooling3 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initsentencepiece 0.219 changes
Breaking changes 3
BOS/EOS adding now follows C++ constraints and raises ValueError instead of silently failing or crashing.
Vocabulary pieces containing null characters are explicitly disallowed.
Support and distribution of 32-bit Windows wheels stopped.
Security 2
Replaced internal CHECK macros with DCHECK or returned errors to prevent host application crashes on invalid inputs.
Model loading verifies darts-clone trie offsets to prevent segfaults on corrupted or malicious model files.
New APIs and options 6
Processors and normalizers can now be loaded directly from in-memory Proto instances.
C++ now supports loading a normalizer from raw maps.
Added direct encoding and decoding to and from NumPy objects.
Added offset mapping for Unicode character offsets and raw byte offsets.
Introduced parallel_encode to tokenize single large documents across multiple CPU cores.
Introduced ThreadPool for parallel Python tokenization of single large documents.
Performance 3
Ported an O(log n) lazy priority queue update optimization to the BPE trainer to speed up training.
Integer/string input encoding and decoding skip SentencePieceText conversion, resulting in about a 2x speedup.
C++ execution releases the GIL to improve multi-threaded Python performance.
Behavior and default changes 1
Improved unigram pruning using token-normalized frequency calculations.
Tooling 1
Added inline type stubs and a PEP 561 marker for IDE auto-completion and static type safety.
Fixes and other changes 3
Validated value offsets in DecompileCharsMap.
Implemented a global timeout to prevent NBest A* search from hanging on pathological inputs.
Added bounds checks to piece accessors.