Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

diagnostics: STRATA_DUMP_FIRST_LOGITS writes the first generated token's logits

sergiywithaea6e45c6424
diff --git a/include/strata/core/verify.hpp b/include/strata/core/verify.hpp
index eec481332..187a296a7 100644
--- a/include/strata/core/verify.hpp
+++ b/include/strata/core/verify.hpp
@@ -74,6 +74,9 @@ public:
/// One window: `tokens[0..T)` at positions pos0.., the pool served per layer; `out[t]` = argmax after token t.
/// The PLE rows are gathered here from `ss.ple_prev` and the tokens. Captures the T-token graph on first use.
bool run(int T, const int32_t* tokens, int64_t pos0, PoolMultiFn pool, void* user, int32_t* out, std::string& err);
+ /// Diagnostics: row `t` of the last window's head logits (n_vocab floats) to the host. Valid after run().
+ bool copy_logits(int t, float* host) const;
+ int64_t vocab() const { return next_ ? next_->vocab() : n_vocab_; }
/// The sampling the verify window's head applies (temperature / top_p / top_k / seed). Set per
/// request; greedy by default. The sampling itself runs OUTSIDE the captured graph - its
/// parameters would otherwise be baked forever - so this can change between requests freely.
diff --git a/src/core/verify.cpp b/src/core/verify.cpp
index 96bfdbeee..6c7f1c0cf 100644
--- a/src/core/verify.cpp
+++ b/src/core/verify.cpp
@@ -1303,4 +1303,11 @@ bool Verifier::commit(int n_keep, std::string& err) {
return next_ == nullptr || next_->commit(n_keep, err);
}
+bool Verifier::copy_logits(int t, float* host) const {
+ if (next_ != nullptr) return next_->copy_logits(t, host); // a layer split: the head is on the last stage
+ if (head_logits_ == nullptr || host == nullptr || t < 0 || n_vocab_ <= 0) return false;
+ return cudaMemcpy(host, head_logits_ + (size_t) t * (size_t) n_vocab_, (size_t) n_vocab_ * sizeof(float),
+ cudaMemcpyDeviceToHost) == cudaSuccess;
+}
+
} // namespace strata::core
diff --git a/src/program/generate.cpp b/src/program/generate.cpp
index caf47d6bc..58236edab 100644
--- a/src/program/generate.cpp
+++ b/src/program/generate.cpp
@@ -5833,6 +5833,16 @@ int main(int argc, char** argv) {
if (first_window) {
first_window = false;
ttft_ms = std::chrono::duration<double, std::milli>(Clock::now() - t_start).count();
+ // Diagnostics: the first window runs the prompt's last token over the state the prompt path left
+ // (keys, values, recurrent state), so its logits carry whatever that path did. A native pack never
+ // runs the per-token loop --dump-logits reads; this is where prompt paths can be compared by output.
+ if (const char* fl = std::getenv("STRATA_DUMP_FIRST_LOGITS")) {
+ std::vector<float> row((size_t) ver.vocab());
+ std::FILE* f = ver.copy_logits(0, row.data()) ? std::fopen(fl, "wb") : nullptr;
+ if (f == nullptr || std::fwrite(row.data(), sizeof(float), row.size(), f) != row.size())
+ std::fprintf(stderr, "strata generate: STRATA_DUMP_FIRST_LOGITS: cannot write %s\n", fl);
+ if (f) std::fclose(f);
+ }
}
// plan v0.3 P6: the adaptive tier's host work (ranking, copy submission) runs on its own thread while the
// GPU commits and drafts; it touches only the residency tables, which nothing reads until the next window