camsemianalsyis commited on
Commit
0ae681a
·
verified ·
1 Parent(s): f4138c2

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -58,3 +58,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
61
+ traces.jsonl filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ pretty_name: CC Traces — Weka, No-Subagents (May 12 2026)
4
+ task_categories:
5
+ - text-generation
6
+ tags:
7
+ - llm
8
+ - inference
9
+ - benchmarking
10
+ - kv-cache
11
+ - agentic
12
+ - multi-turn
13
+ - claude
14
+ size_categories:
15
+ - n<1K
16
+ configs:
17
+ - config_name: default
18
+ data_files:
19
+ - split: train
20
+ path: traces.jsonl
21
+ ---
22
+
23
+ # CC Traces — Weka, No-Subagents (May 12 2026)
24
+
25
+ A collection of **949 multi-turn agentic traces** (≈ 136.1 k individual
26
+ model requests) drawn from real production traffic against the Claude
27
+ Code CLI ≥ 2.1.139. Each trace captures the full request/response
28
+ sequence of a single agent session, including per-request KV block
29
+ hashes, so the dataset can be replayed against an inference engine or
30
+ used to simulate prefix-cache behavior offline.
31
+
32
+ **No-subagents variant.** This dataset is a derivative of the source
33
+ weka traces with all `WekaSubagentEntry` blocks stripped — only
34
+ top-level main-agent turns remain. The full-subagent companion variant
35
+ lives elsewhere. Use this corpus when you want a single
36
+ linear agent stream per trace and don't care about the parent / child
37
+ fan-out structure of agentic tool-calling.
38
+
39
+ - **Traces:** 949
40
+ - **Requests:** 136,118 total, mean **143.4** per trace, max **13,685**
41
+ - **Models:** `claude-opus-4-7` (most turns), `claude-haiku-4-5-20251001`,
42
+ `claude-opus-4-6`, `claude-sonnet-4-6`
43
+ - **KV block size:** 64 tokens
44
+ - **Hash scope:** `local` — block hash IDs are only comparable *within*
45
+ a single trace; they are not a global content-addressable identity.
46
+
47
+ ## Important: tokenizer caveat
48
+
49
+ The `in` field on each request and the `hash_ids` array are both
50
+ measured in **the proxy's tokenizer** (qwen3 / o200k_base — depends on
51
+ the originating trace_version), NOT Anthropic's BPE. Anthropic
52
+ typically reports ~60 % of the qwen3/o200k token count for the same
53
+ content. So the ISL numbers below are larger than what the Anthropic
54
+ API would have billed for the same prompt — but they're self-consistent
55
+ between `in` and `hash_ids`, which is what matters for KV-cache replay
56
+ simulation.
57
+
58
+ If you replay these traces against a real Claude (or Claude-like)
59
+ server, the server will re-tokenize the text and see ~Claude-equivalent
60
+ token counts, so cache-hit-rate measurements remain accurate.
61
+
62
+ ## What's in each trace
63
+
64
+ Top-level trace fields:
65
+
66
+ | field | type | description |
67
+ |-----------------|------------------|-----------------------------------------------------|
68
+ | `id` | str | Trace identifier (the proxy session id) |
69
+ | `models` | list[str] | Models used by the trace |
70
+ | `block_size` | int | KV block size used to derive `hash_ids` (64) |
71
+ | `hash_id_scope` | str | `local` — hash IDs are per-trace, not global |
72
+ | `requests` | list[object] | Ordered list of per-request records (main-agent only) |
73
+
74
+ Each entry in `requests` is:
75
+
76
+ | field | type | description |
77
+ |---------------|-----------|--------------------------------------------------------------------------|
78
+ | `t` | float | Seconds since start of trace |
79
+ | `type` | str | `n` (non-streaming) or `s` (streaming) |
80
+ | `model` | str | Target model for this request |
81
+ | `in` | int | Effective prompt tokens covered by `hash_ids` (proxy tokenizer) |
82
+ | `out` | int | Output tokens (Anthropic-reported) |
83
+ | `hash_ids` | list[int] | Per-trace local block-hash IDs for the input, one per 64-token block |
84
+ | `api_time` | float | End-to-end server time for this call (seconds) |
85
+ | `think_time` | float | Wall-clock gap from previous request's end (seconds) |
86
+ | `ttft` | float? | Time to first token (streaming requests only) |
87
+
88
+ `hash_ids` make the dataset unusually useful for KV-cache work: the
89
+ contiguous common prefix between turn *t* and turn *t − 1* exactly
90
+ measures the portion of the input that a local prefix cache would be
91
+ able to reuse.
92
+
93
+ ## Summary statistics
94
+
95
+ | | p50 | p75 | p90 | p95 | p99 | mean |
96
+ |------------------------------|---------:|---------:|---------:|---------:|---------:|---------:|
97
+ | ISL (tokens) | 123,952 | 245,124 | 391,085 | 490,478 | 720,485 | 178,018 |
98
+ | OSL (tokens) | 261 | 664 | 1,614 | 2,805 | 7,013 | 711 |
99
+ | `think_time` (s) | 1.29 | 2.92 | 54.97 | 181.78 | 1,887.83 | 351.34 |
100
+ | Turn depth (requests/trace) | 56 | 118 | 252 | 437 | 1,497 | 143 |
101
+ | Token growth per turn | 395 | 952 | 2,504 | 5,399 | 87,849 | 758 |
102
+ | Cache hit rate per request | 0.8404 | 0.9243 | 0.9678 | 0.9970 | 0.9995 | 0.7509 |
103
+
104
+ ### Why is "token growth per turn" sometimes negative?
105
+
106
+ Agentic prompts usually grow monotonically — each turn appends the
107
+ user's new message + assistant's reply to the running context, so the
108
+ next turn's `in` is at least as big as the previous. **But ~1% of
109
+ adjacent-turn deltas in this corpus are sharply negative** (Δin
110
+ < −100K tokens, often −500K to −800K). These are real production
111
+ events, not data errors: they're **context compaction**.
112
+
113
+ Claude Code (and similar agentic clients) summarize long conversations
114
+ when the context grows close to the model's limit, replacing dozens of
115
+ prior messages with a short summary. After that summary is committed,
116
+ the next turn's prompt drops from ~800K back to ~10–80K tokens — a
117
+ sharp negative delta. Some sessions in this corpus compact 10+ times
118
+ in a row, which produces clusters of large negative growth events
119
+ that are visible in the histogram's left tail.
120
+
121
+ If you're modeling raw prompt growth, treat negative deltas as
122
+ "context reset" events and either skip them or count them separately.
123
+ If you're modeling realistic agentic load, leave them in — they're
124
+ part of how long sessions stay under the context budget.
125
+
126
+ Mean per-request prefix-cache hit rate across the full corpus is
127
+ **~75 %**, with a strong mode near 1.0 (steady-state cache reuse) and a
128
+ secondary mass near 0 (cold-start / reset turns).
129
+
130
+ ## Plots
131
+
132
+ Combined 3×2 distributions with p50 / p75 / p90 / p99 percentile
133
+ markers on each panel. Two variants: log-x for the heavy-tailed
134
+ metrics, linear-x for the bounded ones.
135
+
136
+ ### Log-x
137
+
138
+ Best for the long-tailed distributions (think_time, ISL, OSL, turn
139
+ depth). Token growth stays linear (it has negative values from
140
+ context-compaction events).
141
+
142
+ ![Distributions — log x](plots/distributions_log.png)
143
+
144
+ ### Linear-x
145
+
146
+ Linear axes everywhere. Heavy tails clipped at p99 with a count of
147
+ clipped values in each panel's subtitle so they're not silently
148
+ dropped.
149
+
150
+ ![Distributions — linear x](plots/distributions_linear.png)
151
+
152
+ ## How this dataset was built
153
+
154
+ 1. **Sampled** from the SemiAnalysis Claude Code proxy database.
155
+ Filtered to: Anthropic models only (`model LIKE 'claude-%'`), HTTP
156
+ 200 + no proxy error, `privacy_mode = 'anon'` (request bodies are
157
+ redacted; metric columns are intact), and the post-2026-04-16
158
+ timeframe (after the `subagent_label` migration so subagent
159
+ classification is reliable).
160
+ 2. **Converted** flat per-row dumps into v1 weka format using the
161
+ conversation-view subagent grouping algorithm from the SemiAnalysis
162
+ claude-code-proxy. Hash IDs were remapped to per-trace local ints
163
+ (`hash_id_scope: "local"`).
164
+ 3. **Subagent entries removed.** This is the no-subagents variant of
165
+ the corpus, so every `WekaSubagentEntry` block was filtered out of
166
+ each trace's `requests` list. Traces that became empty after
167
+ filtering (entirely Agent-SDK or utility-only sessions) were
168
+ dropped.
169
+ 4. **Proxy-hash-bug outliers removed.** Sessions containing any
170
+ single row with `in > 1,000,000` proxy-tokens were dropped (25
171
+ sessions). These are confirmed proxy hashing artifacts (v1/v2/v4
172
+ over-count `hash_token_count` for sessions with document content
173
+ blocks or pre-v3 tool-call histories — not legitimate token sizes
174
+ that the model actually saw).
175
+
176
+ ## Intended uses
177
+
178
+ - **Inference benchmarking:** replay traces against a serving engine
179
+ (vLLM, SGLang, TRT-LLM, etc.) to measure throughput / latency under a
180
+ realistic agentic workload.
181
+ - **KV-cache research:** the `hash_ids` field exposes block-level
182
+ prefix structure directly without needing to re-tokenize any text.
183
+ - **Capacity planning:** the ISL / OSL / think-time / turn-depth
184
+ distributions are a reasonable first-order model of traffic from
185
+ long-context agentic clients.
186
+
187
+ ## Loading
188
+
189
+ ```python
190
+ from datasets import load_dataset
191
+
192
+ ds = load_dataset("semianalysisai/cc-traces-weka-no-subagents-051226", split="train")
193
+ print(ds[0]["id"], len(ds[0]["requests"]))
194
+ ```
195
+
196
+ ## License & attribution
197
+
198
+ Released under the **Apache 2.0** license.
plots/distributions_linear.png ADDED

Git LFS Details

  • SHA256: 781a468fa4bd05f3e5d66852f39d71498e44871360c099aa112c955c93ff4a7a
  • Pointer size: 131 Bytes
  • Size of remote file: 216 kB
plots/distributions_log.png ADDED

Git LFS Details

  • SHA256: ce3ef23b0f042fc19d7274158bdd1e446c8a13c6e2b2df8fb846a1fd35f9ff9a
  • Pointer size: 131 Bytes
  • Size of remote file: 211 kB
traces.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fcac6e738d3457dbb97e97168fec8b720b42bb281a44af1e933ab6cd01a4041d
3
+ size 2769297121