Skip to main content

Module sampling_provenance

Module sampling_provenance 

Source
Expand description

Which layer supplied each resolved sampling parameter.

§Why this exists

InferenceConfig::resolve_layers folds an ordered ladder of sampling layers into one config under two rules that are individually defensible and jointly opaque: the coupled trio (presence_penalty, repeat_penalty, min_p) travels with the temperature it was tuned against, and a model’s stored defaults rank above or below global settings depending on whether a person set them.

The resolved numbers alone cannot distinguish a value someone chose from one that fell out of a floor. 0.0 is a number; “0.0, from the floor, because the profile claimed the temperature” is an explanation, and only the second makes the behaviour auditable.

§One computation, not two

FieldSources is produced by resolve_layers_with_sources, the same pass that decides the values — never by a second function that re-derives the rules. That is deliberate: this provenance previously lived in a separate describe_provenance helper in the request pipeline, and the two implementations had already drifted. A ladder where cli supplied a presence_penalty and a lower layer claimed the temperature resolved the penalty from the claiming layer while the log named cli.

The same (value, source) shape resolve_context_size_with_source uses, and for the same reason.

Structs§

FieldSources
Per-field provenance for one resolved InferenceConfig.

Enums§

ParamSource
Which rung of a sampling ladder supplied one resolved parameter.
SamplingLayer
The five rungs of the ladder resolve_with_profile builds, in priority order.