Home / use case

Long-term chat memory with a 4B model: 60.4% on LongMemEval fully offline

At a glance
Hardware
A Mac, fully offline
Models & engines
Answer model: Qwen 4B
Search model: bge-m3 (about 570M parameters, 8-bit quantized) running through llama.cpp on the Mac's GPU
Key gotcha
He notes his 4B model is two years newer than the paper's model, and small models have improved a lot since, so the comparison isn't only about the search step.

What they built

@GabrielNolo tested whether a small local assistant can remember months of past conversations, using the LongMemEval benchmark, where each question hides its answer in about 50 past conversations (~115k tokens).

The whole run was fully offline with a Qwen 4B model. Rather than having the model read the entire history, a local search step picks the 5 most relevant conversations first, so the model reads a short, focused set of notes.

Setup

  • A Mac, fully offline
  • Answer model: Qwen 4B
  • Search model: bge-m3 (about 570M parameters, 8-bit quantized) running through llama.cpp on the Mac's GPU
  • BM25 for classic keyword matches

How it works

  1. Past conversations are embedded with bge-m3; at question time the question is embedded the same way and passages are ranked by cosine similarity.
  2. BM25 produces a second, keyword-based ranking, and the two ranked lists are combined.
  3. The 5 most relevant conversations are handed to the 4B model to answer.

Results & numbers

  • 4B model plus local search: 60.4%.
  • From the LongMemEval paper: GPT-4o reading the whole history scored 60.6%, and a same-size 4B model reading the whole history scored 34.2%.
  • The search finds every needed conversation 90% of the time.
  • The embedding search matches "my dog" to "Max, my golden retriever" and works across French and English.

Gotchas

  • He notes his 4B model is two years newer than the paper's model, and small models have improved a lot since, so the comparison isn't only about the search step.
“I search first and then give the model the most 5 relevant conversations.”— @GabrielNolo

Do it yourself

  1. Get the LongMemEval benchmark from github.com/xiaowu0162/LongMemEval.
  2. Run bge-m3 (8-bit) locally with llama.cpp and embed every past conversation.
  3. Build a BM25 index over the same conversations.
  4. For each question, rank conversations with both cosine similarity and BM25 and merge the two lists.
  5. Pass the top 5 conversations to a local 4B model and score its answers.
Source: X (@GabrielNolo) · Published 2026-11-21 · Added 2026-11-21. This write-up summarizes the original source; see it for full details.

Similar setups

A custom inference engine for half a million tokens of context on a 24 GB MacBook

Marco Franzon built his own inference engine for Ternary Bonsai 2 27B, a 2-bit build of Qwen3.8-27B, and reports 500k context at 19 tok/s with 15 GB peak RAM on a 24 GB MacBook.

Marco Franzon on X · 2026-11-11

Replacing Ollama with a llama.cpp router on a shared workstation GPU

A developer moved a busy single-GPU workstation (chat UI, agent, batch study-guide writer, embedders, classifiers) from Ollama to llama.cpp's router mode and measured throughput and embedding parity before switching.

shuffle-on blog · 2026-11-08

Local AI Starter: a one-click Mac wizard that installs llama.cpp, Qwen3, and OpenCode in one folder

Kirill Lukyanov built an MIT-licensed double-click wizard that sizes a Mac’s RAM, downloads a pinned llama.cpp build plus a Qwen model and OpenCode, proves the model answers, then opens a sandboxed coding agent and browser chat.

Kirill Lukyanov (DEV.to / klukyanov.ru) · 2026-11-05

Home RAG assistant for embedded-systems docs on Proxmox

Ollama, llama.cpp, Open WebUI, BGE-M3 and SearXNG in a GPU-passthrough VM. Moving from 6 GB to 16 GB of VRAM changed which models could run.

Ground Bounce · 2026-10-18