llm-cachecheck 0.2.1__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: llm-cachecheck
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Measure how often the prompt cache changes greedy answers on your LLM server (llama.cpp, plus an experimental two-server mode for vLLM and SGLang)
5
5
  Project-URL: Homepage, https://github.com/aditi-p31/cache-divergence-study/tree/main/cachecheck
6
6
  Project-URL: Source, https://github.com/aditi-p31/cache-divergence-study
@@ -152,6 +152,13 @@ your results:
152
152
  A difference is not a bug in your model. It shows that the answer depends on
153
153
  the server's cache state as well as on the request.
154
154
 
155
+ ## Share your result
156
+
157
+ At the end of a run the tool prints a short result block. It leaves out your
158
+ server URL and any key. If you would like to share it, open a
159
+ [result issue](https://github.com/aditi-p31/cache-divergence-study/issues/new?template=cachecheck-result.yml)
160
+ and paste the block. Results where no probe differed are just as useful.
161
+
155
162
  ## Background and citation
156
163
 
157
164
  `cachecheck` adapts the paired cache-on and cache-off design of the study in
@@ -128,6 +128,13 @@ your results:
128
128
  A difference is not a bug in your model. It shows that the answer depends on
129
129
  the server's cache state as well as on the request.
130
130
 
131
+ ## Share your result
132
+
133
+ At the end of a run the tool prints a short result block. It leaves out your
134
+ server URL and any key. If you would like to share it, open a
135
+ [result issue](https://github.com/aditi-p31/cache-divergence-study/issues/new?template=cachecheck-result.yml)
136
+ and paste the block. Results where no probe differed are just as useful.
137
+
131
138
  ## Background and citation
132
139
 
133
140
  `cachecheck` adapts the paired cache-on and cache-off design of the study in
@@ -41,10 +41,11 @@ import binascii
41
41
  import json
42
42
  import os
43
43
  import sys
44
+ import time
44
45
  import urllib.error
45
46
  import urllib.request
46
47
 
47
- __version__ = "0.2.1"
48
+ __version__ = "0.2.2"
48
49
 
49
50
  CITATION = (
50
51
  "Patodiya, A. Same Request, Different Answer: Quantization Amplifies "
@@ -54,6 +55,9 @@ CITATION = (
54
55
 
55
56
  MIN_VALID_SHARE = 0.8
56
57
 
58
+ SHARE_URL = ("https://github.com/aditi-p31/cache-divergence-study/issues/new"
59
+ "?template=cachecheck-result.yml")
60
+
57
61
  # Two-turn probes. Turn 1 asks for a worked answer of a few sentences, so
58
62
  # the server writes a useful amount of KV state while generating it.
59
63
  # Turn 2 builds on that answer, so it is processed on top of that state.
@@ -305,6 +309,29 @@ def server_props(args):
305
309
  "model_file": os.path.basename(props.get("model_path") or "")}
306
310
 
307
311
 
312
+ def result_block(args, props, summary, when):
313
+ """A short, copyable summary of the run. It leaves out the server URL
314
+ and any key, so it is safe to paste in public."""
315
+ build = props.get("build_info") or "(fill in engine and version)"
316
+ model = args.model or props.get("model_file") or "(fill in model)"
317
+ lines = [
318
+ "---- llm-cachecheck result ----",
319
+ "tool: llm-cachecheck %s" % __version__,
320
+ "date (UTC): %s" % when,
321
+ "mode: %s" % args.mode,
322
+ "engine build: %s" % build,
323
+ "model: %s" % model,
324
+ "GPU or CPU: (fill in)",
325
+ "probes: %d planned, %d valid, %d differed" % (
326
+ summary["probes_planned"], summary["probes_valid"],
327
+ summary["probes_diverged"]),
328
+ "max tokens: %d, seed: %d, hit check: %s" % (
329
+ args.max_tokens, args.seed, summary["hit_check"]),
330
+ "-------------------------------",
331
+ ]
332
+ return "\n".join(lines)
333
+
334
+
308
335
  def status_line(r):
309
336
  if not r["valid"]:
310
337
  return "inconclusive (%s)" % "; ".join(r["problems"])
@@ -414,6 +441,10 @@ def main(argv=None):
414
441
  if args.skip_hit_check:
415
442
  print("Cache hits were assumed, not confirmed (--skip-hit-check).")
416
443
  print("Report written to %s" % args.out)
444
+ print()
445
+ print(result_block(args, props, summary,
446
+ time.strftime("%Y-%m-%d %H:%M", time.gmtime())))
447
+ print("To share this result (optional), open: " + SHARE_URL)
417
448
  print("Method: " + CITATION)
418
449
 
419
450
  if diverged:
@@ -162,6 +162,16 @@ class CacheCheckTests(unittest.TestCase):
162
162
  self.assertIn("DIFFERENT (from character", out)
163
163
  self.assertIn("3 of 3 valid probes gave a different", out)
164
164
 
165
+ def test_result_block_is_printed_and_safe_to_share(self):
166
+ server = self.server(diverge=True)
167
+ code, report, out = self.run_tool(server)
168
+ self.assertIn("---- llm-cachecheck result ----", out)
169
+ self.assertIn("engine build: b-fake", out)
170
+ self.assertIn("probes: 3 planned, 3 valid, 3 differed", out)
171
+ self.assertIn(cachecheck.SHARE_URL, out)
172
+ block = out.split("---- llm-cachecheck result ----")[1]
173
+ self.assertNotIn(server.url, block)
174
+
165
175
  def test_divergence_in_reasoning_only(self):
166
176
  code, report, out = self.run_tool(self.server(diverge_reasoning=True))
167
177
  self.assertEqual(code, 1)
File without changes