[Model Runner V2] Enable forcing a specific acceptance rate during rejection sampling (#38045)

Signed-off-by: Giancarlo Delfin <gdelfin@inferact.ai>
This commit is contained in:
Giancarlo Delfin
2026-03-26 13:38:12 -07:00
committed by GitHub
parent 0904b6550d
commit c32e97602d
7 changed files with 240 additions and 18 deletions
+8 -1
View File
@@ -58,7 +58,7 @@ SpeculativeMethod = Literal[
EagleModelTypes,
NgramGPUTypes,
]
RejectionSampleMethod = Literal["strict", "probabilistic"]
RejectionSampleMethod = Literal["strict", "probabilistic", "synthetic"]
@config
@@ -184,6 +184,13 @@ class SpeculativeConfig:
distribution, but the latter yields a higher acceptance rate at the cost
of more memory to cache draft logits."""
synthetic_acceptance_rate: float | None = None
"""Average acceptance rate for synthetic rejection sampling. Draft
tokens are accepted with a position-dependent probability that decays
geometrically, calibrated so that the mean rate across all speculative
positions equals this value. Only used when rejection_sample_method
is 'synthetic'. Must be in [0, 1]."""
def compute_hash(self) -> str:
"""
WARNING: Whenever a new field is added to this config,