Ask My Notes
Robo keeps 40 fun-fact notes. Ask a question and a real AI model finds the notes that mean the same thing, even if they use totally different words. This is the "R" in RAG: how chatbots look things up before they answer.
Type a question! My keyword search works right away, but it only matches exact words. Press Wake up the model to give me a meaning search too.
Meaning search
Compares the meaning of your question with every note
Wake up the model to search by meaning.
Keyword search
Only counts words that are exactly the same
Type a question to start.
The meaning map: every note is a dot. Notes with similar meanings land close together. Tap a dot to read it.
Challenges
What just happened?
- A real AI model turned every note into a list of 384 numbers, its "meaning code".
- Your question got its own meaning code. Robo compared it with every note and picked the closest ones.
- Keyword search only counts matching words, so "biggest beast" never finds "largest animal". Meaning search does.
- Robo's answer only uses what is in the notes, and says where each piece came from. When nothing matches, it says so.
How it works
Read the notes
Before you ask anything, the model reads every note once and writes down its meaning code.
Read the question
Each time you type, your question gets a meaning code too, in the very same code language.
Compare
Multiply the two codes number by number and add up. A big total means "these mean the same thing".
Pick the best
The notes with the biggest totals win. On the map, they are the dots closest to your star.
Answer with sources
A real chatbot would get these notes plus your question, and write an answer using only them.
For grown-ups: what's really going on
This is the retrieval half of Retrieval-Augmented Generation (RAG), running fully on-device with Transformers.js and ONNX Runtime WebAssembly. Model: Xenova/all-MiniLM-L6-v2 (ONNX port of sentence-transformers/all-MiniLM-L6-v2), 8-bit quantised, about 23 MB. Nothing you type leaves the browser.
- The encoder: MiniLM-L6 is a 6-layer, 384-wide BERT-style Transformer distilled from a larger model, then fine-tuned with a contrastive objective on over a billion sentence pairs so that paraphrases land close together. Inputs longer than 256 word pieces are truncated.
- Pooling: the model outputs one vector per token; we take the mean over tokens (ignoring padding) and L2-normalise, giving one 384-d unit vector per text.
- Similarity: for unit vectors, cosine similarity is just the dot product,
cos(q, d) = q · d. Unrelated sentences score around 0 to 0.15, close paraphrases 0.6 and up. Retrieval = top-k by cosine (here brute force over ~40 notes; real systems use an approximate nearest-neighbour index such as HNSW or IVF over millions of chunks). - Keyword baseline: a BM25-lite score with stop-word removal and crude plural stemming:
Σ idf(w)·f(k₁+1)/(f + k₁(1−b+b·|d|/avgdl)), k₁ = 1.2, b = 0.75. It is fast, exact and great for names and codes, but blind to synonyms. Production systems often combine both (hybrid search) and re-rank with a cross-encoder. - Chunking: each note here is one short "chunk". With real documents you split text into passages of roughly 100 to 500 tokens, often with overlap, because one vector cannot hold a whole book and the LLM prompt has limited room.
- The map: PCA of the note embeddings (top two principal components, by power iteration on the Gram matrix). The query is projected onto the same axes. Two dimensions throw away most of the 384, so the map is a hint, not the ground truth: the scores are.
- The "G" in RAG: a real system pastes the top-k chunks into a prompt for a language model, which writes the answer and cites sources. Robo's answer here is a fixed template, so it can never invent facts. The live prompt for your question:
Type a question to see the prompt.
Further reading: Lewis et al., Retrieval-Augmented Generation (2020) · Sentence-BERT (2019) · sentence-transformers docs.