Skip to main content

Module sampling

Module sampling 

Source
Expand description

Stage 4–5: resolving what the model is asked to sample with.

Unlike super::messages, nothing here reads messages — these transforms only ever touch top-level keys.

Tier B — Policy (ADR 0001). llama-server is one process serving one model with no catalog, no profiles and no view of the client, so it cannot arbitrate between a :coding profile and a per-model default. The ladder, the trust gate and the provenance are permanently gglib’s, and nothing here gates on RuntimeCapabilities.

The floor beneath the ladder is a separate question with a different answer: six of its seven values were measured to restate llama.cpp’s own defaults, which makes them compensation rather than policy. See ADR 0003, which decides they are deferred.

Structs§

SamplingDecision
Everything resolve_sampling decided, and why.
SamplingLayers
The sampling layers that sit below the client’s own request parameters.

Enums§

FloorClass
Which class floor sat beneath the ladder.

Constants§

CLIENT_AUTHORITATIVE_KEYS
The client’s own fields that survive an untrusted request.
DISABLE_AGENTIC_SAMPLING_ENV
Environment kill switch for the agentic-turn adjustments.
LADDER_RUNGS
Rungs in the pipeline’s ladder: cli, client, profile, model, global, model (auto-detected).
UNMODELLED_SAMPLER_KEYS 🔒
Sampler-taste keys llama-server reads that InferenceConfig does not model, stripped from an untrusted body by strip_unmodelled_sampler_keys.

Functions§

agentic_sampling_disabled_via_env 🔒
Whether DISABLE_AGENTIC_SAMPLING_ENV is set to a truthy value.
erase_unadopted_client_keys 🔒
Remove from the body the client keys gglib must not forward: what the trust gate binned, the budget alias gglib never emits, and one refused field.
model_rung 🔒
Which rung the model’s stored defaults occupy, and the name that rung carries — both decided by DefaultsOrigin in one place, so resolution and its labelling cannot disagree.
read_client_layer 🔒
Read the client’s own sampling parameters and apply the trust gate.
resolve_sampling
Resolve the sampling hierarchy into body, then pin cache_prompt.
strip_unmodelled_sampler_keys 🔒
Remove UNMODELLED_SAMPLER_KEYS from an untrusted body, returning what was removed so it joins the discard record.