@jigyasudham/veto-model
v1.0.1
Published
Static embedding table for Veto's semantic transcript search — potion-base-8M (Minish Lab, MIT) repacked to int8.
Maintainers
Readme
@jigyasudham/veto-model
Static embedding table for Veto's semantic transcript search. It is data, not code — a quantized matrix, a tokenizer, and a header describing how to use them.
Provenance
This package repacks the weights of potion-base-8M
(https://huggingface.co/minishlab/potion-base-8M) by Minish Lab (MIT),
distilled from baai/bge-base-en-v1.5, converted to int8. Inference code is
original to Veto.
The upstream revision is pinned by full commit hash —
bf8b056651a2c21b8d2565580b8569da283cab23 — and recorded in model/model.json
along with a sha256 for every shipped file. Upstream's license travels with the
weights in LICENSE.potion-base-8M.
No upstream trademark is used in this package's name. "potion" and "model2vec" appear only as attribution.
Why this exists
Veto's semantic search runs locally and offline: no API key, no per-query cost, no text leaving the machine. That is what it buys: 7.0 MB over the wire, 8.5 MB unpacked on disk. Shipping the table as a pinned npm dependency (rather than downloading it at runtime) means npm's immutability guarantees the bytes can never change under a published version, and npm's content-addressed cache moves them across the network once per machine.
Contents
| File | Bytes | What it is |
|---|---|---|
| model/embeddings.int8.bin | 7,559,168 | Row-major int8 matrix, 29,528 × 256 |
| model/scales.f32.bin | 118,112 | One LE float32 scale per row |
| model/tokenizer.json | 683,666 | Verbatim from the pinned revision |
| model/model.json | ~1.6 K | Dims, revision, contract, sha256s |
| model/golden.json | ~86 K | Fixed sentences + expected vectors |
Usage
The entry point resolves paths and reads nothing:
import { paths } from '@jigyasudham/veto-model';
// paths.embeddings, paths.scales, paths.tokenizer, paths.header, paths.goldenI/O is the caller's choice deliberately. Veto resolves this package lazily at the first semantic query and never at server boot, so a corrupted copy degrades search to BM25 instead of taking the process down.
The inference contract
model/model.json records what a consumer must do, because getting any of it
wrong produces plausible-looking but wrong vectors:
- Dequantize per row:
row_f32 = int8_row * scale[row]. - Tokenize with
add_special_tokens: false. WordPiece,BertNormalizer,BertPreTokenizer. strip_accentsisnull, which does not mean "off" — it followslowercase, which istrue. Accents are stripped:caféandcafeboth tokenize to id 6674. A consumer that reads the null literally will diverge silently on accented text.- Mean-pool the gathered rows, then L2-normalize with epsilon
1e-32. - Empty input (no tokens) yields a zero vector of length
dim. - No per-token weights.
model2vecsupports an optional per-token weight vector applied before pooling; potion-base-8M does not ship one, and the repack asserts this. A different model might, and mean-pooling it without the weights would be wrong.
model/golden.json pins all of the above: each entry carries the input text,
its token ids, and the vector a correct implementation produces from the
shipped int8 payload. It also records that payload's cosine drift against the
original float32 weights (max 6.13e-05), so quantization error stays separable
from implementation error.
Rebuilding
The repack pipeline is tracked in the Veto repository at
scripts/repack-model.py. It downloads the pinned revision, asserts the
inference assumptions above still hold, quantizes, and regenerates the payload
and golden vectors.
License
This package: MIT, see LICENSE.
Upstream weights and tokenizer: MIT, see LICENSE.potion-base-8M.
