Local AI · reads and thinks while you type

You type.
It already knows.

Chat apps let the GPU sit idle while you write. MAFDET uses that time: it reads your message as you type it and starts reasoning before you press Enter. On Qwen3-4B the wait after Enter goes from 12.2 s to 3.2 s, same answers. Entirely local, on llama.cpp.

$pipx install mafdet

Windows · macOS on Apple Silicon · Linux untested · NVIDIA CUDA, AMD Vulkan, Apple Metal, or CPU

New to all this? Read the plain-words version →

Experience MAFDETQwen3-4B · Q4_K_M · RTX 2060 · simulation
◇Watching · start typing, MAFDET reads as you write

An illustrative simulation in your browser: no model runs here. Timings scaled from the Qwen3-4B benchmark on an RTX 2060 (24 word problems typed in real time, mean wait after Enter 12.2 s → 3.2 s). Playback at 3× speed.

Measured, not promised

Same answers. A fraction of the wait.

Word problems with a known numeric answer, typed in real time at 5 to 8 characters per second, Enter right after the last character. The wait is for the first word of the answer. Every run is in the repository.

Qwen3-4B

RTX 2060 · 6 GB · 24 problems

3.8×faster

Without reasoning ahead12.2 s
◆ With MAFDET3.2 s

24/24 both ways. Fits in VRAM, 83 tok/s. Faster in 24 of 24 problems. Reasoning left after Enter: 944 → 244 tokens.

Qwen3-14B

RTX 2060 · 6 GB · 6 problems

2.3×faster

Without reasoning ahead108 s
◆ With MAFDET47 s

6/6 both ways. Larger than the VRAM: 38% on the GPU, about 5 tok/s. Six problems give the order of magnitude, not a precise figure.

Qwen3-4B

MacBook Pro M2 Pro · 16 GB · 24 problems

3.2×faster

Without reasoning ahead18.1 s
◆ With MAFDET5.6 s

24/24 both ways. Metal, 54 tok/s. Faster in 24 of 24 problems. Reasoning left after Enter: 966 → 248 tokens.

Qwen3-14B

MacBook Pro M2 Pro · 16 GB · 6 problems

2.7×faster

Without reasoning ahead32.7 s
◆ With MAFDET12.1 s

6/6 both ways. The whole 14B fits in the unified memory and writes at 18 tok/s.

Conditions

Qwen3 Q4_K_M in thinking mode on llama.cpp. Mean wait after Enter; the RTX 2060 has 6 GB of VRAM, the Mac 16 GB of unified memory. Two runs of the same 24 problems differ by up to a second: these are orders of magnitude, with the data and the scripts to repeat them.

Read the research →

How it works

Other models wait for Enter. MAFDET starts before.

An LLM reads a prompt in a fast, parallel phase (prefill) and then writes one token at a time (decode). A reasoning model thinks for hundreds of tokens before its first word. MAFDET moves both ahead of Enter.

  1. 01

    You start typing.

    On every pause MAFDET tokenizes the text, keeps the KV cache in sync with it, and holds back the last few tokens: a word you are still typing can change how the text is split.

  2. 02

    It reads, and reasons, ahead.

    The prefill is done while you write. With Qwen3 the model also reasons in short chunks on the message as it is. When you edit, that reasoning stays in the prompt as notes and the model goes on from there.

  3. 03

    You hit Enter. Little is left.

    Only the last tokens are read, the model finishes reasoning from where it got to, and answers. On Qwen3-4B about two thirds of the reasoning is done before Enter.

The KV cache, in sync with your text

Backspaces, edits in the middle, pasted blocks: the common-prefix check trims the cache to what still holds and prefills only what is new. Reading ahead is exact; the result is the one a from-scratch computation gives.

Reading ahead · exact

Heuristics such as hold-back and debounce only affect how much work is wasted, never the result. Checked by mafdet judge against a from-scratch computation: 0 errors.

Thinking ahead · measured

The model reasons on versions of the message that are not final yet, so the answer can differ from a cold start. That is why it is measured on answers that can be checked: 24/24 on both sides, on the RTX 2060 and on the M2 Pro.

What you get

A local chat app that sets up itself.

No PyTorch, no manual downloads. MAFDET looks at your machine, installs the right build of llama.cpp, and picks the model that runs best on it. Then it starts working before you do.

Reads while you type

The prefill is done before Enter, on every pause. Exact, whatever you do to the text: backspaces, edits, pasted documents.

Thinks while you type

With Qwen3 the model reasons in short chunks on the message as it is, and keeps its notes when you change it. Two thirds of the reasoning done before Enter on the 4B.

Hardware you already own

The reference machine is an RTX 2060 with 6 GB. Apple Silicon runs through Metal, AMD Radeon through Vulkan, and everything also runs on a CPU.

A catalog that knows your machine

Every model says, before download, whether it fits in VRAM, how fast it reads and writes, and the wait after Enter with and without MAFDET. Estimates within 12% of the measured speeds.

Any GGUF

Five families in the catalog: Qwen3, Llama 3, Gemma 3, Mistral and Phi-4. Beyond it, search Hugging Face from the app or add a file of your own.

Measure and verify

Benchmarks, typing simulation and correctness checks ship with the app. Measure a model in half a minute; judge the engine against a from-scratch computation.

The app

One engine, two faces.

The window, in English, Italian, French or German. Or the terminal app, keyboard first, on an amber phosphor screen with a boot sequence. Same views, same engine, same numbers under every answer.

