bots-garden/mini-mepublic Fork
⑂ v2.2.2
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/mini-me.git
git clone ssh://git@rickub.com/bots-garden/mini-me.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP
struggling-models.md · 44 lines · 9.4 KBmarkdown
Blame HistoryOpen raw

Noticing when a model struggles — explanation

What is this about?

mm was written for small local models, and small models struggle in recognisable ways: they repeat the same failing call, they write tool-call arguments that do not parse or never end, they go silent, they call tools that do not exist, they run out of turns, they answer nothing. From the start mm noticed most of these — the loop detector, the runaway guard, the watchdog, the note handed back after a broken call — but it told the model (an instruction in a tool's output) or ended the turn with an error line among the rest of the conversation. The person watching had to read every line to know that the model was going in circles.

Struggle signals (ticket 153) make the same detections visible to the user, apart from the answer, in a colour that says how bad it is. The list of signals and how each front end shows them is in the CLI reference.

Why it is designed this way

Two levels, not a score. A warning (⚠, yellow) means mm noticed something and the turn goes on — the model was told it is looping, a broken call was handed back, the context is nearly full. A severe signal (✖, red) means the turn was stopped or failed because of it. That is the distinction a person acts on: wait and watch, or rephrase and try again (or change model).

Reported where they are detected. Each detection already lived in one place — the loop detector's Record, the model-call wrapper for retries and broken calls, the end of Generate for how a turn ended. Each reports a ui.Struggle there; nothing re-reads the conversation afterwards to guess. The loop detector learned to call a function (WithReport) rather than to know about the screen, so it stays a package with no front-end knowledge.

One event, three renderings, as for everything else in mm (architecture): the window keeps the worst struggle of the turn as a badge in the status bar; the line mode prints a coloured line when it happens; an editor gets a short italic paragraph signed mm in the agent's message, because it has no status bar of ours.

In the window, the status bar, until the next question. The badge sits on the right of the bottom bar, in the version's place: the version is the least useful thing there while something is wrong, and the key hints on the left — Ctrl-C quit above all, the way out of a turn that will not stop — keep their room. It outlives the turn on purpose: once a turn ended badly, the badge says why, and it goes when the next question starts a new turn. One exception: context N% full describes the history, not how the turn went, so it goes as soon as the history shrinks — a /compact that compressed, /new, /resume — while a looped — stopped beside it stays (ticket 269); a badge saying 85 % over a history just compressed would contradict the header's ctx figure. A severe signal beats a warning; between two of the same level the latest wins, so loop: bash ×4 replaces ×3; (+N) counts the others.

Failures in a row, not only repeats (ticket 160). The loop detector needs the same call with the same result; a model that tries cat config.yml, then cat conf/config.yml, then cat config.yaml and fails each time is struggling just as much. Whether a call failed is only known inside each tool, so every tool now hands its outcome to the detector with the call (record, recordFailure, recordOutcome); the detector, which already sees every call, counts the failures in a row and reports failing: N tool calls in a row from the third. It is a warning only: the model reads each failure in the tool's output already, and a hard stop would end turns that a fourth attempt would have saved.

A cancelled turn is not a struggle. Esc, Ctrl-C or /abort end a turn on the user's request; reporting stalled or max turns then would blame the model for the user's choice.

Silent failures, handed back once (v2.0.0). Measuring small coding models (LFM2.5-24B-A2B in demos/lfm-coder, now demos/gpt-oss-mini-coder; demos/olala-mini; demos/mellum2) showed failures that ended a turn without a word: a reply cut mid-reasoning at the token limit, a reasoning that repeated one sentence until the limit, a final answer saying "Done." after the last edit had been refused. mm knows each of these for certain — the server's finish reason, the stream it reads, the outcome of its own tools — so it does not guess from the answer's wording. Where the model can still recover, the reply is handed back once with a note saying what happened; if the same thing happens again, the turn ends and a signal says why, naming the setting to change when there is one.

Repairs before refusals. Some mistakes can only mean one thing: "true" for true, old_text for old, a path with a directory missing. mm repairs them and says so in the tool output, rather than refusing and hoping the model fixes them — refusals that quote the right path were measured to make a small model loop. See tools and workspace.

Tool feedback that must not mislead (v2.2.2, tickets 294–300 and 307). The validation runs of 2026-12-02 with Mellum2, Mellum2.1 and Qwen3-Coder-Next failed less on their tasks than on what the tools told them. A diagnostics call said clean on files that did not build, so the model believed its wrong imports; an edit with old equal to new, sent twelve times between reads, was a success each time, so no rule saw a loop; a line of 1000000000000000 was accepted; a form feed written for \f was invisible in the diff. The fixes follow one rule: a tool answer must be true and visible, or say that it is not sure. An empty diagnostics list is only believed once it has settled, an edit that changes nothing counts as a failure for the loop detector, a line outside the file is refused, control characters are shown escaped, and errors are recalled when a broken file is read again. A recall can be true and still useless: on 2026-12-04 Mellum2.1 Thinking knew the extra } at line 142 had to go, but read the file eight times without editing it, because } is not unique as an edit's old text. So from the second recall, mm stops repeating the fact and says what to do: the line as the file has it, and the edit_file call, with line, that changes it.

