← Ziding Zhang

Matching a reader's context in the browser: embeddings fix false hits before they fix recall

Tested on twenty hand-written reader profiles across 71 pages, in-browser embeddings beat shared-word matching on top-three recall (16/16 vs 14/16), and cut false matches on unrelated visitors from 4/4 to 1/4.

November 18, 2026 · Research note · What is not yet established


For you ranks this site’s pages inside your browser against a short bio or an AI agent’s notes about you, so a portable user model can steer what you read without uploading anything to me. Until today, the Bring your own context page had only been tried on six examples chosen while building it.

I froze twenty reader descriptions before running either matcher across all 71 public pages: eight everyday descriptions that avoid my posts’ vocabulary, eight technical or multi-interest agent bios, and four unrelated visitors (a warehouse broker, a sourdough baker, a marine diesel mechanic, and a volleyball coach) for whom the honest answer is nothing.

Left panel compares shared words against all-MiniLM-L6-v2 embeddings: Positive Top-1 rises 12/16 to 14/16, Hit@3 rises 14/16 to 16/16, and unrelated false matches drop 4/4 to 1/4 at FLOOR = 0.22. Right panel plots embedding scores showing the volleyball coach at 0.2279 (robot hit 0.2231) separated by a clean gap from the lowest positive profile p02 at 0.3034.
Scrub the embedding cosine FLOOR (0.22 to 0.35) or switch to shared-word matching across the 20 frozen reader profiles.
StratumShared words (/compendium.json)Meaning (all-MiniLM-L6-v2, FLOOR = 0.22)
Everyday wording, Top-1 / Hit@3 (8)5 / 8 · 7 / 87 / 8 · 8 / 8
Technical & multi-interest, Top-1 / Hit@3 (8)7 / 8 · 7 / 87 / 8 · 8 / 8
All positive profiles, Top-1 / Hit@3 (16)12 / 16 · 14 / 1614 / 16 · 16 / 16
Unrelated profiles given false matches (4)4 / 41 / 4

The biggest gain was not recall—it was knowing when to stay quiet:

  1. Shared-word matching recommended pages to all four unrelated visitors. Because terms.mjs accepts any cosine score above zero, one stray word was enough: "bulk" sent the sourdough baker to a statistics note, "propeller" sent the boat mechanic to aircraft acoustics, and "schedule" sent the warehouse broker to the ideas queue.
  2. Embeddings rescued zero-overlap queries and silenced three of four unrelated profiles. Quantised all-MiniLM-L6-v2 found all 16 positive targets in the top three—including chatty group-chat bots (Tending a room of agents) and sycophancy vs. logical flaws (Argument or pressure), where word matching missed completely. Only the volleyball coach cleared the 0.22 floor (0.2231), while the weakest true-positive Top-1 scored 0.3034.
  3. Exact technical terms still beat a small general embedding on fine ties. For a portable-user-model HCI bio, shared words put Walkable Mind first on spatial, portable, json, and local, whereas embeddings placed the June robot essay 0.0004 ahead (0.4115 vs 0.4111).

A GitHub Action now refreshes /embeddings.json automatically whenever a post or idea changes. Scripts and per-profile outputs are in /research/bring-your-own-context/.

Agent context: sources, method and working notes

Method and leakage guard

  • Exact code under test: public/research/bring-your-own-context/score.mjs imports the live match() (src/lib/terms.mjs) and rank() (src/lib/meaning.mjs) functions and runs them against the built dist/compendium.json and dist/embeddings.json artifacts.
  • Self-reference guard: Because this note mentions the four negative test professions (warehouse, sourdough, diesel, volleyball), score.mjs strips /matching-reader-context-in-the-browser/ from both indexes before scoring so the benchmark write-up cannot leak into the corpus it evaluates.
  • Automatic vector refresh: .github/workflows/refresh-embeddings.yml runs node scripts/embed-pieces.mjs on pushes to main touching src/content/blog/** or src/content/ideas/** and commits src/data/embeddings.json when any piece hash is missing.

Selected failure and tie cases from summary.json

ProfileWord Top-1 (score, matched words)Meaning Top-1 (score)Why they differed
p03_balcony_flight_path/reference-recordings/ (0.1149, recording)/plane-sound-location/ (0.5567)Query said “jets” and “flying”, never “plane” or “aircraft”; word matcher latched onto “recording”.
p07_chatty_slack_bots/why-im-putting-hermes-into-a-robot-reachy-mini/ (0.0636, assistant)/ideas/bring-your-own-context/ (0.3787), #2 /tending-a-room-of-agents/ (0.3745)Word matcher missed top 3 completely; meaning put both user-memory pages at the top (0.0042 apart).
p13_sycophancy_vs_reason/tending-a-room-of-agents/ (0.0745, user)/pseudonym-now-proof-later/ (0.4862), #3 /ideas/argument-or-pressure/ (0.4288)Sentence-level max-pooling let the second sentence (“anonymous cryptographic authorship”) match cleanly while keeping argument-vs-pressure at #3.
n20_volleyball_recruiting/a-front-page-for-my-questions/ (0.0794, division)/why-im-putting-hermes-into-a-robot-reachy-mini/ (0.2231)Cleared FLOOR = 0.22 by 0.0031; raising FLOOR to 0.25 and adding a two-distinctive-term floor to terms.mjs are the obvious next fixes to test on a held-out set.
Changes
  • November 27, 2026: Added inline mechanism-lens cosine floor explorer and static benchmark figure.
  • November 18, 2026: First public version.

Have an answer, a counterexample, or a story? See Talk to me for open questions and live trials.

Credits: Ziding Zhang, with Gemini (Google DeepMind) for the 20-persona benchmark, CI vector refresh and write-up; builds on Claude Fable 5.2's For you implementation.