Report what a reply spent reading its prompt, and pin the clock right
`UsageDelta` gains `prefillMs`, llama-server's own `timings.prompt_ms`, so the footer under a finished reply is "read 9.5s · 50.3 tok/s · 3:00 PM". Prefill is the half of a turn that was invisible and is often the larger: measured on the 0.6B here, 1m 4s for the first turn after a model loads against 22ms for the next, whose prompt the server still had cached. The clock moves to the end of the line. Everything in front of it is a provider's own measurement, so a session on another provider has fewer of them or none, and a reader who has learned where the time is should not have to find it again because the model changed. The costs grow leftwards into the space instead, and a test asserts every shape of the line ends with the same thing. Verified on the emulator against a real llama session: three replies reading "read 1m 4s · 193 tok/s · 3:54 PM", "read 25ms · 308 tok/s · 3:54 PM" and "read 22ms · 194 tok/s · 3:54 PM", with the clock in one column. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b660905098
commit
369b8f7e52
14 files changed
+135
-42
No files matched your search
@@ -230,6 +230,7 @@ impl Translator {
|
||||
// Cached input is a subset of this figure, not an additional count.
|
||||
context: last.get("inputTokens").and_then(Value::as_u64),
|
||||
tokens_per_second: None,
|
||||
prefill_ms: None,
|
||||
})
|
||||
.into_iter()
|
||||
.collect()
|
||||
@@ -247,6 +248,7 @@ impl Translator {
|
||||
tokens: input.unwrap_or(0) + output.unwrap_or(0),
|
||||
context: input,
|
||||
tokens_per_second: None,
|
||||
prefill_ms: None,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -939,6 +941,7 @@ mod tests {
|
||||
tokens: 18,
|
||||
context: Some(13),
|
||||
tokens_per_second: None,
|
||||
prefill_ms: None,
|
||||
}
|
||||
);
|
||||
assert!(translator.completed());
|
||||
@@ -1162,6 +1165,7 @@ mod tests {
|
||||
tokens: 42,
|
||||
context: Some(39),
|
||||
tokens_per_second: None,
|
||||
prefill_ms: None,
|
||||
}]
|
||||
);
|
||||
assert_eq!(
|
||||
@@ -1172,6 +1176,7 @@ mod tests {
|
||||
tokens: 65,
|
||||
context: Some(61),
|
||||
tokens_per_second: None,
|
||||
prefill_ms: None,
|
||||
}]
|
||||
);
|
||||
assert_eq!(
|
||||
|
||||
Reference in new issue
Block a user