Ending in an answer, not an error. Three runs out of four that day ended on bookkeeping after the work was done: a plan update without its status, repeated until the loop detector stopped the turn — in error, with no answer. A repeated text was already handed back for an answer; a repeated tool call now is too: the stopped calls are answered "not run" and the model is asked once, without tools, for its final answer. A missing plan status now means done, the one thing a model that leaves it out can mean, and the tool's description asks for a single update per task.

Degenerate replies, recognised as loops. A sentence followed by thousands of blank lines up to the token limit was reported as "raise max_tokens" — the wrong advice, since a larger limit only buys more blank lines. It is now a loop: cut while it streams, handed back once, and collapsed in the answer. A tool call written inside the reasoning, with nothing else in the reply, ended the turn silently; it is handed back once with the call quoted, and nothing from the reasoning is ever run — running it would give the reasoning, which the user may not see, the power to act.

Advice, never a stop, for a test run again. A model re-running the same test with other sleeps and timeouts is going in circles, but one re-running it after a change is doing the right thing, and the two differ only by whether a file changed in between. So similar bash commands since the last file change get a note asking the model to read the code — and the turn is never stopped on similarity alone.

Repairing what the model asked to write. The form-feed repair is the one place where mm changes the content a model asked to write, so it was studied before being written: every occurrence in the traces had the same shape (a form feed at the start of a line, before unc), legitimate form feeds have other shapes (a page break alone on its line), and the repair is limited to source files that hold no form feed yet, to new text only, and is always reported.

Rejected alternatives

  • The header. Considered; the user chose the status bar, which keeps the header for who is answering and how full the context is.
  • A transcript line per signal. The conversation is where the answer is; a loop flagged at every repeat would fill it with lines that repeat the tool's own output. The badge summarises; the line mode, which has no status bar, prints the lines.

How it relates to the rest

The detections themselves are unchanged: the loop detector still tells the model to change approach and still stops the tool calls after six identical calls — the model then gives its answer without tools; the watchdog, the runaway guard and the broken-call note behave as before. What the turn returns and what the history keeps do not change either — a struggle is shown, never stored. See also context compression, which a context N% full warning usually precedes, and thinking models for why the watchdog stays fed while a model reasons.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Noticing when a model struggles — explanation

## What is this about?

