#5656th of 75 in ML frameworks and libraries

sentencepiece

Unsupervised BPE and unigram subword tokenizer trained from raw text

Stars
12.1k
License
Apache-2.0
Last commit
Oct 2026
Last release
Jul 2026
Language
C++
Stars, last 29 weeks+486
31 Mar 2026: 11,659 stars7 Apr 2026: 11,674 stars14 Apr 2026: 11,696 stars21 Apr 2026: 11,718 stars28 Apr 2026: 11,733 stars5 May 2026: 11,747 stars12 May 2026: 11,762 stars19 May 2026: 11,789 stars26 May 2026: 11,813 stars2 Jun 2026: 11,826 stars9 Jun 2026: 11,849 stars16 Jun 2026: 11,864 stars23 Jun 2026: 11,880 stars30 Jun 2026: 11,895 stars7 Jul 2026: 11,912 stars14 Jul 2026: 11,926 stars21 Jul 2026: 11,940 stars28 Jul 2026: 11,964 stars4 Aug 2026: 11,983 stars11 Aug 2026: 11,997 stars18 Aug 2026: 12,010 stars25 Aug 2026: 12,023 stars1 Sept 2026: 12,037 stars8 Sept 2026: 12,050 stars15 Sept 2026: 12,069 stars22 Sept 2026: 12,084 stars29 Sept 2026: 12,095 stars6 Oct 2026: 12,112 stars13 Oct 2026: 12,131 stars20 Oct 2026: 12,145 stars

11,659 on 31 Mar 202612,145 on 20 Oct 2026

From GitHub's daily star counts.

Checked on GitHub.

Overview

SentencePiece trains BPE or unigram language model tokenizers directly from raw sentences, treating whitespace as the symbol ▁ so detokenization is lossless and language-independent. The core is C++ with a Python module installed via pip. The repo also ships SentencePiece Lite, a zero-dependency C++20 runtime that memory-maps FlatBuffers model files.

Who it is for: Engineers building custom tokenizers for LLMs and translation models

Strengths

  • Lossless, reversible tokenization with no language-specific pre-tokenizer, incl. Chinese, Japanese, Thai
  • Supports subword regularization (unigram) and BPE-Dropout via enable_sampling, alpha and nbest_size
  • Single .model file holds normalization, vocabulary and segmentation; same results in C++ and Python
  • README benchmark: 27.41 MB/s single-thread on T5-base unigram vs 3.78 for Hugging Face Fast

Weaknesses

  • Tokenizer only; no model training or inference beyond tokenization
  • README states it is not an official Google product
  • Multi-thread scaling flattens because Python object conversion holds the GIL
  • Benchmarks are the project's own, on one dataset and one 24-core machine

What it needs

  • no GPU
  • Models: BPE, Unigram language model

Also in ML frameworks and libraries

See all 75
Also in ML frameworks and libraries
RankProjectScore
1transformersPython library defining open models for text, vision, audio and multimodal tasks167.9k starsApache-2.094 out of 100
2pytorchPython tensor library with GPU support and tape-based autograd for deep learning104.9k starscustom license94 out of 100
3ultralyticsPython library and CLI for training and running YOLO vision models62.7k starsAGPL-3.092 out of 100
#4pytorch-image-modelsPyTorch library of image models, pretrained weights and reference training scripts37.2k starsApache-2.091 out of 100
#5supervisionPython toolkit for loading, annotating and counting computer vision detections Live demo ↗ (opens in a new tab)51.3k starsMIT90 out of 100