How Vector Embeddings Work in Your Browser
A vector embedding is a compact numeric representation of text. Instead of storing only the words in a sentence, an embedding model maps the sentence into a point in a high-dimensional space. Text with related meaning tends to land nearby, which makes semantic search possible.
In a browser-history tool, the pipeline has four useful stages: capture readable text, prepare it for the model, generate embeddings, and rank stored pages against an embedded query.
1. Capture readable page text
The process begins with text, not vectors. TraceMind captures readable content from eligible HTTP(S) pages as you browse, alongside metadata such as the title and URL. It does not guarantee capture of every page: browser-internal surfaces, restricted documents, authentication boundaries, and content that never renders can limit what is available.
Long pages must be broken into model-sized inputs. Chunking matters because a single page may discuss several unrelated ideas. A useful chunk should be large enough to preserve context but small enough that one topic does not drown out another.
2. Tokenize the text
Embedding models do not consume raw prose directly. A tokenizer splits text into model vocabulary units, often words or subword pieces. It also adds the special markers and attention information the model expects.
This is not the same as blindly deleting punctuation or stop words. Transformer tokenizers and trained models use context from the sequence. Preprocessing that removes too much can change meaning before the model sees it.
3. Generate a fixed-length embedding
TraceMind uses the compact all-MiniLM-L6-v2 sentence-transformer model. It produces a 384-dimensional embedding: an array of 384 numbers representing the input text.
The model runs in the browser via WebGPU when supported, with a WebAssembly fallback. The first search can be different from later searches because the model may need to load and warm locally. Until it is ready, exact keyword retrieval remains important.
An embedding is not a summary and cannot reconstruct the source text. It is a search representation. The captured text remains necessary for snippets, exact matches, and reading context.
4. Compare query and page vectors
When a user searches, the query passes through the same tokenizer and model. The resulting query vector is compared with stored page vectors using cosine similarity. Higher similarity suggests related meaning.
TraceMind keeps this personal-scale ranking local and uses a compact cache of embeddings. A linear comparison is deliberately simpler than operating a remote vector database and avoids transferring the browsing corpus to an indexing service.
Semantic similarity alone is not enough. Exact identifiers, names, and quotations can be weak embedding queries. TraceMind therefore combines vector matches with full-text search so an exact term can compete with conceptually related results.
A small example
Suppose a captured page says:
Increase the delay after each failed request to avoid overwhelming the service.
A keyword query for exponential backoff may not match that sentence literally. An embedding query can still place the two ideas close together. Conversely, a query for HTTP 429 benefits from exact full-text matching because the numeric identifier is decisive.
That is the practical value of hybrid search: semantic retrieval handles paraphrase while keyword retrieval protects precision.
What local inference does and does not mean
Core TraceMind capture, embedding generation, search, screenshots, and analytics run locally. That means those operations do not require sending the browsing corpus to a TraceMind indexing server.
It does not mean every product feature is offline. Optional Pro Chat sends the user's question and selected matching excerpts, titles, and URLs directly to the configured OpenAI, Anthropic, or Google Gemini provider using the user's key. TraceMind does not proxy or store those requests.
Local storage also is not synonymous with encryption. Free browser storage has no TraceMind passphrase encryption. Pro users can optionally protect local content and new encrypted backups with a passphrase.
Limits worth remembering
- An embedding can retrieve a related topic without proving the page contains the answer.
- Models have fixed context limits, so chunk boundaries affect retrieval.
- Rare identifiers and exact numbers often need keyword search.
- Search quality depends on the text that was captured.
- Device capabilities affect model load time and inference performance.
- Browser storage capacity still applies to a growing local corpus.
Vector embeddings are useful because they translate fuzzy human recall into a comparable search signal. They work best as one part of a retrieval system, not as a magical replacement for exact text, filters, or source inspection.
For the ranking and storage choices behind the product, read Building Local-First AI: Technical Decisions. To compare retrieval modes, see Semantic Search vs. Keyword Search.