The MAFDET window: the model reasoned ahead while the message was typed (455 of 571 reasoning tokens) and answered 1.6 s after Enter
mafdet gui · the windowEvery answer ends with its numbers: first word after Enter, tokens read while you typed, reasoning done before Enter, speed.
The terminal app: the model catalog as a table, with what each model does on this machine
mafdet tui · the terminalThe catalog as a table: where each model runs on this machine, its speed, and the wait after Enter with and without MAFDET.
The model catalog in the window: for each model, where it runs on this machine, its speed and the wait after Enter
Models · estimated for your hardwareBest for you, fits my GPU, downloaded. Measure replaces the estimate with real numbers in half a minute.
The launcher: window or terminal
mafdet · the launcherWindow or terminal, and it remembers your choice.

The command line

Six verbs. Every one of them measurable.

One mafdet CLI, in the spirit of the goddess it is named after. The app and the research scripts share the same engine, so what you measure is what you run.

$ mafdet doctor

the awakening

Checks the GPU, memory, llama.cpp and the models. --install sets up llama.cpp with the right build.

$ mafdet watch

the watch

The chat window with a model and options from the command line; reads ahead while you type.

$ mafdet strike

the strike

Reasoning ahead while you type, kept across edits, and the exact answer ahead at a pause.

$ mafdet hunt

the hunt

Simulates people typing, clean, messy or pasting, and measures the wait after sending.

$ mafdet race

the race

Benchmarks prefill and decode on your machine, on llama.cpp or on PyTorch.

$ mafdet judge

the judgement

Checks results against a from-scratch computation. Must end with 0 errors.

Get started

Running in a minute. The models come after.

Python 3.10 or later is all you need. The first start looks at your machine, installs llama.cpp and downloads the model that runs best on it; the terminal shows every download with its size, speed and time left.

With a double-click

  1. Download MAFDET: on GitHub, Code → Download ZIP, and unzip it (or git clone).
  2. Double-click start_mafdet.bat. The first time it creates a Python environment in .venv and installs MAFDET, about a minute. Needs Python 3.10 or later.
  3. After that, a double-click opens MAFDET in under a second. After an update it installs the new libraries by itself.

From PyPI

With Python from python.org, pip works as it is.

$ pip install mafdet
$ mafdet

Runs on NVIDIA through CUDA (reference: RTX 2060, 6 GB), on AMD Radeon through Vulkan (in place, not measured yet), or on the CPU.

Either way: MAFDET asks whether to open the window or the terminal app, looks at your machine, installs the right build of llama.cpp (CUDA, Vulkan, Metal or CPU) and downloads the model that runs best. No PyTorch, no manual downloads.

Open source

Apache 2.0, with the data to check it.

A prototype by Simone Di Mauro and Simone Di Natale, the research log in the open, every benchmark in the repository with the script that produced it. Stars, issues and measurements on other hardware are what moves it forward. Who they are →

Privacy

Your messages never leave the machine.

Inference runs locally, on llama.cpp. The only downloads are at setup: llama.cpp from its GitHub releases, and the models you pick from Hugging Face. After that, nothing goes out.

Roadmap

What is next.

  • Reasoning ahead beyond Qwen3: DeepSeek-R1, gpt-oss, each with its frame measured
  • Reasoning ahead for models larger than the VRAM that beats the model thinking by itself
  • Linux tested end to end
The research log ↗

Help wanted

Got an AMD Radeon?

MAFDET runs on Radeon cards through llama.cpp's Vulkan build, but nobody has measured it on one yet. Half an hour of an RX 5000 or later would fill that gap: install, Measure Qwen3-4B, run research/thinking_ahead.py, open an issue.

Send your numbers ↗

Questions

The short answers.

Is the answer the same as without MAFDET?

Reading ahead is exact: the KV cache ends up identical to a from-scratch computation, whatever you did to the text, and mafdet judge checks it. Reasoning ahead is not, because the model reasons on versions of the message that are not final; that is why it is measured on word problems with a known answer. On Qwen3-4B: 24/24 with and without, on both machines.

Which models reason ahead?

Qwen3 in thinking mode, the one family whose reasoning frame was measured. Every other model in the catalog, and any GGUF you add, is read while you type and, at a pause, has its answer written ahead; that part is exact and holds for the exact text it was written for.

Does anything leave my machine?

No. Inference runs locally on llama.cpp. The only downloads are at setup: llama.cpp from its GitHub releases and the models from Hugging Face. Gated models (Llama, Gemma) need their license accepted on huggingface.co.

What hardware do I need?

The reference machine is an RTX 2060 with 6 GB of VRAM. Apple Silicon Macs run the models on the GPU through Metal (tested: M2 Pro, 16 GB). AMD Radeon cards run through Vulkan, not measured yet. Everything also runs on a CPU; 16 GB of RAM is recommended there, and for models larger than the VRAM.

How much disk space?

About 0.7 GB for llama.cpp with CUDA (100 MB with Vulkan, 60 MB for the CPU), plus the models: from 0.6 GB for Qwen3-0.6B to 2.3 GB for the 4B recommended on 6-8 GB cards. No PyTorch.

Why is it called MAFDET?

After Mafdet, the ancient Egyptian feline goddess known as "the runner", who struck snakes and scorpions before they could attack. The six commands are her verbs: awaken, watch, strike, hunt, race, judge.

Is it production ready?

It is a prototype, honest about it: Windows and macOS are tested, Linux is not yet, Radeon is not measured. The engine is checked and the results are reproducible; the edges are still being filed. Issues are welcome.

More in the README, which is the full manual.

Start thinking ahead.

Other models wait for you to finish writing. MAFDET starts before.

$pipx install mafdet