// Options and results of answering, shared by the two ways of writing: // real Kimi alone (reader_greedy) and draft and check (loop/draft_loop.h). #pragma once #include #include #include "reader/reader.h" namespace hk { struct DayOptions { int max_new = 256; // tokens to produce at most int max_rounds = 1000; // safety cap on draft/check rounds std::vector stop_ids; // generation ends after one of these int draft_len = 0; // tokens drafted per round; 0 = chosen each round (best_check_len) // What one more position adds to a sweep, as a share of a sweep over one position. // Only where the estimate starts (0 = 0.085): the loop corrects it from its own sweep times. double extra_cost = 0; }; struct RoundInfo { int drafted = 0, accepted = 0; // accepted: drafted tokens real Kimi let through bool fixed = false; double draft_seconds = 0, sweep_seconds = 0; int64_t sweep_bytes = 0; }; struct DayResult { std::vector tokens; // the continuation (prompt not included) std::vector rounds; int fixes = 0; bool stopped = false; // ended on a stop token double seconds = 0, draft_seconds = 0, sweep_seconds = 0; int64_t sweep_bytes = 0; }; struct DayCallbacks { std::function on_approved; // final tokens, in order std::function on_draft; // a fresh unverified draft (may be discarded) }; // Greedy decoding with the reader alone, one sweep per token. Slow, but it is // the ground truth the draft-and-check loop is tested against. std::vector reader_greedy(Reader& reader, const std::vector& prompt, int max_new, const std::vector& stop_ids); } // namespace hk