Home / use case

On-device semantic search for a markdown notes app, on iPhone and desktop

At a glance
Models & engines
Default model: LFM2.5-Embedding-350M (about 193 MB on the phone); all-MiniLM-L6-v2 as the "Light" option; paraphrase-multilingual-MiniLM-L12-v2 for multilingual notes
Desktop: Tauri 2 + Rust, official Q8_0 GGUF (380 MB) run by llama.cpp via the llama-cpp-2 crate, on Metal on Apple Silicon and on CPU elsewhere
Key gotcha
A fixed 0.3 cosine floor dropped most of the right answers: short questions score between 0.15 and 0.3 even against the note they are about. What worked was a floor per model (0.12 for LFM2.5) plus keeping only matches within 0.25 of the best one, up to ten.

What they built

VB Notes is a markdown notes app where every note is a plain .md file in a folder you choose. Its author kept failing to find notes because he rarely remembered the words he had used, so search by meaning was the part he cared about most.

He wanted that search to run on the device, because notes are private. The phone app (Expo and React Native) runs LFM2.5-Embedding-350M through react-native-executorch, and the desktop app (Tauri 2 with Rust) runs the same model as a Q8_0 GGUF through llama.cpp.

Because both apps use the same chunking code and the same model, a question finds the same notes on phone and desktop. There is no account and no server.

Setup

  • iPhone/Android: Expo + React Native, model via react-native-executorch
  • Default model: LFM2.5-Embedding-350M (about 193 MB on the phone); all-MiniLM-L6-v2 as the "Light" option; paraphrase-multilingual-MiniLM-L12-v2 for multilingual notes
  • Desktop: Tauri 2 + Rust, official Q8_0 GGUF (380 MB) run by llama.cpp via the llama-cpp-2 crate, on Metal on Apple Silicon and on CPU elsewhere
  • SQLite for vectors, SQLite FTS5 for keyword search

How it works

  1. Long notes are split into 200-word chunks (for LFM2.5) that overlap the previous chunk by a fifth, at most 16 per note, and every chunk starts with the note's title. Code blocks and Mermaid diagrams are left out; tags lose their # and count as words.
  2. Each chunk becomes 1,024 numbers, stored as int8 with one float32 scale in front, in a SQLite file in the app's caches folder (out of iCloud backups). The .md files stay the source of truth.
  3. Questions get a query: prefix and notes a document: prefix. Keyword (FTS5) and meaning results are merged with reciprocal rank fusion: a note scores 1 / (60 + its rank) in each list.
  4. On desktop a background thread embeds notes newest first, so recent notes become searchable first.

Results & numbers

  • On 18 reworded test questions, LFM2.5-Embedding-350M put the right note first 17 times out of 18, with unrelated notes staying under 0.15; all-MiniLM-L6-v2 was right first 16 times.
  • The multilingual model was right first 19 times out of 22 on the same test plus Hindi, and was the only one that matched Hindi notes to English questions and back, but brought more noise.
  • int8 storage is a quarter of the float32 size, and the cosine similarity barely moves.

Gotchas

  • A fixed 0.3 cosine floor dropped most of the right answers: short questions score between 0.15 and 0.3 even against the note they are about. What worked was a floor per model (0.12 for LFM2.5) plus keeping only matches within 0.25 of the best one, up to ten.
  • An iOS background download managed only 0.05 to 0.9 MB/s on the simulator versus 2.4 MB/s for the app's own download, so the model download runs inside the app and resumes from the partial file.
  • The model loads three seconds after launch (unless you open Search first) so the app still opens quickly.
“Notes are private, and I wouldn't use a search box that sends every question to a server for my own notes.”— Lavneet Sharma

Do it yourself

  1. Write your own test questions, each worded differently from the note it should find, and compare a few small embedding models on them.
  2. Look at where unrelated notes' scores stop, not only the hit rate, and pick the model with the cleanest gap.
  3. Chunk notes with overlap and put the note title on every chunk.
  4. Store vectors as int8 with a scale in SQLite, and reload only notes whose hash changed.
  5. Keep keyword search (FTS5) and merge it with the meaning results by rank (reciprocal rank fusion).
  6. Use a per-model floor plus a window below the best match instead of one fixed threshold.
Source: HackerNoon (Lavneet Sharma) · Published 2026-11-20 · Added 2026-11-20. This write-up summarizes the original source; see it for full details.

Similar setups

A local second brain for Markdown notes with Ollama, Whisper and SQLite

WeekendAiProjects built a phone-to-computer note capture system that tidies, links, searches and answers questions over a Markdown vault with local Qwen models, and graded every answer by hand.

DEV Community · 2026-11-08

Onira: on-device self-hypnosis scripts from a 2B model on Android

The Onira app writes 30-40 minute self-hypnosis sessions on a mid-range Android phone with a fine-tuned Gemma 4 E2B in llama.cpp, generating each block while the previous one is narrated and working in airplane mode.

DEV Community (Charles-Antoine Fournel) · 2026-11-22

Keeping llama.cpp 1.1.0's new agent flags off a loopback-only home model server

After llama.cpp v1.1.0 rebuilt its chat UI into an agent host, a self-hoster mapped which server flags grant browser tools, a shell on the host or a LAN proxy, and kept all of them out of his running config.

Caleb Garber · 2026-12-03

A self-hosted llama.cpp endpoint on three 16 GB GPUs with presets.ini and Docker

Theo Dufort shares the Compose file and 60-line presets.ini behind his private OpenAI-compatible endpoint: a 27B coding model at 132K context and a 26B MoE chat model.

Theo Dufort (blog) · 2026-11-28