llama.cpp PR simplifies sampler name matching, removes alt_names flag
Alternative sampler names now recognized by default, case-insensitive.
The pull request (#23744) to the llama.cpp project addresses a long-standing inconsistency in sampler name matching. Previously, the `common_sampler_types_from_names` function in `common/sampling.cpp` required an explicit `allow_alt_names` flag to accept alternative spellings like `top-k` and `min-p` alongside the canonical `top_k` and `min_p`. This led to confusing failures in tools like llama-server's UI, where users would input valid names that were not recognized.
The core change removes the `allow_alt_names` flag and unconditionally checks every provided sampler name against both the canonical list and a comprehensive set of alternative names. Matching is now case-insensitive, so `Top_K` or `MIN-P` work fine. Additionally, the PR introduces auto-generation of aliases—mapping dashes to underscores and adding common variations—ensuring nearly any reasonable user input is accepted. Contributions from Sigbjørn Skjæret and ngxson refined the unified map approach, using `std::unordered_map` merging for efficiency. The CI builds confirm compatibility across macOS (ARM, Intel), Linux (CPU, Vulkan, ROCm, etc.), Windows (CPU, CUDA, Vulkan), Android, and iOS.
- Removes the `allow_alt_names` flag, making alternate names always accepted.
- Implements case-insensitive matching for all sampler names (e.g., 'Top_K' works).
- Auto-generates aliases for samplers, reducing future maintenance and fixing UI validation errors.
Why It Matters
Users can now use intuitive sampler names without UI errors or config headaches across platforms.