serve: "strata_checkpoint": false lets a one-shot request skip its conversation checkpoint (#830)

A request with "strata_checkpoint": false sends ckpt=0 to the engine. That request reads its prompt in one part and
saves no checkpoint at its last turn boundary, nor the periodic ones of a long prompt. It still resumes from a
checkpoint it matches and still saves the system-prompt root. Absent or true: today's behavior; an engine without the
key skips it.
This commit is contained in:
Breno Perucchi authored and Niko1221 committed 2026-10-05 13:16:54 +02:00
1 parent d50dc91177
commit f6af1ddef9
4 files changed
+22 -2

No files matched your search

+9 -2
View File
@@ -6316,6 +6316,10 @@ int main(int argc, char** argv) {
float req_min_p = 0.0f, req_penalty_repeat = 1.0f, req_penalty_freq = 0.0f, req_penalty_present = 0.0f;
int req_penalty_last_n = 0;
int req_cvec = 1; // cvec=0|1: a loaded control vector for this request (on when absent)
// ckpt=0: a one-shot call whose turn no later request extends. It reads its prompt in one part and saves
// no checkpoint at the last turn boundary (nor the periodic ones of a long prompt); it still resumes from
// a checkpoint it matches, and still saves the root of a long enough system prompt. Absent = today's.
int req_ckpt = 1;
// tuning keys (setup's calibration measures settings without restarting the engine): the PCIe share of
// the missed experts and the draft-probability floor, for this request only
double req_pcie_frac = o.pcie_frac, req_spec_min_p = o.spec_min_p;
@@ -6332,6 +6336,7 @@ int main(int argc, char** argv) {
const std::string key = tok.substr(0, eq);
const float fv = std::strtof(tok.c_str() + eq + 1, nullptr);
if (key == "cvec") req_cvec = std::atoi(tok.c_str() + eq + 1);
else if (key == "ckpt") req_ckpt = std::atoi(tok.c_str() + eq + 1) != 0;
else if (key == "temperature") req_temperature = fv;
else if (key == "top_p") req_top_p = fv;
else if (key == "top_k") req_top_k = std::atoi(tok.c_str() + eq + 1);
@@ -6720,7 +6725,7 @@ int main(int argc, char** argv) {
pp_from = read_from;
pp_reached = read_from;
pp_t0 = r0;
pp_next_check = reread_to > 0 ? INT64_MAX : resume + o.prompt_cache_every;
pp_next_check = reread_to > 0 || !req_ckpt ? INT64_MAX : resume + o.prompt_cache_every; // ckpt=0: none
{
std::lock_guard<std::mutex> lk(part_mu);
part_at.clear();
@@ -7047,9 +7052,11 @@ int main(int argc, char** argv) {
// which the retention policy pins (conv_cache.hpp), so the next new chat reads only what comes after it.
// (PR #65, code-martin.) Only for a system prompt of --prompt-cache-root tokens or more: a small one
// is cheaper to read again than the extra part costs (~0.3 s).
const int64_t last_turn = turn_at; // ckpt=0 drops the split there, the root is still looked for before it
if (!req_ckpt) turn_at = -1;
int64_t root_at = -1;
if (o.prompt_cache > 0 && o.turn_token >= 0 && o.prompt_cache_root > 0 && (read_from == 0 || resumed_from0))
for (int64_t i = 1; i < turn_at; ++i)
for (int64_t i = 1; i < last_turn; ++i)
if (ids[(size_t) i] == o.turn_token) {
if (i >= o.prompt_cache_root) root_at = i;
break;