Powered by OpenAIRE graph
Found an issue? Give us feedback
image/svg+xml art designer at PLoS, modified by Wikipedia users Nina, Beao, JakobVoss, and AnonMoos Open Access logo, converted into svg, designed by PLoS. This version with transparent background. http://commons.wikimedia.org/wiki/File:Open_Access_logo_PLoS_white.svg art designer at PLoS, modified by Wikipedia users Nina, Beao, JakobVoss, and AnonMoos http://www.plos.org/ ZENODOarrow_drop_down
image/svg+xml art designer at PLoS, modified by Wikipedia users Nina, Beao, JakobVoss, and AnonMoos Open Access logo, converted into svg, designed by PLoS. This version with transparent background. http://commons.wikimedia.org/wiki/File:Open_Access_logo_PLoS_white.svg art designer at PLoS, modified by Wikipedia users Nina, Beao, JakobVoss, and AnonMoos http://www.plos.org/
ZENODO
Preprint . 2026
Data sources: ZENODO
ZENODO
Preprint . 2026
Data sources: Datacite
ZENODO
Preprint . 2026
Data sources: Datacite
versions View all 2 versions
addClaim

Structure-Aware Tokenization for JSON

Exploiting Schema Repetition for Compact Token Sequences with a 90× Smaller Vocabular
Authors: Maio, Anthony;

Structure-Aware Tokenization for JSON

Abstract

We present json-tokenizer, a structure-aware tokenizer that assigns dedicated single tokens to JSON grammar elements, learns a compact key vocabulary from training data, and applies byte-pair encoding (BPE) only to value content. General-purpose subword tokenizers such as cl100k_base treat JSON as flat text, splitting structural syntax characters across multiple tokens and re-encoding identical key names in every object. On schema-repetitive JSON workloads -- including GeoJSON features, observability telemetry, and Kubernetes manifests -- json-tokenizer achieves 5-15% token savings over cl100k_base while using a vocabulary approximately 90x smaller (1,100–4,100 tokens vs. 100,256). Batch encoding of JSON arrays yields savings up to 9.3%. All encodings are lossless: decoded output is byte-identical to the original JSON across 4,200+ test objects. Results are stable across five random seeds (standard deviation <0.01%). We provide an open-source, zero-dependency Python implementation with HuggingFace PreTrainedTokenizer compatibility, benchmarks on five real-world dataset classes, throughput measurements, a vocabulary size sweep analysis, and an honest comparison showing where general-purpose tokenizers remain superior (prose- heavy JSON). The tokenizer is designed for LLM structured output pipelines, API response caching, and observability log ingestion, where schema repetition dominates and token budgets directly impact cost and latency.

Keywords

LLM inference efficiency, JSON, Hugging Face, byte-pair encoding, transformers, structured data, tokenization

  • BIP!
    Impact byBIP!
    selected citations
    These citations are derived from selected sources.
    This is an alternative to the "Influence" indicator, which also reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically).
    0
    popularity
    This indicator reflects the "current" impact/attention (the "hype") of an article in the research community at large, based on the underlying citation network.
    Average
    influence
    This indicator reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically).
    Average
    impulse
    This indicator reflects the initial momentum of an article directly after its publication, based on the underlying citation network.
    Average
Powered by OpenAIRE graph
Found an issue? Give us feedback
selected citations
These citations are derived from selected sources.
This is an alternative to the "Influence" indicator, which also reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically).
BIP!Citations provided by BIP!
popularity
This indicator reflects the "current" impact/attention (the "hype") of an article in the research community at large, based on the underlying citation network.
BIP!Popularity provided by BIP!
influence
This indicator reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically).
BIP!Influence provided by BIP!
impulse
This indicator reflects the initial momentum of an article directly after its publication, based on the underlying citation network.
BIP!Impulse provided by BIP!
0
Average
Average
Average
Green