kernel_entropy.generation

PoE text generation for Kernel Language Entropy.

Loads the PoE ensemble (9 LLM heads with prod + robustness LoRA merged, plus a dormant uncertainty head) once and produces N diverse responses for a single prompt. Each sample is drawn from the full PoE jury in pure-generation mode (is_mcq=False); per-sample seeding of the torch RNG makes draft-head picks and multinomial draws reproducible.

Classes

HydraGenerator([gamma, beta, max_new_tokens])

PoE-backed batched generation for KLE.

class kernel_entropy.generation.HydraGenerator(gamma: int = 4, beta: float = 1.0, max_new_tokens: int = 200)[source]

Bases: object

PoE-backed batched generation for KLE.

generate_batch produces one response per seed by calling PoE.generate_with_cache in pure-generation mode (is_mcq=False).

generate_batch(prompt: str, seeds: list[int], temperature: float = 0.98, verbose: bool = False) list[str][source]

Generate one response per seed.

Seeds the torch RNG before each PoE call so the draft-head pick and multinomial draws inside generate_with_cache are reproducible. Forks the RNG so per-seed seeding does not leak into caller state.