Skip to content

Tumbling-window KLL is non-deterministic across processes (unseeded init; KLLConfig has no seed) #77

Description

@GordonYuanyc

Summary

The tumbling-window integration for KLL constructs each pool sketch with the unseeded KLL::init, and KLLConfig carries no seed. So the compaction coin is Coin::new() (wall-clock random), and tumbling_clear() re-randomizes it on every window rotation. Two processes/hosts running the same tumbling pipeline therefore diverge in their exact retained samples from the very first window.

Where

  • src/sketch_framework/tumbling.rs:141impl TumblingWindowSketch for KLL's from_config calls KLL::init(config.k, config.m) (not init_with_seed).
  • src/sketch_framework/tumbling.rsKLLConfig has k, m only; no seed field.
  • src/sketches/kll.rsKLL::initCoin::new(); clear() re-seeds from Coin::new() when seed == None.

Impact

  • Determinism / parity, not correctness. Each process's estimates stay within KLL's error bound and merge fine; but exact cross-process agreement (needed for byte-level reproducibility, dedup, or verification) is not achievable, and re-randomizes each window via tumbling_clear().
  • Only KLL is affected among tumbling sketches; KLLDynamic is not wired into tumbling at all (and has no seeded constructor either).

Independence from the ASAPv1 wire format

This is unrelated to sketch serialization: the tumbling pool builds sketches locally via from_config and clears them in place — it never (de)serializes its pool sketches. Serializing seed (see the KLL ASAPv1 payload work) does not touch this path.

Suggested fix

Add an optional seed to KLLConfig and use KLL::init_with_seed(k, m, seed) in from_config, so a configured seed makes tumbling KLL reproducible across processes (and survives tumbling_clear(), which already re-seeds from the stored seed when present).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions