Kraftverk

Docs / Optimizer

Optimizer methodology

The optimizer searches a discrete neighborhood of reversible settings, measures each candidate with KraftBench, and keeps only what passes stability and comparison gates.

Mode

Milestone 1 / current safe path supports --mode safe only. Balanced/Aggressive modes are rejected with a clear error rather than silently doing something else.

kraftverk optimize --mode safe --goal balanced

Goals include: balanced, gaming, compile, workstation, throughput, latency, efficiency, sustained, quiet.

Safe parameters (implemented)

KeyScopeRollback
bench.worker_threadsProcess / KraftBench workersYes
bench.rayon_threadsLocal rayon pool sizeYes
process.priorityCurrent process (normal / above_normal / high)Yes (best-effort)
process.affinityCurrent process (all / even / odd / first_half)Yes (best-effort)

Not implemented (explicitly unsupported): GPU clocks, power plans, registry tweaks, TRIM/cleaners, other-process affinity.

Search strategy

ε-greedy / Bayesian plugins may be listed in the architecture as future work — treat unimplemented strategies as non-claims.

Lifecycle per candidate

  1. Apply via ApplyGuard (writes recovery journal)
  2. Verify each change
  3. Measure (warm-up + samples)
  4. Compare to baseline index samples
  5. Rollback during search
  6. Provisional best → validation run with more samples
  7. Accept + commit (keep applied) or reject + rollback
flowchart LR
  A[Propose] --> B[Apply + journal]
  B --> C[Measure]
  C --> D{Better + stable?}
  D -->|search| E[Rollback]
  E --> A
  D -->|validate pass| F[Commit]
  D -->|fail| E

Stability gate

Validation requires:

Sessions, hot-plug, recovery

Optimizer sessions can resume; hardware eligibility is re-checked. If a disallowed GPU appears mid-session, Kraftverk stops, restores managed config, and blocks further execution.

On launch, RecoveryJournal restores any interrupted apply so a crash mid-experiment does not leave the process in a mystery state.

Related

Statistics · Safety · Architecture