inference-perf 0.1.1__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.
Files changed (58) hide show
  1. inference_perf-0.1.1/LICENSE +201 -0
  2. inference_perf-0.1.1/PKG-INFO +232 -0
  3. inference_perf-0.1.1/README.md +206 -0
  4. inference_perf-0.1.1/inference_perf/__init__.py +16 -0
  5. inference_perf-0.1.1/inference_perf/analysis/__init__.py +17 -0
  6. inference_perf-0.1.1/inference_perf/analysis/analyze.py +276 -0
  7. inference_perf-0.1.1/inference_perf/apis/__init__.py +26 -0
  8. inference_perf-0.1.1/inference_perf/apis/base.py +60 -0
  9. inference_perf-0.1.1/inference_perf/apis/chat.py +64 -0
  10. inference_perf-0.1.1/inference_perf/apis/completion.py +78 -0
  11. inference_perf-0.1.1/inference_perf/client/filestorage/__init__.py +20 -0
  12. inference_perf-0.1.1/inference_perf/client/filestorage/base.py +31 -0
  13. inference_perf-0.1.1/inference_perf/client/filestorage/gcs.py +55 -0
  14. inference_perf-0.1.1/inference_perf/client/filestorage/local.py +38 -0
  15. inference_perf-0.1.1/inference_perf/client/filestorage/s3.py +59 -0
  16. inference_perf-0.1.1/inference_perf/client/metricsclient/__init__.py +17 -0
  17. inference_perf-0.1.1/inference_perf/client/metricsclient/base.py +72 -0
  18. inference_perf-0.1.1/inference_perf/client/metricsclient/mock_client.py +28 -0
  19. inference_perf-0.1.1/inference_perf/client/metricsclient/prometheus_client/__init__.py +18 -0
  20. inference_perf-0.1.1/inference_perf/client/metricsclient/prometheus_client/base.py +284 -0
  21. inference_perf-0.1.1/inference_perf/client/metricsclient/prometheus_client/google_managed_prometheus_client.py +43 -0
  22. inference_perf-0.1.1/inference_perf/client/modelserver/__init__.py +19 -0
  23. inference_perf-0.1.1/inference_perf/client/modelserver/base.py +78 -0
  24. inference_perf-0.1.1/inference_perf/client/modelserver/mock_client.py +52 -0
  25. inference_perf-0.1.1/inference_perf/client/modelserver/vllm_client.py +245 -0
  26. inference_perf-0.1.1/inference_perf/client/requestdatacollector/__init__.py +23 -0
  27. inference_perf-0.1.1/inference_perf/client/requestdatacollector/base.py +31 -0
  28. inference_perf-0.1.1/inference_perf/client/requestdatacollector/local.py +30 -0
  29. inference_perf-0.1.1/inference_perf/client/requestdatacollector/multiprocess.py +56 -0
  30. inference_perf-0.1.1/inference_perf/config.py +193 -0
  31. inference_perf-0.1.1/inference_perf/datagen/__init__.py +28 -0
  32. inference_perf-0.1.1/inference_perf/datagen/base.py +66 -0
  33. inference_perf-0.1.1/inference_perf/datagen/hf_sharegpt_datagen.py +94 -0
  34. inference_perf-0.1.1/inference_perf/datagen/mock_datagen.py +43 -0
  35. inference_perf-0.1.1/inference_perf/datagen/random_datagen.py +105 -0
  36. inference_perf-0.1.1/inference_perf/datagen/shared_prefix_datagen.py +99 -0
  37. inference_perf-0.1.1/inference_perf/datagen/synthetic_datagen.py +591 -0
  38. inference_perf-0.1.1/inference_perf/loadgen/__init__.py +16 -0
  39. inference_perf-0.1.1/inference_perf/loadgen/load_generator.py +212 -0
  40. inference_perf-0.1.1/inference_perf/loadgen/load_timer.py +78 -0
  41. inference_perf-0.1.1/inference_perf/logger.py +35 -0
  42. inference_perf-0.1.1/inference_perf/main.py +244 -0
  43. inference_perf-0.1.1/inference_perf/reportgen/__init__.py +16 -0
  44. inference_perf-0.1.1/inference_perf/reportgen/base.py +272 -0
  45. inference_perf-0.1.1/inference_perf/utils/__init__.py +17 -0
  46. inference_perf-0.1.1/inference_perf/utils/custom_tokenizer.py +30 -0
  47. inference_perf-0.1.1/inference_perf/utils/distribution.py +60 -0
  48. inference_perf-0.1.1/inference_perf/utils/report_file.py +30 -0
  49. inference_perf-0.1.1/inference_perf.egg-info/PKG-INFO +232 -0
  50. inference_perf-0.1.1/inference_perf.egg-info/SOURCES.txt +56 -0
  51. inference_perf-0.1.1/inference_perf.egg-info/dependency_links.txt +1 -0
  52. inference_perf-0.1.1/inference_perf.egg-info/entry_points.txt +2 -0
  53. inference_perf-0.1.1/inference_perf.egg-info/requires.txt +18 -0
  54. inference_perf-0.1.1/inference_perf.egg-info/top_level.txt +2 -0
  55. inference_perf-0.1.1/pyproject.toml +127 -0
  56. inference_perf-0.1.1/setup.cfg +4 -0
  57. inference_perf-0.1.1/tests/test_config.py +34 -0
  58. inference_perf-0.1.1/tests/test_logger.py +26 -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 {yyyy} {name of copyright owner}
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,232 @@
1
+ Metadata-Version: 2.4
2
+ Name: inference-perf
3
+ Version: 0.1.1
4
+ Summary: A GenAI inference performance benchmarking tool.
5
+ License: Apache-2.0
6
+ Requires-Python: >=3.12
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: aiohttp>=3.11.11
10
+ Requires-Dist: pydantic>=2.10.6
11
+ Requires-Dist: numpy>=2.2.2
12
+ Requires-Dist: datasets>=3.3.2
13
+ Requires-Dist: transformers>=4.50.2
14
+ Requires-Dist: google-cloud-storage>=3.1.0
15
+ Requires-Dist: pyyaml>=6.0.2
16
+ Requires-Dist: boto3>=1.39.0
17
+ Provides-Extra: analysis
18
+ Requires-Dist: matplotlib>=3.9.0; extra == "analysis"
19
+ Provides-Extra: dev
20
+ Requires-Dist: mypy>=1.14.1; extra == "dev"
21
+ Requires-Dist: ruff>=0.9.4; extra == "dev"
22
+ Requires-Dist: pre-commit>=4.1.0; extra == "dev"
23
+ Requires-Dist: pytest>=8.3.4; extra == "dev"
24
+ Requires-Dist: ipykernel>=6.29.5; extra == "dev"
25
+ Dynamic: license-file
26
+
27
+ # Inference Perf
28
+
29
+ Inference Perf is a GenAI inference performance benchmarking tool. It came out of [wg-serving](https://github.com/kubernetes/community/tree/master/wg-serving) and is sponsored by [SIG Scalability](https://github.com/kubernetes/community/blob/master/sig-scalability/README.md#inference-perf). Original proposal can be found [here](https://github.com/kubernetes-sigs/wg-serving/tree/main/proposals/013-inference-perf).
30
+
31
+ ## Architecture
32
+
33
+ ![Architecture Diagram](docs/images/architecture.png)
34
+
35
+ ## Key Features
36
+
37
+ * Highly scalable and can support benchmarking large inference production deployments.
38
+ * Reports the key metrics needed to measure LLM performance.
39
+ * Supports different real world and synthetic datasets.
40
+ * Supports different APIs and can support multiple model servers.
41
+ * Supports specifying an exact input and output distribution to simulate different scenarios - Gaussian distribution, fixed length, min-max cases are all supported.
42
+ * Generates different load patterns and can benchmark specific cases like burst traffic, scaling to saturation and other autoscaling / routing scenarios.
43
+
44
+ ## Roadmap
45
+
46
+ * Accelerator metrics collection during benchmarks (GPU utilization, memory usage, power usage, etc.).
47
+ * Support for more model servers.
48
+ * Deployment API to help deploy different inference stacks.
49
+ * Traffic splitting among different use cases or LoRA adapters.
50
+ * Support for benchmarking non-LLM GenAI use cases.
51
+ * Support for different datasets to simulate real world use cases.
52
+ * Replaying traffic from production systems.
53
+
54
+ ## Getting Started
55
+
56
+ ### Run locally
57
+
58
+ - Setup a virtual environment and install inference-perf
59
+
60
+ ```
61
+ pip install .
62
+ ```
63
+
64
+ - Run inference-perf CLI with a configuration file
65
+
66
+ ```
67
+ inference-perf --config_file config.yml
68
+ ```
69
+
70
+ - See more [examples](./examples/)
71
+
72
+ ### Run in a Docker container
73
+
74
+ - Build the container
75
+
76
+ ```
77
+ docker build -t inference-perf .
78
+ ```
79
+
80
+ - Run the container
81
+
82
+ ```
83
+ docker run -it --rm -v $(pwd)/config.yml:/workspace/config.yml inference-perf
84
+
85
+ ```
86
+
87
+ ### Run in a Kubernetes cluster
88
+
89
+ Refer to the [guide](./deploy/README.md) in `/deploy`.
90
+
91
+ ## Configuration
92
+
93
+ You can configure inference-perf to run with different data generation and load generation configurations today. Please see `config.yml` and examples in `/examples`.
94
+
95
+ Refer to the [CONFIG.md](./CONFIG.md) for documentation on all supported configuration options.
96
+
97
+ ### Datasets
98
+
99
+ Supported datasets include the following:
100
+ - [ShareGPT](./examples/vllm/config.yml) (for a real world conversational dataset)
101
+ - [Synthetic](./examples/vllm/config-synthetic.yml) (for specific input / output distributions with Sonnet data)
102
+ - [Random](./examples/vllm/config-random.yml) (for specific input / output distributions with random data)
103
+ - [SharedPrefix](./examples/vllm/config-shared-prefix.yml) (for prefix caching scenarios)
104
+ - mock (for testing)
105
+
106
+ ### Load Generators
107
+
108
+ Multiple load generators are supported:
109
+ - Poisson / constant-time load generation to send specific QPS.
110
+ - Multi-process load generation for increased concurrency and higher QPS.
111
+
112
+ Multiple load patterns can be specified:
113
+ - Stages with configurable duration and QPS along with specific timeouts in between them allows you to simulate different load patterns like burst in traffic, constantly increasing load till hardware saturation, etc.
114
+
115
+ ### API
116
+
117
+ OpenAI completion and chat completion APIs are supported. It can be pointed to any endpoints which support these APIs - currently verified against vLLM deployments. Other APIs and model server support can be added easily.
118
+
119
+ ### Metrics
120
+
121
+ Different latency and throughput metrics to analyze the performance of different LLM workloads are reported. A snippet from an example report is below.
122
+ ```
123
+ "latency": {
124
+ "request_latency": {
125
+ "mean": 3.31325431142327,
126
+ "min": 1.62129471905064,
127
+ "p10": 1.67609986825846,
128
+ "p50": 2.11507539497688,
129
+ "p90": 5.94717199734878,
130
+ "max": 6.30658466403838
131
+ },
132
+ "normalized_time_per_output_token": {
133
+ "mean": 0.104340420636009,
134
+ "min": 0.0506654599703325,
135
+ "p10": 0.0523781208830769,
136
+ "p50": 0.0670631669655753,
137
+ "p90": 0.189047570470012,
138
+ "max": 0.20343821496898
139
+ },
140
+ "time_per_output_token": {
141
+ "mean": 0.0836929455635872,
142
+ "min": 0.0517028436646797,
143
+ "p10": 0.0530815053513894,
144
+ "p50": 0.0611870964678625,
145
+ "p90": 0.152292036800645,
146
+ "max": 0.17837208439984
147
+ },
148
+ "time_to_first_token": {
149
+ "mean": 0.800974442732916,
150
+ "min": 0.0625283779809251,
151
+ "p10": 0.072068731742911,
152
+ "p50": 0.203539535985328,
153
+ "p90": 2.26959549135063,
154
+ "max": 4.46773961000145
155
+ },
156
+ "inter_token_latency": {
157
+ "mean": 0.0836929455635872,
158
+ "min": 0.000007129972800612,
159
+ "p10": 0.0534287681337446,
160
+ "p50": 0.0591336835059337,
161
+ "p90": 0.084046097996179,
162
+ "max": 0.614475268055685
163
+ }
164
+ },
165
+ "throughput": {
166
+ "input_tokens_per_sec": 643.576644186323,
167
+ "output_tokens_per_sec": 32.544923821416,
168
+ "total_tokens_per_sec": 676.121568007739,
169
+ "requests_per_sec": 1.0238155253639
170
+ },
171
+ "prompt_len": {
172
+ "mean": 628.606060606061,
173
+ "min": 4,
174
+ "p10": 11.4,
175
+ "p50": 364,
176
+ "p90": 2427.6,
177
+ "max": 3836
178
+ },
179
+ "output_len": {
180
+ "mean": 31.7878787878788,
181
+ "min": 30,
182
+ "p10": 31,
183
+ "p50": 32,
184
+ "p90": 32,
185
+ "max": 32
186
+ }
187
+ ```
188
+
189
+ ### Reports
190
+
191
+ Reports are generated in JSON format.
192
+ - Per stage reports for individual request rates.
193
+ - Summary reports for the overall run.
194
+ - Request logs / traces for further analysis.
195
+
196
+ Model server metrics reports from Prometheus collected during the run is also produced.
197
+ - Model server specific metrics like queue size, batch size, latency metrics, etc.
198
+ - Supports querying metrics from OSS Prometheus and Google Managed Prometheus.
199
+
200
+ ## Analysis
201
+
202
+ Reports can be analyzed using the following command:
203
+
204
+ ```
205
+ inference-perf --analyze <path-to-dir-with-reports>
206
+ ```
207
+
208
+ This should generate the following charts (below charts are for example only):
209
+
210
+ 1. QPS vs Latency (TTFT, NTPOT, ITL)
211
+
212
+ ![qps-latency-chart](./docs/images/latency_vs_qps.png)
213
+
214
+ 2. QPS vs Throughput (input tokens / sec, output tokens / sec, total tokens / sec)
215
+
216
+ ![qps-throughput-chart](./docs/images/throughput_vs_qps.png)
217
+
218
+ 3. Latency vs Throughput (output tokens / sec vs TTFT, NTPOT and ITL)
219
+
220
+ ![latency-throughput-chart](./docs/images/throughput_vs_latency.png)
221
+
222
+ ## Contributing
223
+
224
+ Our community meeting is weekly on Thursdays alternating betweem 09:00 and 11:30 PDT ([Zoom Link](https://zoom.us/j/9955436256?pwd=Z2FQWU1jeDZkVC9RRTN4TlZyZTBHZz09), [Meeting Notes](https://docs.google.com/document/d/15XSF8q4DShcXIiExDfyiXxAYQslCmOmO2ARSJErVTak/edit?usp=sharing), [Meeting Recordings](https://www.youtube.com/playlist?list=PL69nYSiGNLP30qNanabU75ayPK7OPNAAS)).
225
+
226
+ We currently utilize the [#inference-perf](https://kubernetes.slack.com/?redir=%2Fmessages%2Finference-perf) channel in Kubernetes Slack workspace for communications.
227
+
228
+ Contributions are welcomed, thanks for joining us!
229
+
230
+ ### Code of conduct
231
+
232
+ Participation in the Kubernetes community is governed by the [Kubernetes Code of Conduct](code-of-conduct.md).
@@ -0,0 +1,206 @@
1
+ # Inference Perf
2
+
3
+ Inference Perf is a GenAI inference performance benchmarking tool. It came out of [wg-serving](https://github.com/kubernetes/community/tree/master/wg-serving) and is sponsored by [SIG Scalability](https://github.com/kubernetes/community/blob/master/sig-scalability/README.md#inference-perf). Original proposal can be found [here](https://github.com/kubernetes-sigs/wg-serving/tree/main/proposals/013-inference-perf).
4
+
5
+ ## Architecture
6
+
7
+ ![Architecture Diagram](docs/images/architecture.png)
8
+
9
+ ## Key Features
10
+
11
+ * Highly scalable and can support benchmarking large inference production deployments.
12
+ * Reports the key metrics needed to measure LLM performance.
13
+ * Supports different real world and synthetic datasets.
14
+ * Supports different APIs and can support multiple model servers.
15
+ * Supports specifying an exact input and output distribution to simulate different scenarios - Gaussian distribution, fixed length, min-max cases are all supported.
16
+ * Generates different load patterns and can benchmark specific cases like burst traffic, scaling to saturation and other autoscaling / routing scenarios.
17
+
18
+ ## Roadmap
19
+
20
+ * Accelerator metrics collection during benchmarks (GPU utilization, memory usage, power usage, etc.).
21
+ * Support for more model servers.
22
+ * Deployment API to help deploy different inference stacks.
23
+ * Traffic splitting among different use cases or LoRA adapters.
24
+ * Support for benchmarking non-LLM GenAI use cases.
25
+ * Support for different datasets to simulate real world use cases.
26
+ * Replaying traffic from production systems.
27
+
28
+ ## Getting Started
29
+
30
+ ### Run locally
31
+
32
+ - Setup a virtual environment and install inference-perf
33
+
34
+ ```
35
+ pip install .
36
+ ```
37
+
38
+ - Run inference-perf CLI with a configuration file
39
+
40
+ ```
41
+ inference-perf --config_file config.yml
42
+ ```
43
+
44
+ - See more [examples](./examples/)
45
+
46
+ ### Run in a Docker container
47
+
48
+ - Build the container
49
+
50
+ ```
51
+ docker build -t inference-perf .
52
+ ```
53
+
54
+ - Run the container
55
+
56
+ ```
57
+ docker run -it --rm -v $(pwd)/config.yml:/workspace/config.yml inference-perf
58
+
59
+ ```
60
+
61
+ ### Run in a Kubernetes cluster
62
+
63
+ Refer to the [guide](./deploy/README.md) in `/deploy`.
64
+
65
+ ## Configuration
66
+
67
+ You can configure inference-perf to run with different data generation and load generation configurations today. Please see `config.yml` and examples in `/examples`.
68
+
69
+ Refer to the [CONFIG.md](./CONFIG.md) for documentation on all supported configuration options.
70
+
71
+ ### Datasets
72
+
73
+ Supported datasets include the following:
74
+ - [ShareGPT](./examples/vllm/config.yml) (for a real world conversational dataset)
75
+ - [Synthetic](./examples/vllm/config-synthetic.yml) (for specific input / output distributions with Sonnet data)
76
+ - [Random](./examples/vllm/config-random.yml) (for specific input / output distributions with random data)
77
+ - [SharedPrefix](./examples/vllm/config-shared-prefix.yml) (for prefix caching scenarios)
78
+ - mock (for testing)
79
+
80
+ ### Load Generators
81
+
82
+ Multiple load generators are supported:
83
+ - Poisson / constant-time load generation to send specific QPS.
84
+ - Multi-process load generation for increased concurrency and higher QPS.
85
+
86
+ Multiple load patterns can be specified:
87
+ - Stages with configurable duration and QPS along with specific timeouts in between them allows you to simulate different load patterns like burst in traffic, constantly increasing load till hardware saturation, etc.
88
+
89
+ ### API
90
+
91
+ OpenAI completion and chat completion APIs are supported. It can be pointed to any endpoints which support these APIs - currently verified against vLLM deployments. Other APIs and model server support can be added easily.
92
+
93
+ ### Metrics
94
+
95
+ Different latency and throughput metrics to analyze the performance of different LLM workloads are reported. A snippet from an example report is below.
96
+ ```
97
+ "latency": {
98
+ "request_latency": {
99
+ "mean": 3.31325431142327,
100
+ "min": 1.62129471905064,
101
+ "p10": 1.67609986825846,
102
+ "p50": 2.11507539497688,
103
+ "p90": 5.94717199734878,
104
+ "max": 6.30658466403838
105
+ },
106
+ "normalized_time_per_output_token": {
107
+ "mean": 0.104340420636009,
108
+ "min": 0.0506654599703325,
109
+ "p10": 0.0523781208830769,
110
+ "p50": 0.0670631669655753,
111
+ "p90": 0.189047570470012,
112
+ "max": 0.20343821496898
113
+ },
114
+ "time_per_output_token": {
115
+ "mean": 0.0836929455635872,
116
+ "min": 0.0517028436646797,
117
+ "p10": 0.0530815053513894,
118
+ "p50": 0.0611870964678625,
119
+ "p90": 0.152292036800645,
120
+ "max": 0.17837208439984
121
+ },
122
+ "time_to_first_token": {
123
+ "mean": 0.800974442732916,
124
+ "min": 0.0625283779809251,
125
+ "p10": 0.072068731742911,
126
+ "p50": 0.203539535985328,
127
+ "p90": 2.26959549135063,
128
+ "max": 4.46773961000145
129
+ },
130
+ "inter_token_latency": {
131
+ "mean": 0.0836929455635872,
132
+ "min": 0.000007129972800612,
133
+ "p10": 0.0534287681337446,
134
+ "p50": 0.0591336835059337,
135
+ "p90": 0.084046097996179,
136
+ "max": 0.614475268055685
137
+ }
138
+ },
139
+ "throughput": {
140
+ "input_tokens_per_sec": 643.576644186323,
141
+ "output_tokens_per_sec": 32.544923821416,
142
+ "total_tokens_per_sec": 676.121568007739,
143
+ "requests_per_sec": 1.0238155253639
144
+ },
145
+ "prompt_len": {
146
+ "mean": 628.606060606061,
147
+ "min": 4,
148
+ "p10": 11.4,
149
+ "p50": 364,
150
+ "p90": 2427.6,
151
+ "max": 3836
152
+ },
153
+ "output_len": {
154
+ "mean": 31.7878787878788,
155
+ "min": 30,
156
+ "p10": 31,
157
+ "p50": 32,
158
+ "p90": 32,
159
+ "max": 32
160
+ }
161
+ ```
162
+
163
+ ### Reports
164
+
165
+ Reports are generated in JSON format.
166
+ - Per stage reports for individual request rates.
167
+ - Summary reports for the overall run.
168
+ - Request logs / traces for further analysis.
169
+
170
+ Model server metrics reports from Prometheus collected during the run is also produced.
171
+ - Model server specific metrics like queue size, batch size, latency metrics, etc.
172
+ - Supports querying metrics from OSS Prometheus and Google Managed Prometheus.
173
+
174
+ ## Analysis
175
+
176
+ Reports can be analyzed using the following command:
177
+
178
+ ```
179
+ inference-perf --analyze <path-to-dir-with-reports>
180
+ ```
181
+
182
+ This should generate the following charts (below charts are for example only):
183
+
184
+ 1. QPS vs Latency (TTFT, NTPOT, ITL)
185
+
186
+ ![qps-latency-chart](./docs/images/latency_vs_qps.png)
187
+
188
+ 2. QPS vs Throughput (input tokens / sec, output tokens / sec, total tokens / sec)
189
+
190
+ ![qps-throughput-chart](./docs/images/throughput_vs_qps.png)
191
+
192
+ 3. Latency vs Throughput (output tokens / sec vs TTFT, NTPOT and ITL)
193
+
194
+ ![latency-throughput-chart](./docs/images/throughput_vs_latency.png)
195
+
196
+ ## Contributing
197
+
198
+ Our community meeting is weekly on Thursdays alternating betweem 09:00 and 11:30 PDT ([Zoom Link](https://zoom.us/j/9955436256?pwd=Z2FQWU1jeDZkVC9RRTN4TlZyZTBHZz09), [Meeting Notes](https://docs.google.com/document/d/15XSF8q4DShcXIiExDfyiXxAYQslCmOmO2ARSJErVTak/edit?usp=sharing), [Meeting Recordings](https://www.youtube.com/playlist?list=PL69nYSiGNLP30qNanabU75ayPK7OPNAAS)).
199
+
200
+ We currently utilize the [#inference-perf](https://kubernetes.slack.com/?redir=%2Fmessages%2Finference-perf) channel in Kubernetes Slack workspace for communications.
201
+
202
+ Contributions are welcomed, thanks for joining us!
203
+
204
+ ### Code of conduct
205
+
206
+ Participation in the Kubernetes community is governed by the [Kubernetes Code of Conduct](code-of-conduct.md).
@@ -0,0 +1,16 @@
1
+ # Copyright 2025 The Kubernetes Authors.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ from .main import main_cli
15
+
16
+ __all__ = ["main_cli"]
@@ -0,0 +1,17 @@
1
+ # Copyright 2025 The Kubernetes Authors.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from .analyze import analyze_reports
16
+
17
+ __all__ = ["analyze_reports"]