Blog

SparseUp v2 loses almost nothing at a sixth of the index size and runs in a browser tab

Most semantic search runs on dense embeddings: a few hundred numbers per text, and a vector database to search them. Linkup's SparseUp v2 does the same job with words. It turns each query or document into a short list of weighted words that an ordinary keyword index can store and a person can read, and on a standard benchmark it ranks documents as well as any model of its size that Linkup compared. Two pieces of work make it cheaper to run. Its index shrinks to a sixth with almost no loss when each document keeps more words at coarser weights, and that loses less than cutting words, the option Linkup's Matryoshka training provides. And the whole model runs in a browser tab, with no server: try the demo.

SparseUp v2 describes text as weighted words you can index and read

SparseUp v2 reads a text with a ModernBERT encoder, scores every entry in its 50,370-word vocabulary, and keeps a few dozen to a few hundred. Many of the words it keeps are not in the text. In the demo, the query "why do cats purr" also lights up "kitty", "fur", "pet" and "biology". A query matches a document through the words they share, and the score is the sum of the products of their weights.

Weighted words go into an inverted index, the structure behind keyword engines such as Lucene, so a team that already runs keyword search has the machinery to serve them. They can sit beside BM25 keyword scores or a dense model's ranking in a hybrid, and every match can be explained by listing the shared words that produced it. The model reads documents of up to 8,192 tokens. On BEIR, a standard set of fifteen search datasets, Linkup reports it level with LateOn, a model that stores a vector for every token, built on the same encoder, and a point ahead of its dense sibling DenseOn. LateOn stays ahead on long documents.

More terms at two to four bits beat a Matryoshka cut of the same size

An index of weighted words grows with the number of words each document keeps. Linkup trained SparseUp v2 with Matryoshka levels, so a document's strongest 64, 128 or 256 words also work on their own, and the max_active_dims setting drops the rest. Tom Aarsen's thread on the release gives the cost on BEIR: 55.8 at 128 words per document, against 57.2 uncut. Those scores are nDCG@10, which rates the order of the top ten results out of 100.

Storing each weight in fewer bits shrinks an index too. A study run alongside the browser port stored each word as a 16-bit id plus its weight, and scored compressed documents against the uncut model on four of the BEIR datasets: SciFact, NFCorpus, FiQA and ArguAna.

Each document stored asBytesChange in nDCG@10, points
All words (about 280), 32-bit weights, uncut1,6720.0
64 words, 16-bit weights (Matryoshka cut)256−2.7
128 words, 2-bit weights287−0.2
128 words, 4-bit weights319+0.1
128 words, 16-bit weights (Matryoshka cut)5110.0
256 words, 3-bit weights565+0.4

At about 256 bytes, the document with 128 words and 2-bit weights loses almost nothing, while the 64-word cut loses more than ten times as much, a gap well outside the noise between queries. The weights compress this well because every one comes out of the same fixed formula at 16-bit precision, which yields fewer than 256 distinct values, so a small table of levels fitted to them loses little. A dropped word loses its match outright.

The averages hide spread between datasets: at 128 words and 2 bits, FiQA loses 2.2 points while ArguAna gains 3.1, so test the setting on your own documents. Four datasets are not all fifteen either, and on these four the 128-word cut costs nothing where Linkup's full benchmark shows a loss. Keeping more words also costs something at query time. An inverted index keeps a list of documents for each word, and those lists grow with the words per document, so 256 words mean more scoring work than 128, whatever the bits. The study did not build or time a search engine. For a team hosting a large index, 287 bytes a document puts a million documents in under 300 MB, against 1.7 GB uncompressed.

The whole model runs in a browser tab at about 9 ms per query

The compression study shrinks the index; the browser port moves the encoder onto the reader's device. The demo takes a query and a few documents, shows the weighted words each becomes with the expansions marked, and ranks the documents. It downloads 151 MB of 8-bit weights and runs the full model on WebGPU code written for it. On Oskar's Mac (Chrome, Apple's GPU) a query of up to 128 tokens takes about 9 ms and a 512-token document 34 ms.

The demo page. Query 'why do cats purr' ranks a document about cats purring first at 93.90, a dog document at 21.54, Python at 1.70 and the Eiffel Tower at 1.19. Below, the query's 24 strongest terms as bars: cats, cat, pur, Kitty, reasons, fur, pet, why, biology, purs and more, with terms not in the query drawn in orange.
The demo in headless Chromium on a software GPU, so its times read in seconds. Orange terms are expansions: "Kitty", "fur", "pet" and "biology" for a four-word query.

The browser output matches PyTorch running the same 8-bit weights on all 47 test texts. Rounding to 8 bits moves the vectors about as far as the model's own 16-bit default does, and SciFact retrieval does not change measurably. A 4-bit version saves 33 MB but drifts further and runs slightly slower.

An encoder in the tab lets search run without a server. A site can encode its documents ahead of time with the same model and ship the index as a static file; each visitor's browser then encodes the query and scores it locally, so the query never leaves the device and no API bill accrues. At 287 bytes a document, ten thousand documents make an index under 3 MB. That suits documentation, a personal archive or an offline app, where the 151 MB model downloads once and stays cached. The demo does not ship such an index yet, and the port was tested on texts of up to 512 tokens.

Three Claude Code on the web sessions did the work. The compression report and the browser report carry every number and interval.