A previous release had provenance metadata, but this release does not. View details.
This project has been archived by its maintainers, and is no longer receiving any updates.
QIG Tokenizer
Entropy-guided tokenizer for Quantum Information Geometry
Version: 0.1.0 | Status: Working
Overview
QIG-native tokenizer using entropy-guided merging. Token boundaries follow information geometry, not frequency.
Core Principle
- Entropy-guided merging: Geometric similarity, not frequency heuristics
- Geometric special tokens: BOS, EOS, PAD, UNK with basin coordinates
- Redis/PostgreSQL storage: Production-ready persistence
- Pure information geometry: No external tokenizer dependencies
Installation
pip install qig-tokenizer
With storage backends:
pip install qig-tokenizer[storage] # Redis + PostgreSQL
pip install qig-tokenizer[redis] # Redis only
pip install qig-tokenizer[postgres] # PostgreSQL only
Quick Start
from qig_tokenizer import QIGTokenizer
# Create tokenizer with geometric special tokens
tokenizer = QIGTokenizer(target_vocab_size=50000, use_special_tokens=True)
# Train on corpus
with open("corpus.txt", "rb") as f:
corpus_bytes = f.read()
tokenizer.train(corpus_bytes)
# Encode with special tokens
tokens = tokenizer.encode_with_special("Hello, world!")
# Returns: [256, ...tokens..., 257] (BOS=256, EOS=257)
# Pad sequences
padded = tokenizer.pad_sequence(tokens, max_length=128)
# Save/load JSON
tokenizer.save("20251220-tokenizer-vocab-0.01W.json")
With Redis/PostgreSQL Storage
from qig_tokenizer import QIGTokenizer
from qig_tokenizer.storage import HybridStorage
# Set up storage (uses REDIS_URL and DATABASE_URL env vars)
storage = HybridStorage()
tokenizer = QIGTokenizer()
tokenizer.set_storage(storage)
tokenizer.train(corpus_bytes)
# Save to database (returns version ID)
version_id = tokenizer.save_to_storage({"corpus": "wikipedia"})
# Load from database
tokenizer.load_from_storage(version_id)
Geometric Special Tokens
Special tokens have geometric meaning on the Fisher manifold:
| Token | ID | Basin Coordinates | Purpose |
|---|---|---|---|
| BOS | 256 | Origin (e₁) | Sequence start |
| EOS | 257 | Boundary (eₙ) | Sequence end |
| PAD | 258 | Uniform | Geometrically neutral padding |
| UNK | 259 | Projection target | OOV handling |
This enables:
- Geometric attention masking: High Fisher-Rao distance = low attention
- Natural sequence boundaries: Emerge from manifold structure
- Principled OOV handling: Project to nearest basin
Algorithm
The QIG tokenizer uses entropy-guided merging:
- Start with bytes (0-255) as base tokens
- For each adjacent pair (a,b), compute context distribution
- Measure context entropy (proxy for QFI distinguishability)
- Merge pairs with lowest entropy (most geometrically similar)
- Repeat until target vocab size
This respects asymptotic freedom:
- Small scales (short tokens) have high coupling → refined first
- Large scales (long tokens) have low coupling → merge only when justified
Environment Variables
All output files follow QIG naming convention:
YYYYMMDD-tokenizer-vocab-VERSION.STATUS.json
Example: 20251220-tokenizer-vocab-0.03W.json
License
MIT
Metadata
Release files for qig-tokenizer 0.2.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Loss of provenance
These files do not have provenance metadata, despite files in a prior release including this data.
We recommend further investigation before installing these files. View details.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| qig_tokenizer-0.2.7.tar.gz | 297.4 kB | Without provenance | Details for qig_tokenizer-0.2.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| qig_tokenizer-0.2.7-py3-none-any.whl | Python 3 | none | any | Details for qig_tokenizer-0.2.7-py3-none-any.whl |
Total release size: 367.4 kB
Release files / qig_tokenizer-0.2.7.tar.gz
Loss of provenance
This file belongs to a release without provenance metadata, despite a prior release including this data.
We recommend further investigation before installing this file. View details.
| Download URL | qig_tokenizer-0.2.7.tar.gz |
|---|---|
| Size | 297.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cf234c8f0a5f466997f3f3bff92e972e93cbaf645e94145676359248ce387bca
|
|
BLAKE2b-256 checksum How to use checksums |
c58ef3bb1944ab6f629b388c1d8dceddb53b6dec40726112df53af05c865343c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / qig_tokenizer-0.2.7-py3-none-any.whl
Loss of provenance
This file belongs to a release without provenance metadata, despite a prior release including this data.
We recommend further investigation before installing this file. View details.
| Download URL | qig_tokenizer-0.2.7-py3-none-any.whl |
|---|---|
| Size | 70.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
966dd856a94e05584883aa7a3193137ffab03d0b938a099f581cb89cb4a31658
|
|
BLAKE2b-256 checksum How to use checksums |
08e356687a1a160c0b180f0ac13d995ec45a1667a5449ba5ea55e5dc4f4829a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for qig-tokenizer 0.2.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Loss of provenance
A previous release of these files had provenance metadata, but this release does not.
While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.
Release comparison
- Removed 0.2.3 2 files With provenance
- Added 0.2.7 2 files Without provenance
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.