Skip to main content

Module generation_config

Module generation_config 

Source
Expand description

The sampling recipe a model author publishes in generation_config.json.

§Why gglib goes looking for this

crate::domain::model_sampling reads general.sampling.* out of a GGUF, which llama.cpp applies directly. That is the ideal source and it is almost never present: the keys landed upstream in PR #17120 (2025-11-25) and most converters predate them or simply drop what they do not recognise. The author’s numbers exist — they are in generation_config.json in the base repo, which is what every transformers user gets by default — they just do not survive the trip into a quantised GGUF.

So gglib fetches them at import instead, and ranks them where an unreviewed recipe belongs. Same argument ADR 0004’s follow-up makes:

gglib currently writes its own reasoning_profile() recipe for reasoning-tagged models; a model author’s published recommendation is better evidence than gglib’s guess.

§This is not ModelSamplingDefaults, and must not become it

The obvious place to put these values is ModelSamplingDefaults, and it is the wrong one. That type means “what this GGUF declares, which llama.cpp has already applied to default_generation_settings, and gglib_proxy::props reads it to decide whether a /props value is attributable to the model rather than to the build.

A value fetched from HuggingFace has been applied by nobody. Writing it there would make the baseline check report ModelSupplied for a number llama-server never saw — an instrument reporting an attribution that cannot be wrong because it was invented, which is ADR 0004 finding 1’s trap wearing a new hat. These stay in the inference hierarchy, where a value only takes effect because gglib sends it.

Structs§

PublishedGenerationConfig
What one generation_config.json yielded.

Constants§

FIELD_MAP 🔒
The transformers spelling of each field gglib models, paired with its own.

Functions§

apply 🔒
Write one validated value onto the config by gglib’s field name.
generation_config_candidates
Where to look for a generation_config.json, best candidate first.
in_range 🔒
Accepted range for each field, matching docs/sampling.md.
parse_generation_config
Read a model author’s generation_config.json.
strip_quant_suffix 🔒
Strip a trailing quantisation marker from a repo name.