diagnostics: STRATA_DUMP_FIRST_LOGITS writes the first generated token's logits

STRATA_DUMP_FIRST_LOGITS=<file>: the logits of the first window's first position (the token the prompt predicts),
n_vocab float32, written once per run. Two engine variants run on the same prompt then give a first-token KL
divergence: how far a prompt-path change moves the model's distribution, not only whether its top token changed.
On a layer split the last stage's verifier writes it.
This commit is contained in:
sergiywith authored and Niko1221 committed 2026-10-01 08:09:42 +02:00
1 parent 6ac1a2cc5e
commit aea6e45c64
3 files changed
+20

No files matched your search

+7
View File
@@ -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