Skip to content

Small CPU models compared; Gemma 4 chat format; fix replies cut inside a character - #22

Merged
FMXExpress merged 3 commits into
mainfrom
claude/optimistic-allen-i3bd3d
Nov 10, 2026
Merged

FMXExpress merged 3 commits into
mainfrom
claude/optimistic-allen-i3bd3d

Conversation

@FMXExpress

Copy link
Copy Markdown
Owner

This PR compares four small models for a fast CPU profile and fixes two bugs that the comparison turned up. The write-up is in bench/README.md, under "Small models for a fast CPU profile".

Fixes (Mem.LlamaChat)

  • Gemma 4 can now chat. llama.cpp b11985's built-in chat templates do not know Gemma 4's <|turn>role … <turn|> format, so every prompt failed with "llama.cpp does not know this model's chat template". memagent now renders the format itself and writes <bos> out. Thinking stays off.
  • No more broken UTF-8 at the length limit. A reply cut off by max_new_tokens partway through a multi-byte character (half an emoji) used to end in invalid UTF-8, which broke the JSON that bench_llama writes. memagent now drops the incomplete character.

Profiles (models.json)

  • qwen3-0.6b: trainable.
  • lfm2-1.2b and lfm3-1.7b: chat-only. Their short convolutions have no SSM_CONV backward pass.
  • gemma4-e2b: chat-only. There is no GELU/TANH backward pass.
  • bench_memory.py --no-train scores the base model and the RAG setup only, for models nothing can train yet.

Measured on 4 CPU cores

model generate (4-bit) answered with the fact in the prompt made up from a look-alike fact trainable
Qwen3-0.6B 42 t/s 0.933 (Q8_0) 0.667 yes
LFM2-1.2B 35 t/s 0.850 (Q8_0) 0.467 no
LFM3-1.7B 21 t/s 1.000 0.667 no
Gemma 4 E2B 11 t/s 0.733 0.133 no
  • Speed tracks file size. Liquid's claim that its models run at twice Qwen3's speed did not hold on this CPU.
  • Gemma 4 refuses rather than errs. On 16 of the 60 questions it said "I don't have access to your personal information" even though the fact was in the prompt.

Test plan

  • make test-pascal
  • llama-bench on all four models, plus tiny and small for reference
  • bench_memory.py --no-train on all four models (bench/results/memory-*-cpu-rag.json)
  • Gemma 4 E2B and LFM3-1.7B re-run after the fixes, and both completed
  • Training run for qwen3-0.6b (not run yet)

Generated by Claude Code

…PU profiles and bench_memory --no-train

Mem.LlamaChat renders Gemma 4's <|turn>role ... <turn|> format itself (llama.cpp
b11985's built-in templates do not know it, so Gemma 4 could not chat), with
<bos> written out. A reply cut off by max_new_tokens inside a character (half
an emoji) no longer ends in invalid UTF-8.

models.json: qwen3-0.6b (trainable), lfm2-1.2b, lfm3-1.7b and gemma4-e2b
(chat-only: no llama.cpp backward for their short convolutions, or GELU/TANH).
bench_memory.py --no-train scores base and rag for models nothing can train.
On 4 CPU cores, 30 facts with the fact in the prompt: Qwen3-0.6B 0.933 (29 t/s
at Q8_0), LFM2-1.2B 0.850 (18 t/s); Gemma 4 E2B and LFM3-1.7B still running.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
…, Qwen3-0.6B 0.933 (trainable), LFM2-1.2B 0.85, Gemma 4 E2B 0.73

Speed on 4 cores follows file size (Qwen3-0.6B Q4_0 42 t/s, LFM2-1.2B Q4_K_M
35, LFM3-1.7B 21, Gemma 4 E2B 11). Gemma 4 refuses with the fact in the prompt
(16 of 60) but makes up least (0.133).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
@FMXExpress
FMXExpress merged commit ca12459 into main Nov 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants