Inspiration
Revision notes grow to dozens of pages. Ctrl+F only finds exact words, and pasting notes into a chatbot means uploading them and trusting an answer you cannot check.
What it does
Paste notes or open a .txt / .md file, ask a question, and asknotes shows the three passages most likely to hold the answer, with the shared words underlined, the paragraph number and the model's similarity score. It does not write answers, so it cannot invent one. Notes never leave the device.
AI implementation
- Model: all-MiniLM-L6-v2, a sentence-embedding model (8-bit ONNX build, 23 MB), run in the browser with Transformers.js 3.8.1. No API, no key, no server.
- How it contributes: it turns each passage and the question into vectors so passages with similar meaning rank higher even when they use other words. Its ranking is merged with BM25 word matching using weighted reciprocal rank fusion.
- Measured honestly on 10,552 SQuAD v1.1 dev questions: answer in the top 3 passages 90.7% for meaning and words (default), 89.8% for words only, 82.0% for meaning only. The fusion weight (0.1) was chosen on half the articles and checked on the other half (held-out top 3: 90.9% vs 90.5% words only). Word matching does most of the work on this benchmark; the README says so.
How I built it
Plain JavaScript core (passage splitting, BM25, fusion) shared by the page and a Node evaluation script; Transformers.js for the model; GitHub Pages for hosting. 7 unit tests run without downloading the model.
Challenges
The first version fused both rankings equally and was worse than keyword search alone. Measuring it on SQuAD, then tuning the weight on one half and testing on the other, fixed that without fooling myself. Batched and single-query embeddings from the quantised model also differ slightly, so the evaluation embeds one question at a time, as the page does.
What I learned
A small embedding model is not automatically better than BM25; it needs to be measured and combined carefully. Showing the source passage is more trustworthy than a generated answer.
What's next
An evaluation set of real student questions written without looking at the notes, PDF import, saving the index in the browser, and a multilingual model.
My contribution and AI-assisted tools
Solo project. I built it with AI-assisted coding: an AI coding assistant helped write the code, tests, evaluation and documentation. Third-party parts are credited in the README: all-MiniLM-L6-v2 (Apache 2.0), Transformers.js (Apache 2.0), SQuAD v1.1 (CC BY-SA 4.0, downloaded by the script, not stored).
Built With
- bm25
- css
- github
- html
- javascript
- node.js
- onnx
- sentence-transformers
- transformers.js