laurencehardman/llama-mindcontrol — explained in plain English
Analysis updated 2026-07-24
Run local reasoning models without them getting stuck in endless thought loops.
Enforce clean cutoffs on AI reasoning so it ends at a paragraph break instead of mid-sentence.
Configure per-request reasoning budgets through an OpenAI-compatible API.
| laurencehardman/llama-mindcontrol | highdelay/activate-watermark | monteslu/box3d-wasm | |
|---|---|---|---|
| Stars | 15 | 15 | 15 |
| Language | C++ | C++ | C++ |
| Setup difficulty | hard | moderate | easy |
| Complexity | 4/5 | 2/5 | 3/5 |
| Audience | developer | general | developer |
Figures from each repo's GitHub metadata at analysis time.
Requires building from source on Mac or running a Docker image with an NVIDIA GPU, plus configuring reasoning stage parameters.
This repository is a modified version of llama.cpp, a popular C/C++ project for running large language models locally. The modification addresses a specific problem with "reasoning models," which are AI models that produce a hidden chain of thought before giving their final answer. The core issue is that this internal reasoning can go off the rails. The model might get stuck repeating the same phrases, endlessly second-guessing itself with "wait, actually" transitions, or simply running on forever without reaching a conclusion. The standard fix is to impose a hard token limit, cutting off the reasoning at a fixed length. However, this cutoff is blind to what the model is actually doing, often chopping the thought process mid-sentence or mid-word without fixing the underlying looping behavior. This fork introduces a state machine that adds two stages around the existing hard cutoff. When reasoning begins, an intro stage injects a message telling the model its token budget, encouraging it to be concise. At a configurable fraction of that budget, a soft-warning stage inserts another message telling the model it should start wrapping up. Finally, a hard-stop stage with a grace period waits for a natural paragraph break before forcing the reasoning to end, ensuring the cutoff happens cleanly. All injected text is inserted at line or paragraph boundaries, never mid-sentence. If the model stops reasoning on its own before any stage triggers, that natural stopping point takes precedence. Each stage is optional and can be configured through environment variables when starting the server or through parameters in individual API requests. The project provides build instructions for Apple Silicon Macs and a pre-built Docker image for systems with NVIDIA GPUs. The server exposes a standard API compatible with OpenAI's format, and the README includes a sample request showing how to pass the reasoning budget parameters per request. The full README is longer than what was shown.
A modified version of llama.cpp that prevents local AI reasoning models from getting stuck in loops by adding smart warnings before cutting off their thinking process, ensuring they wrap up cleanly.
Mainly C++. The stack also includes C++, C, Docker.
The license is not explicitly mentioned in the explanation, so it is unknown what permissions or restrictions apply.
Setup difficulty is rated hard, with roughly 1h+ to a first successful run.
Mainly developer.
This repo across BitVibe Labs
double-check against the repo, no cap.