`mm` was written for small local models, and small models struggle in recognisable ways: they repeat the same failing call, they write tool-call arguments that do not parse or never end, they go silent, they call tools that do not exist, they run out of turns, they answer nothing. From the start `mm` noticed most of these — the loop detector, the runaway guard, the watchdog, the note handed back after a broken call — but it told the **model** (an instruction in a tool's output) or ended the turn with an error line among the rest of the conversation. The person watching had to read every line to know that the model was going in circles.

Struggle signals (ticket 153) make the same detections visible to the **user**, apart from the answer, in a colour that says how bad it is. The list of signals and how each front end shows them is in the [CLI reference](../reference/cli.md#struggle-signals).

## Why it is designed this way

**Two levels, not a score.** A warning (`⚠`, yellow) means `mm` noticed something and the turn goes on — the model was told it is looping, a broken call was handed back, the context is nearly full. A severe signal (`✖`, red) means the turn was stopped or failed because of it. That is the distinction a person acts on: wait and watch, or rephrase and try again (or change model).

**Reported where they are detected.** Each detection already lived in one place — the loop detector's `Record`, the model-call wrapper for retries and broken calls, the end of `Generate` for how a turn ended. Each reports a `ui.Struggle` there; nothing re-reads the conversation afterwards to guess. The loop detector learned to call a function (`WithReport`) rather than to know about the screen, so it stays a package with no front-end knowledge.

**One event, three renderings**, as for everything else in `mm` ([architecture](architecture.md)): the window keeps the worst struggle of the turn as a badge in the status bar; the line mode prints a coloured line when it happens; an editor gets a short italic paragraph signed `mm` in the agent's message, because it has no status bar of ours.

**In the window, the status bar, until the next question.** The badge sits on the right of the bottom bar, in the version's place: the version is the least useful thing there while something is wrong, and the key hints on the left — `Ctrl-C quit` above all, the way out of a turn that will not stop — keep their room. It outlives the turn on purpose: once a turn ended badly, the badge says why, and it goes when the next question starts a new turn. One exception: `context N% full` describes the history, not how the turn went, so it goes as soon as the history shrinks — a `/compact` that compressed, `/new`, `/resume` — while a `looped — stopped` beside it stays (ticket 269); a badge saying 85 % over a history just compressed would contradict the header's `ctx` figure. A severe signal beats a warning; between two of the same level the latest wins, so `loop: bash ×4` replaces `×3`; `(+N)` counts the others.

**Failures in a row, not only repeats** (ticket 160). The loop detector needs the same call with the same result; a model that tries `cat config.yml`, then `cat conf/config.yml`, then `cat config.yaml` and fails each time is struggling just as much. Whether a call failed is only known inside each tool, so every tool now hands its outcome to the detector with the call (`record`, `recordFailure`, `recordOutcome`); the detector, which already sees every call, counts the failures in a row and reports `failing: N tool calls in a row` from the third. It is a warning only: the model reads each failure in the tool's output already, and a hard stop would end turns that a fourth attempt would have saved.

**A cancelled turn is not a struggle.** Esc, Ctrl-C or `/abort` end a turn on the user's request; reporting `stalled` or `max turns` then would blame the model for the user's choice.

**Silent failures, handed back once** (v2.0.0). Measuring small coding models (LFM2.5-24B-A2B in `demos/lfm-coder`, now `demos/gpt-oss-mini-coder`; `demos/olala-mini`; `demos/mellum2`) showed failures that ended a turn without a word: a reply cut mid-reasoning at the token limit, a reasoning that repeated one sentence until the limit, a final answer saying "Done." after the last edit had been refused. mm knows each of these for certain — the server's finish reason, the stream it reads, the outcome of its own tools — so it does not guess from the answer's wording. Where the model can still recover, the reply is handed back **once** with a note saying what happened; if the same thing happens again, the turn ends and a signal says why, naming the setting to change when there is one.

**Repairs before refusals.** Some mistakes can only mean one thing: `"true"` for `true`, `old_text` for `old`, a path with a directory missing. mm repairs them and says so in the tool output, rather than refusing and hoping the model fixes them — refusals that quote the right path were measured to make a small model loop. See [tools](../reference/tools.md#arguments-that-do-not-match-a-tools-schema) and [`workspace`](../reference/configuration.md#workspace-keys).

**Tool feedback that must not mislead** (v2.2.2, tickets 294–300 and 307). The validation runs of 2026-12-02 with Mellum2, Mellum2.1 and Qwen3-Coder-Next failed less on their tasks than on what the tools told them. A diagnostics call said `clean` on files that did not build, so the model believed its wrong imports; an edit with `old` equal to `new`, sent twelve times between reads, was a success each time, so no rule saw a loop; a `line` of 1000000000000000 was accepted; a form feed written for `\f` was invisible in the diff. The fixes follow one rule: a tool answer must be true and visible, or say that it is not sure. An empty diagnostics list is only believed once it has settled, an edit that changes nothing counts as a failure for the loop detector, a line outside the file is refused, control characters are shown escaped, and errors are recalled when a broken file is read again. A recall can be true and still useless: on 2026-12-04 Mellum2.1 Thinking knew the extra `}` at line 142 had to go, but read the file eight times without editing it, because `}` is not unique as an edit's old text. So from the second recall, mm stops repeating the fact and says what to do: the line as the file has it, and the `edit_file` call, with `line`, that changes it.

**Ending in an answer, not an error.** Three runs out of four that day ended on bookkeeping after the work was done: a `plan update` without its status, repeated until the loop detector stopped the turn — in error, with no answer. A repeated text was already handed back for an answer; a repeated tool call now is too: the stopped calls are answered "not run" and the model is asked once, without tools, for its final answer. A missing plan status now means `done`, the one thing a model that leaves it out can mean, and the tool's description asks for a single update per task.

**Degenerate replies, recognised as loops.** A sentence followed by thousands of blank lines up to the token limit was reported as "raise max_tokens" — the wrong advice, since a larger limit only buys more blank lines. It is now a loop: cut while it streams, handed back once, and collapsed in the answer. A tool call written inside the reasoning, with nothing else in the reply, ended the turn silently; it is handed back once with the call quoted, and nothing from the reasoning is ever run — running it would give the reasoning, which the user may not see, the power to act.

**Advice, never a stop, for a test run again.** A model re-running the same test with other sleeps and timeouts is going in circles, but one re-running it after a change is doing the right thing, and the two differ only by whether a file changed in between. So similar `bash` commands since the last file change get a note asking the model to read the code — and the turn is never stopped on similarity alone.

**Repairing what the model asked to write.** The form-feed repair is the one place where mm changes the content a model asked to write, so it was studied before being written: every occurrence in the traces had the same shape (a form feed at the start of a line, before `unc`), legitimate form feeds have other shapes (a page break alone on its line), and the repair is limited to source files that hold no form feed yet, to new text only, and is always reported.

## Rejected alternatives

- **The header.** Considered; the user chose the status bar, which keeps the header for who is answering and how full the context is.
- **A transcript line per signal.** The conversation is where the answer is; a loop flagged at every repeat would fill it with lines that repeat the tool's own output. The badge summarises; the line mode, which has no status bar, prints the lines.

## How it relates to the rest

The detections themselves are unchanged: the loop detector still tells the model to change approach and still stops the tool calls after six identical calls — the model then gives its answer without tools; the watchdog, the runaway guard and the broken-call note behave as before. What the turn returns and what the history keeps do not change either — a struggle is shown, never stored. See also [context compression](context-compression.md), which a `context N% full` warning usually precedes, and [thinking models](thinking-models.md) for why the watchdog stays fed while a model reasons.