Local models: set the model server's sampling per model (greedy decoding made Qwen loop) #37
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "dario/mlx-sampling"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
mlx_lm.serversamples greedily unless told otherwise. Its defaults are--temp 0.0,--top-p 1.0and top-k off, and theoc-mlxprofile set nothing else. With greedy decoding, once a model starts repeating a step it tends to keep repeating it.Changes
sampling(temperature,top_p,top_k).factory config checkvalidates the ranges. The factory doesn't pass these values to the harness.just mlx-serve:samplingtomlx_lm.serveras its defaults (--temp,--top-p,--top-k), so every request gets them;sampling;model_id. It used to readmodelID, which isn't a config key.factory.example.jsonand the factory-dev kit: Qwen's recommended values for Qwen3-Coder: temperature 0.7, top-p 0.8, top-k 20.deploy-microvm.mdand the README explain the setting and why it matters.Evidence
In an interactive run continuing #28 (OpenCode, Qwen3-Coder-Next-6bit via
just mlx-serve), the model got into a loop. It sent the sameedittoskills/refine-item/SKILL.mdagain and again, applying and reverting one line, or changing nothing ("No changes to apply: oldString and newString are identical"). Before every call it wrote the same sentence, "Now let me update the skill to clarify what the run prompt provides". It ran until it was stopped by hand.mlx_lm.server --helpon the host (mlx-lm installed with uv):--temp TEMP Default sampling temperature (default: 0.0),--top-p … (default: 1.0),--top-k … (default: 0, disables top-k).Testing
just checkpasses. The tests include a new validation case, and the example config is still valid.mlx-serveon both configs: it yields--temp 0.7 --top-p 0.8 --top-k 20.mlx-serveon a Mac. My environment is Linux, where the recipe refuses to run.🤖 Generated with Claude Code