﻿# SentencePiece Lite: tiny mapping overhead does not mean a tiny total tokenizer footprint

SentencePiece Lite maps converted FlatBuffers models and reduces heap construction. Its benchmark, token-cache allocation and compatibility boundaries need separate records.

Author: Retrivium editorial team
Updated: 2026-11-05
Canonical URL: https://retrivium.ai/journal/sentencepiece-lite-mapped-model-heap-token-cache-compatibility-boundary/
Language: en

## A stable release now documents the runtime

The incoming note cited a prerelease that was not available at its direct tag during review. The public [SentencePiece release record](https://github.com/google/sentencepiece/releases/tag/v0.2.3) instead confirms stable version 0.2.3 on 5 November 2026. Its release notes introduce a compact C++20 Lite runtime operating on converted FlatBuffers models, without runtime dependencies on Protobuf or Abseil.

The [Lite documentation](https://google.github.io/sentencepiece/lite/) explains the memory-mapped model layout and separate conversion step. Vocabulary entries, scores and lookup structures are read from a .spm.fb artifact. This avoids constructing the original runtime’s full heap representation, but it does not make the model’s bytes disappear from storage or the operating system’s memory accounting.

## The small number measures an overhead boundary

The documentation reports 1.2 KB of heap overhead for the preconverted mapping path. For Gemma 3, the converted model is 10.3 MB, while the original runtime’s compared heap figure is 43.4 MB. These describe different memory components, not contradictory measurements.

A mapped file can have resident pages, and encoding still needs input, output and algorithm workspace. Accordingly, the headline overhead is not a reported whole-process resident-memory maximum. On-the-fly conversion has a different allocation boundary: the converted blob is held in memory. An application comparing that mode with a preconverted mapping must include conversion and buffer lifetime explicitly.

## Caching is another configuration

On the documented English corpus, ordinary Lite reaches 41.70 MB per second for Gemma 3, while the cached path reaches 52.99. These are project-reported single-core throughput results, not a measured request-latency distribution for an inference server. The public table does not name the CPU model or report tail percentiles.

The optional token cache has its own memory cost: the example uses a default 1 MB cache per worker thread. A service enabling this path cannot describe its complete tokenizer memory as only the mapping overhead. Repeated-text frequency also affects the value of caching. Keeping cached and uncached measurements separate is necessary for an interpretable result.

## Preserve model conversion and lifetime

The [public runtime interface](https://raw.githubusercontent.com/google/sentencepiece/master/lite/sentencepiece_lite.h) describes read-only processing of a backing model buffer. The documented mapping must outlive the processor using it. Changing ownership or deleting backing storage is a different problem from counting model parameters or vocabulary entries.

The converted artifact also has an endianness constraint, unlike the canonical model format described by the documentation. A supported deployment therefore preserves the source model, conversion revision, target platform and converted artifact identity. The [SentencePiece normalization guide](/journal/data-guide-sentencepiece-normalizer-model-artifact/) explains why retaining vocabulary strings alone does not preserve the complete normalization contract.

## Test identifiers before treating speed as equivalent work

The throughput tables compare different tokenizer models and engines, and some token totals differ. Equal byte throughput or similar token counts do not prove identical token identifiers for every input. A useful migration check compares normalized text, token identifiers, special-token handling and decoding on reviewed multilingual and whitespace-sensitive fixtures.

That is a proposed validation process, not a claim that this article executed the converter or reproduced the benchmark. The [tokenizer artifact guide](/journal/tokenizer-artifact-release-manifest/) provides the record structure. Lite offers a documented way to reduce model-construction overhead; total memory, cache policy and compatibility remain separate deployment questions.
