|
liblloyal 1.0.0
Branched Inference for llama.cpp
|
Namespaces | |
| namespace | detail |
Classes | |
| struct | BranchMetricsState |
| Unified model + sampling perplexity tracker. More... | |
| struct | PerplexityState |
| Rolling NLL accumulator for perplexity computation. More... | |
Enumerations | |
| enum class | Base { Nats , Bits } |
Functions | |
| float | model_surprisal (const float *logits, int n_vocab, int picked_id, Base base=Base::Nats) |
| float | model_entropy (const float *logits, int n_vocab, Base base=Base::Nats) |
| float | sampling_surprisal (const float *candidate_logits, const int32_t *candidate_ids, int n_candidates, int picked_id, Base base=Base::Nats) |
| Compute sampling-level surprisal for picked token. | |
| float | sampling_entropy (const float *candidate_logits, int n_candidates, Base base=Base::Nats) |
| Compute sampling-level entropy of candidate distribution. | |
|
strong |
| Enumerator | |
|---|---|
| Nats | |
| Bits | |
Definition at line 44 of file metrics.hpp.
|
inline |
Definition at line 180 of file metrics.hpp.
|
inline |
Definition at line 131 of file metrics.hpp.
|
inline |
Compute sampling-level entropy of candidate distribution.
Measures uncertainty within the filtered candidate set (after top-k/p/temperature). Use to monitor distribution health after grammar masks or constraints.
| candidate_logits | Logits of candidate tokens (post-filter) |
| n_candidates | Number of candidates |
| base | Nats (natural log) or Bits (log₂) |
Definition at line 272 of file metrics.hpp.
|
inline |
Compute sampling-level surprisal for picked token.
Measures uncertainty within the filtered candidate set (after top-k/p/temperature). Lower than model surprisal if filters removed low-probability tokens.
Use to monitor runtime hazard when grammar/constraints narrow the distribution.
| candidate_logits | Logits of candidate tokens (post-filter) |
| candidate_ids | Token IDs of candidates |
| n_candidates | Number of candidates |
| picked_id | Token ID that was sampled |
| base | Nats (natural log) or Bits (log₂) |
Definition at line 226 of file metrics.hpp.