Skip to content

bug(cli): rmlx baseline --prompt-tokens tokenizes raw JSON fixture text, not message content #291

Description

@Pushkinist

rmlx baseline reads the prompt fixture with a plain std::fs::read_to_string and tokenizes the whole file (JSON envelope + syntax), not the extracted message content (crates/rmlx-cli/src/commands/baseline.rs).

Repro

rmlx baseline --model <bonsai> --prompt-tokens 65536 --kv-quant none --max-ctx 65536 --record against a chat-JSON fixture (longctx_64k.json, real content ~63–65k tokens) tokenizes to 69667 tokens — over both --max-ctx 65536 and the default --max-prompt-tokens cap. Post-#223 ("error loudly on GPU prompt truncation") this is now a hard error, not the old silent-halve, so the KV-MB capture aborts.

Impact

The bench KV-MB path (docs/models/bonsai/8B/rMLX.md protocol) breaks at 64k unless --max-prompt-tokens 65528 is passed to force the old truncate-to-cap behavior. The HTTP chat-completions path (run_one) is unaffected — it sends messages and applies the real chat template.

Fix

baseline should extract message content from a chat-JSON fixture (apply the chat template / pull messages[].content) before tokenizing, matching what the serve path does — so --prompt-tokens N means N content tokens, not N file-text tokens. Found during the post-0.3.0 Bonsai KV-matrix re-validation.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions