contambench 0.1.0__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.
- contambench-0.1.0/.gitignore +6 -0
- contambench-0.1.0/LICENSE +201 -0
- contambench-0.1.0/PKG-INFO +189 -0
- contambench-0.1.0/README.md +158 -0
- contambench-0.1.0/pyproject.toml +54 -0
- contambench-0.1.0/src/contambench/__init__.py +5 -0
- contambench-0.1.0/src/contambench/cli.py +245 -0
- contambench-0.1.0/src/contambench/data.py +142 -0
- contambench-0.1.0/src/contambench/examples/calibrate.yaml +20 -0
- contambench-0.1.0/src/contambench/examples/control_semantic_suffix.yaml +19 -0
- contambench-0.1.0/src/contambench/examples/output_caps.yaml +19 -0
- contambench-0.1.0/src/contambench/examples/simulate.yaml +18 -0
- contambench-0.1.0/src/contambench/examples/sweep.yaml +20 -0
- contambench-0.1.0/src/contambench/export.py +101 -0
- contambench-0.1.0/src/contambench/harness/__init__.py +0 -0
- contambench-0.1.0/src/contambench/harness/analysis/__init__.py +0 -0
- contambench-0.1.0/src/contambench/harness/analysis/calibrate.py +221 -0
- contambench-0.1.0/src/contambench/harness/analysis/calibrate_capacity.py +233 -0
- contambench-0.1.0/src/contambench/harness/analysis/capacity_util.py +73 -0
- contambench-0.1.0/src/contambench/harness/analysis/common.py +780 -0
- contambench-0.1.0/src/contambench/harness/arrival.py +95 -0
- contambench-0.1.0/src/contambench/harness/client.py +433 -0
- contambench-0.1.0/src/contambench/harness/config.py +222 -0
- contambench-0.1.0/src/contambench/harness/dataset.py +260 -0
- contambench-0.1.0/src/contambench/harness/experiment.py +402 -0
- contambench-0.1.0/src/contambench/harness/metrics.py +212 -0
- contambench-0.1.0/src/contambench/harness/simulate.py +126 -0
- contambench-0.1.0/src/contambench/harness/storage.py +380 -0
- contambench-0.1.0/src/contambench/harness/telemetry.py +400 -0
- contambench-0.1.0/src/contambench/harness/validation.py +193 -0
- contambench-0.1.0/src/contambench/harness/workload.py +356 -0
- contambench-0.1.0/src/contambench/report.py +104 -0
- contambench-0.1.0/src/contambench/schemas/contamination_export.schema.json +22 -0
- contambench-0.1.0/src/contambench/schemas/contamination_manifest.schema.json +33 -0
- contambench-0.1.0/src/contambench/schemas/request_trace.schema.json +44 -0
- contambench-0.1.0/src/contambench/schemas/stressor_pair.schema.json +21 -0
- contambench-0.1.0/src/contambench/score.py +112 -0
- contambench-0.1.0/tests/fixtures/pairs.json +72 -0
- contambench-0.1.0/tests/test_core.py +115 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Arman Chhetri, Yinxi Liu
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: contambench
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Stressor suites, labeled contaminated workloads, and reference measurements for testing LLM serving
|
|
5
|
+
Project-URL: Homepage, https://github.com/armanchhetri/contambench
|
|
6
|
+
Project-URL: Source, https://github.com/armanchhetri/contambench
|
|
7
|
+
Author-email: Arman Chhetri <ac7240@rit.edu>, Yinxi Liu <yxlics@rit.edu>
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: benchmark,dataset,llm,serving,stress testing,vllm
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Software Development :: Testing
|
|
16
|
+
Classifier: Topic :: System :: Benchmark
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Requires-Dist: matplotlib>=3.7
|
|
19
|
+
Requires-Dist: numpy>=1.24
|
|
20
|
+
Requires-Dist: pandas>=2.0
|
|
21
|
+
Requires-Dist: pyarrow>=14
|
|
22
|
+
Requires-Dist: pyyaml>=6
|
|
23
|
+
Requires-Dist: requests>=2.31
|
|
24
|
+
Requires-Dist: scipy>=1.10
|
|
25
|
+
Provides-Extra: guidellm
|
|
26
|
+
Requires-Dist: guidellm==0.7.1; extra == 'guidellm'
|
|
27
|
+
Provides-Extra: test
|
|
28
|
+
Requires-Dist: jsonschema>=4; extra == 'test'
|
|
29
|
+
Requires-Dist: pytest>=8; extra == 'test'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# contambench
|
|
33
|
+
|
|
34
|
+
`contambench` is the Python package for the ContamBench data record: stressor suites,
|
|
35
|
+
labeled contaminated workloads, and per-request reference measurements for testing
|
|
36
|
+
open-weight LLM serving stacks.
|
|
37
|
+
|
|
38
|
+
A *stressor* is a request whose suffix drives decoding to the output cap. *Workload
|
|
39
|
+
contamination* is the share `c` of stressors in a request stream; the term is unrelated
|
|
40
|
+
to training-data contamination. A small fraction of stressors can push co-located
|
|
41
|
+
benign requests past their latency objectives, and capacity tests that replay benign
|
|
42
|
+
prompt pools do not exercise this case.
|
|
43
|
+
|
|
44
|
+
The package fetches and verifies the record, writes labeled workloads at a chosen `c`,
|
|
45
|
+
runs YAML-configured campaigns against an endpoint you operate, and scores any run with
|
|
46
|
+
the SLO oracle used for the published results. It does not introduce a new
|
|
47
|
+
load-generation technique; it drives the bundled open-loop harness or GuideLLM.
|
|
48
|
+
|
|
49
|
+
- Data record: Zenodo, [doi:10.5281/zenodo.23482023](https://doi.org/10.5281/zenodo.23482023)
|
|
50
|
+
- Project page: to be added on publication
|
|
51
|
+
- Paper: *ContamBench: Stressor Suites and Contaminated Workload Traces for Testing LLM Serving*, ICSE 2027 Tool Demonstrations and Data Showcase (under review)
|
|
52
|
+
|
|
53
|
+
## Install
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install contambench # Python 3.10+, CPU only, no torch
|
|
57
|
+
pip install "contambench[guidellm]" # adds GuideLLM 0.7.1
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## 1. Get the data
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
contam-bench data fetch # all three products, ~630 MB, into ~/.cache/contambench/0.1.0
|
|
64
|
+
contam-bench data fetch --subset d1 # one product only: d1, d2, or d3
|
|
65
|
+
contam-bench data fetch --from DIR # copy from a local download of the record
|
|
66
|
+
contam-bench data status # what is present, and where
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Every file is checked against the record's `SHA256SUMS`. Set `CONTAMBENCH_DATA=DIR` to
|
|
70
|
+
use an extracted record somewhere else.
|
|
71
|
+
|
|
72
|
+
## 2. Reproduce the published tables
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
contam-bench report
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
`report` recomputes the stressor-suite table, the contamination sweep at the high
|
|
79
|
+
operating point of each deployment, and the GuideLLM reuse table from the request logs,
|
|
80
|
+
then compares the sweep with the published values. It runs on a CPU in a few seconds.
|
|
81
|
+
|
|
82
|
+
## 3. Work with the data, no GPU needed
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# a labeled workload at c = 0.10 from the Llama-3.2-3B suite; writes workload.csv and workload.manifest.json
|
|
86
|
+
contam-bench export --suite llama-3.2-3b-instruct --c 0.10 --out workload.csv
|
|
87
|
+
|
|
88
|
+
# score any run in the D3 format: violation rate, benign-only rate, benign tail inflation, Stage B
|
|
89
|
+
contam-bench score ~/.cache/contambench/0.1.0/d3_execution/runs/aws_qwen7b/rq2_sweep --arrival-rate 0.17
|
|
90
|
+
|
|
91
|
+
# copy the example campaign configurations into ./examples
|
|
92
|
+
contam-bench examples
|
|
93
|
+
|
|
94
|
+
# an offline campaign with synthetic latencies, to see the workflow end to end
|
|
95
|
+
contam-bench run --config examples/simulate.yaml
|
|
96
|
+
contam-bench score contambench-results/raw/<run_id>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Suites: `llama-3.2-3b-instruct`, `qwen2.5-7b-instruct`, `llama-3.1-8b-instruct`,
|
|
100
|
+
`mistral-7b-instruct-v0.3`, `qwen2.5-math-7b`. `export --k` sets how many top prompts by
|
|
101
|
+
Stage-A success rate the stressors are drawn from (default 50); `--benign FILE` uses your
|
|
102
|
+
own benign pool with the columns `prompt_id, prompt, success_rate`.
|
|
103
|
+
|
|
104
|
+
## 4. Test your own deployment
|
|
105
|
+
|
|
106
|
+
These steps send traffic to a live OpenAI-compatible endpoint and need the GPU behind
|
|
107
|
+
it. Run them only against systems you operate or are authorized to test. Set
|
|
108
|
+
`OPENAI_API_KEY` if your endpoint requires a key; keys are never written to the run logs.
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# optional: record vLLM scheduler state (queue depth, KV-cache use, preemptions) during the campaign
|
|
112
|
+
contam-bench telemetry --endpoint http://HOST:8000 --interval 1 --out contambench-results/vllm/metrics.jsonl &
|
|
113
|
+
|
|
114
|
+
# step 1: benign capacity calibration -> capacity and operating points at 60/80/90% of the plateau
|
|
115
|
+
contam-bench calibrate --config examples/calibrate.yaml --endpoint http://HOST:8000
|
|
116
|
+
|
|
117
|
+
# step 2: contamination sweep at the calibrated rates (edit arrival_rate in the YAML first)
|
|
118
|
+
contam-bench run --config examples/sweep.yaml --endpoint http://HOST:8000
|
|
119
|
+
|
|
120
|
+
# step 3: score it
|
|
121
|
+
contam-bench score contambench-results/raw/<run_id>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Report the Stage-B line of `score` together with any result. A suite that saturates in
|
|
125
|
+
isolation can still fail to reach the cap on your deployment; the Mistral-7B suite in
|
|
126
|
+
the record is an example.
|
|
127
|
+
|
|
128
|
+
### Example configurations (`contam-bench examples` copies them to `./examples`)
|
|
129
|
+
|
|
130
|
+
| File | Campaign |
|
|
131
|
+
|---|---|
|
|
132
|
+
| `simulate.yaml` | offline run with synthetic latencies |
|
|
133
|
+
| `calibrate.yaml` | benign arrival-rate sweep, 50 clients |
|
|
134
|
+
| `sweep.yaml` | c ∈ {0, 0.02, 0.05, 0.10, 0.15} at three arrival rates, three trials |
|
|
135
|
+
| `control_semantic_suffix.yaml` | a plain-language suffix in place of the optimized one |
|
|
136
|
+
| `output_caps.yaml` | the same workload under caps of 512, 1024, 2048, 4096 tokens |
|
|
137
|
+
|
|
138
|
+
The main keys are `attack_model` (resolves the D1 suite for that model in the fetched
|
|
139
|
+
record), `attack_file` (a file path, or `contambench:<path inside the record>`, for
|
|
140
|
+
example `contambench:d1_stressors/controls/random_suffix.json`), `workload_size`,
|
|
141
|
+
`contamination_ratio`, `num_clients`, `arrival_rate`, `arrival_model`,
|
|
142
|
+
`requests_per_client`, `num_trials`, `max_tokens`, `temperature`, `seed`, and
|
|
143
|
+
`auto_slo: true`, which takes the SLO budgets from the c = 0 trials of the same run.
|
|
144
|
+
Command-line options such as `--endpoint` override the file.
|
|
145
|
+
|
|
146
|
+
Each run writes `contambench-results/raw/<run_id>/` with `requests.parquet`,
|
|
147
|
+
`requests.csv`, and `metadata.json`, in the same format as the record's D3 runs.
|
|
148
|
+
|
|
149
|
+
## 5. Reuse a workload in GuideLLM
|
|
150
|
+
|
|
151
|
+
An exported CSV is a GuideLLM dataset file. Hold the client fixed, run once with the
|
|
152
|
+
benign pool and once with the contaminated export, and score both against the same
|
|
153
|
+
budgets:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
contam-bench export --suite llama-3.2-3b-instruct --c 0.10 --out workload.csv
|
|
157
|
+
contam-bench guidellm -- run \
|
|
158
|
+
--backend '{"kind": "openai_http", "target": "http://HOST:8000", "stream": true,
|
|
159
|
+
"extras": {"body": {"temperature": 0.7, "max_tokens": 4096}}}' \
|
|
160
|
+
--profile kind=poisson,rate=13.5 --constraint kind=max_requests,count=1000 \
|
|
161
|
+
--data '{"kind": "csv_file", "path": "workload.csv"}' \
|
|
162
|
+
--data-column-mapper '{"kind": "generative_column_mapper", "column_mappings": {"text_column": "prompt"}}' \
|
|
163
|
+
--output kind=json,path=guidellm_c0p10.json
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## The oracle
|
|
167
|
+
|
|
168
|
+
For each arrival rate, the budget of end-to-end latency, time to first token, and time
|
|
169
|
+
between tokens is the 99th percentile over the c = 0 requests of the same run. A request
|
|
170
|
+
violates when it exceeds any of the three. Rates are computed per trial and averaged,
|
|
171
|
+
with a Student-t 95% interval over trials.
|
|
172
|
+
|
|
173
|
+
## Not in this package
|
|
174
|
+
|
|
175
|
+
Stressor generation, LoopLLM suffix optimization against a new checkpoint, needs a GPU
|
|
176
|
+
workstation and is not included. A new suite needs Stage-A records from generation and
|
|
177
|
+
Stage-B records from a contamination sweep on the target deployment.
|
|
178
|
+
|
|
179
|
+
## Development
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
pip install -e ".[test]"
|
|
183
|
+
pytest # CPU tests; set CONTAMBENCH_DATA to also run the data checks
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## License
|
|
187
|
+
|
|
188
|
+
Code: Apache-2.0. The data record is CC BY-NC 4.0, because its benign prompts come from
|
|
189
|
+
Stanford Alpaca.
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# contambench
|
|
2
|
+
|
|
3
|
+
`contambench` is the Python package for the ContamBench data record: stressor suites,
|
|
4
|
+
labeled contaminated workloads, and per-request reference measurements for testing
|
|
5
|
+
open-weight LLM serving stacks.
|
|
6
|
+
|
|
7
|
+
A *stressor* is a request whose suffix drives decoding to the output cap. *Workload
|
|
8
|
+
contamination* is the share `c` of stressors in a request stream; the term is unrelated
|
|
9
|
+
to training-data contamination. A small fraction of stressors can push co-located
|
|
10
|
+
benign requests past their latency objectives, and capacity tests that replay benign
|
|
11
|
+
prompt pools do not exercise this case.
|
|
12
|
+
|
|
13
|
+
The package fetches and verifies the record, writes labeled workloads at a chosen `c`,
|
|
14
|
+
runs YAML-configured campaigns against an endpoint you operate, and scores any run with
|
|
15
|
+
the SLO oracle used for the published results. It does not introduce a new
|
|
16
|
+
load-generation technique; it drives the bundled open-loop harness or GuideLLM.
|
|
17
|
+
|
|
18
|
+
- Data record: Zenodo, [doi:10.5281/zenodo.23482023](https://doi.org/10.5281/zenodo.23482023)
|
|
19
|
+
- Project page: to be added on publication
|
|
20
|
+
- Paper: *ContamBench: Stressor Suites and Contaminated Workload Traces for Testing LLM Serving*, ICSE 2027 Tool Demonstrations and Data Showcase (under review)
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install contambench # Python 3.10+, CPU only, no torch
|
|
26
|
+
pip install "contambench[guidellm]" # adds GuideLLM 0.7.1
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 1. Get the data
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
contam-bench data fetch # all three products, ~630 MB, into ~/.cache/contambench/0.1.0
|
|
33
|
+
contam-bench data fetch --subset d1 # one product only: d1, d2, or d3
|
|
34
|
+
contam-bench data fetch --from DIR # copy from a local download of the record
|
|
35
|
+
contam-bench data status # what is present, and where
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Every file is checked against the record's `SHA256SUMS`. Set `CONTAMBENCH_DATA=DIR` to
|
|
39
|
+
use an extracted record somewhere else.
|
|
40
|
+
|
|
41
|
+
## 2. Reproduce the published tables
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
contam-bench report
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`report` recomputes the stressor-suite table, the contamination sweep at the high
|
|
48
|
+
operating point of each deployment, and the GuideLLM reuse table from the request logs,
|
|
49
|
+
then compares the sweep with the published values. It runs on a CPU in a few seconds.
|
|
50
|
+
|
|
51
|
+
## 3. Work with the data, no GPU needed
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# a labeled workload at c = 0.10 from the Llama-3.2-3B suite; writes workload.csv and workload.manifest.json
|
|
55
|
+
contam-bench export --suite llama-3.2-3b-instruct --c 0.10 --out workload.csv
|
|
56
|
+
|
|
57
|
+
# score any run in the D3 format: violation rate, benign-only rate, benign tail inflation, Stage B
|
|
58
|
+
contam-bench score ~/.cache/contambench/0.1.0/d3_execution/runs/aws_qwen7b/rq2_sweep --arrival-rate 0.17
|
|
59
|
+
|
|
60
|
+
# copy the example campaign configurations into ./examples
|
|
61
|
+
contam-bench examples
|
|
62
|
+
|
|
63
|
+
# an offline campaign with synthetic latencies, to see the workflow end to end
|
|
64
|
+
contam-bench run --config examples/simulate.yaml
|
|
65
|
+
contam-bench score contambench-results/raw/<run_id>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Suites: `llama-3.2-3b-instruct`, `qwen2.5-7b-instruct`, `llama-3.1-8b-instruct`,
|
|
69
|
+
`mistral-7b-instruct-v0.3`, `qwen2.5-math-7b`. `export --k` sets how many top prompts by
|
|
70
|
+
Stage-A success rate the stressors are drawn from (default 50); `--benign FILE` uses your
|
|
71
|
+
own benign pool with the columns `prompt_id, prompt, success_rate`.
|
|
72
|
+
|
|
73
|
+
## 4. Test your own deployment
|
|
74
|
+
|
|
75
|
+
These steps send traffic to a live OpenAI-compatible endpoint and need the GPU behind
|
|
76
|
+
it. Run them only against systems you operate or are authorized to test. Set
|
|
77
|
+
`OPENAI_API_KEY` if your endpoint requires a key; keys are never written to the run logs.
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# optional: record vLLM scheduler state (queue depth, KV-cache use, preemptions) during the campaign
|
|
81
|
+
contam-bench telemetry --endpoint http://HOST:8000 --interval 1 --out contambench-results/vllm/metrics.jsonl &
|
|
82
|
+
|
|
83
|
+
# step 1: benign capacity calibration -> capacity and operating points at 60/80/90% of the plateau
|
|
84
|
+
contam-bench calibrate --config examples/calibrate.yaml --endpoint http://HOST:8000
|
|
85
|
+
|
|
86
|
+
# step 2: contamination sweep at the calibrated rates (edit arrival_rate in the YAML first)
|
|
87
|
+
contam-bench run --config examples/sweep.yaml --endpoint http://HOST:8000
|
|
88
|
+
|
|
89
|
+
# step 3: score it
|
|
90
|
+
contam-bench score contambench-results/raw/<run_id>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Report the Stage-B line of `score` together with any result. A suite that saturates in
|
|
94
|
+
isolation can still fail to reach the cap on your deployment; the Mistral-7B suite in
|
|
95
|
+
the record is an example.
|
|
96
|
+
|
|
97
|
+
### Example configurations (`contam-bench examples` copies them to `./examples`)
|
|
98
|
+
|
|
99
|
+
| File | Campaign |
|
|
100
|
+
|---|---|
|
|
101
|
+
| `simulate.yaml` | offline run with synthetic latencies |
|
|
102
|
+
| `calibrate.yaml` | benign arrival-rate sweep, 50 clients |
|
|
103
|
+
| `sweep.yaml` | c ∈ {0, 0.02, 0.05, 0.10, 0.15} at three arrival rates, three trials |
|
|
104
|
+
| `control_semantic_suffix.yaml` | a plain-language suffix in place of the optimized one |
|
|
105
|
+
| `output_caps.yaml` | the same workload under caps of 512, 1024, 2048, 4096 tokens |
|
|
106
|
+
|
|
107
|
+
The main keys are `attack_model` (resolves the D1 suite for that model in the fetched
|
|
108
|
+
record), `attack_file` (a file path, or `contambench:<path inside the record>`, for
|
|
109
|
+
example `contambench:d1_stressors/controls/random_suffix.json`), `workload_size`,
|
|
110
|
+
`contamination_ratio`, `num_clients`, `arrival_rate`, `arrival_model`,
|
|
111
|
+
`requests_per_client`, `num_trials`, `max_tokens`, `temperature`, `seed`, and
|
|
112
|
+
`auto_slo: true`, which takes the SLO budgets from the c = 0 trials of the same run.
|
|
113
|
+
Command-line options such as `--endpoint` override the file.
|
|
114
|
+
|
|
115
|
+
Each run writes `contambench-results/raw/<run_id>/` with `requests.parquet`,
|
|
116
|
+
`requests.csv`, and `metadata.json`, in the same format as the record's D3 runs.
|
|
117
|
+
|
|
118
|
+
## 5. Reuse a workload in GuideLLM
|
|
119
|
+
|
|
120
|
+
An exported CSV is a GuideLLM dataset file. Hold the client fixed, run once with the
|
|
121
|
+
benign pool and once with the contaminated export, and score both against the same
|
|
122
|
+
budgets:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
contam-bench export --suite llama-3.2-3b-instruct --c 0.10 --out workload.csv
|
|
126
|
+
contam-bench guidellm -- run \
|
|
127
|
+
--backend '{"kind": "openai_http", "target": "http://HOST:8000", "stream": true,
|
|
128
|
+
"extras": {"body": {"temperature": 0.7, "max_tokens": 4096}}}' \
|
|
129
|
+
--profile kind=poisson,rate=13.5 --constraint kind=max_requests,count=1000 \
|
|
130
|
+
--data '{"kind": "csv_file", "path": "workload.csv"}' \
|
|
131
|
+
--data-column-mapper '{"kind": "generative_column_mapper", "column_mappings": {"text_column": "prompt"}}' \
|
|
132
|
+
--output kind=json,path=guidellm_c0p10.json
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## The oracle
|
|
136
|
+
|
|
137
|
+
For each arrival rate, the budget of end-to-end latency, time to first token, and time
|
|
138
|
+
between tokens is the 99th percentile over the c = 0 requests of the same run. A request
|
|
139
|
+
violates when it exceeds any of the three. Rates are computed per trial and averaged,
|
|
140
|
+
with a Student-t 95% interval over trials.
|
|
141
|
+
|
|
142
|
+
## Not in this package
|
|
143
|
+
|
|
144
|
+
Stressor generation, LoopLLM suffix optimization against a new checkpoint, needs a GPU
|
|
145
|
+
workstation and is not included. A new suite needs Stage-A records from generation and
|
|
146
|
+
Stage-B records from a contamination sweep on the target deployment.
|
|
147
|
+
|
|
148
|
+
## Development
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
pip install -e ".[test]"
|
|
152
|
+
pytest # CPU tests; set CONTAMBENCH_DATA to also run the data checks
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
|
|
157
|
+
Code: Apache-2.0. The data record is CC BY-NC 4.0, because its benign prompts come from
|
|
158
|
+
Stanford Alpaca.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.24"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "contambench"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Stressor suites, labeled contaminated workloads, and reference measurements for testing LLM serving"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "Arman Chhetri", email = "ac7240@rit.edu" },
|
|
15
|
+
{ name = "Yinxi Liu", email = "yxlics@rit.edu" },
|
|
16
|
+
]
|
|
17
|
+
keywords = ["llm", "serving", "vllm", "stress testing", "benchmark", "dataset"]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Development Status :: 4 - Beta",
|
|
20
|
+
"Intended Audience :: Science/Research",
|
|
21
|
+
"Intended Audience :: Developers",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Topic :: Software Development :: Testing",
|
|
24
|
+
"Topic :: System :: Benchmark",
|
|
25
|
+
]
|
|
26
|
+
dependencies = [
|
|
27
|
+
"numpy>=1.24",
|
|
28
|
+
"pandas>=2.0",
|
|
29
|
+
"pyarrow>=14",
|
|
30
|
+
"scipy>=1.10",
|
|
31
|
+
"pyyaml>=6",
|
|
32
|
+
"requests>=2.31",
|
|
33
|
+
"matplotlib>=3.7",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[project.optional-dependencies]
|
|
37
|
+
guidellm = ["guidellm==0.7.1"]
|
|
38
|
+
test = ["pytest>=8", "jsonschema>=4"]
|
|
39
|
+
|
|
40
|
+
[project.scripts]
|
|
41
|
+
contam-bench = "contambench.cli:main"
|
|
42
|
+
|
|
43
|
+
[project.urls]
|
|
44
|
+
Homepage = "https://github.com/armanchhetri/contambench"
|
|
45
|
+
Source = "https://github.com/armanchhetri/contambench"
|
|
46
|
+
|
|
47
|
+
[tool.hatch.build.targets.wheel]
|
|
48
|
+
packages = ["src/contambench"]
|
|
49
|
+
|
|
50
|
+
[tool.hatch.build.targets.sdist]
|
|
51
|
+
include = ["src/contambench", "tests", "README.md", "LICENSE", "pyproject.toml"]
|
|
52
|
+
|
|
53
|
+
[tool.pytest.ini_options]
|
|
54
|
+
testpaths = ["tests"]
|