Field notes · Expedition 02 · in-browser embeddings

Semantic Shelf

Describe what you feel like reading (a mood, a question, a half-remembered subject) and an open embedding model finds the closest matches across all the books on the reading lists. The unusual part is where it runs: the model executes inside your browser via transformers.js, so nothing you type is sent anywhere. There is no search server to be slow, cost money, or read your queries.

Loading the shelf’s precomputed vectors…

How it works

The books were embedded ahead of time: a small runner script (scripts/huggingface/embed-reading.mjs) feeds every book’s title, author, subject, and blurb through Xenova/all-MiniLM-L6-v2 and commits the resulting vectors to the repo as a 374 KB artifact that ships with this page. That model is the same little workhorse the field notes found at the very top of the Hub’s all-time download charts: a 23-million-parameter sentence encoder that quantizes down to about 23 MB.

Your query takes the same trip at search time, just locally: the encoder runs on WebAssembly in your tab, turns the text into a 384-dimensional vector, and a plain dot product ranks it against the precomputed shelf. Both halves share one module (src/lib/semantic-shelf/model.mjs) so the corpus and the query can never be embedded with different recipes.

This is the same posture as the voice-fit meter: computation shipped to the client as a privacy feature. It is also expedition 02 of the Hugging Face field notes, and the reason the transformers.js note there is now marked mapped instead of scouted.

Related, no dead ends
The field notes (expedition 01)The reading listsVoice-fit meterThe Lab

Model: Xenova/all-MiniLM-L6-v2 (Apache-2.0), downloaded from the Hugging Face Hub on your first search session and cached by your browser. Corpus vectors are precomputed and versioned in the repo; a drift-guard test fails CI if the reading catalog changes without a re-embed. Similarity scores are honest cosine values, not percentages; on this shelf anything above roughly 0.4 is a strong match.