tokenomics 0.5.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.
- tokenomics-0.5.1/.github/workflows/publish.yml +19 -0
- tokenomics-0.5.1/.gitignore +172 -0
- tokenomics-0.5.1/LICENSE +21 -0
- tokenomics-0.5.1/PKG-INFO +130 -0
- tokenomics-0.5.1/README.md +109 -0
- tokenomics-0.5.1/assets/advanced_benchmark_example.png +0 -0
- tokenomics-0.5.1/assets/embeddings_speed.png +0 -0
- tokenomics-0.5.1/assets/example_visualization.png +0 -0
- tokenomics-0.5.1/assets/tokens.jpg +0 -0
- tokenomics-0.5.1/examples/data/sample_prompts.txt +20 -0
- tokenomics-0.5.1/examples/data/short_prompts.txt +20 -0
- tokenomics-0.5.1/pyproject.toml +37 -0
- tokenomics-0.5.1/run_benchmark.sh +22 -0
- tokenomics-0.5.1/run_embedding_benchmark.sh +5 -0
- tokenomics-0.5.1/run_lora_benchmark.sh +55 -0
- tokenomics-0.5.1/server/sglang_run_server.sh +12 -0
- tokenomics-0.5.1/server/sglang_with_lora.sh +28 -0
- tokenomics-0.5.1/server/vllm_run_server.sh +11 -0
- tokenomics-0.5.1/tokenomics/__init__.py +1 -0
- tokenomics-0.5.1/tokenomics/__main__.py +3 -0
- tokenomics-0.5.1/tokenomics/cli.py +35 -0
- tokenomics-0.5.1/tokenomics/completion_benchmark.py +744 -0
- tokenomics-0.5.1/tokenomics/embedding_benchmark.py +463 -0
- tokenomics-0.5.1/tokenomics/io.py +98 -0
- tokenomics-0.5.1/tokenomics/plot_completion_benchmark.py +515 -0
- tokenomics-0.5.1/tokenomics/plot_embedding_benchmark.py +299 -0
- tokenomics-0.5.1/tokenomics/sampling/__init__.py +23 -0
- tokenomics-0.5.1/tokenomics/sampling/dataset.py +147 -0
- tokenomics-0.5.1/tokenomics/sampling/sampler.py +93 -0
- tokenomics-0.5.1/tokenomics/sampling/scenarios.py +190 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
id-token: write
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- uses: actions/setup-python@v5
|
|
15
|
+
with:
|
|
16
|
+
python-version: "3.12"
|
|
17
|
+
- run: pip install build
|
|
18
|
+
- run: python -m build
|
|
19
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
*.json
|
|
2
|
+
# Byte-compiled / optimized / DLL files
|
|
3
|
+
__pycache__/
|
|
4
|
+
*.py[cod]
|
|
5
|
+
*$py.class
|
|
6
|
+
|
|
7
|
+
# C extensions
|
|
8
|
+
*.so
|
|
9
|
+
|
|
10
|
+
# Distribution / packaging
|
|
11
|
+
.Python
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
cover/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
# .python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
#Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# UV
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
101
|
+
# commonly ignored for libraries.
|
|
102
|
+
#uv.lock
|
|
103
|
+
|
|
104
|
+
# poetry
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
106
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
107
|
+
# commonly ignored for libraries.
|
|
108
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
109
|
+
#poetry.lock
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
#pdm.lock
|
|
114
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
115
|
+
# in version control.
|
|
116
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
117
|
+
.pdm.toml
|
|
118
|
+
.pdm-python
|
|
119
|
+
.pdm-build/
|
|
120
|
+
|
|
121
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
122
|
+
__pypackages__/
|
|
123
|
+
|
|
124
|
+
# Celery stuff
|
|
125
|
+
celerybeat-schedule
|
|
126
|
+
celerybeat.pid
|
|
127
|
+
|
|
128
|
+
# SageMath parsed files
|
|
129
|
+
*.sage.py
|
|
130
|
+
|
|
131
|
+
# Environments
|
|
132
|
+
.env
|
|
133
|
+
.venv
|
|
134
|
+
env/
|
|
135
|
+
venv/
|
|
136
|
+
ENV/
|
|
137
|
+
env.bak/
|
|
138
|
+
venv.bak/
|
|
139
|
+
|
|
140
|
+
# Spyder project settings
|
|
141
|
+
.spyderproject
|
|
142
|
+
.spyproject
|
|
143
|
+
|
|
144
|
+
# Rope project settings
|
|
145
|
+
.ropeproject
|
|
146
|
+
|
|
147
|
+
# mkdocs documentation
|
|
148
|
+
/site
|
|
149
|
+
|
|
150
|
+
# mypy
|
|
151
|
+
.mypy_cache/
|
|
152
|
+
.dmypy.json
|
|
153
|
+
dmypy.json
|
|
154
|
+
|
|
155
|
+
# Pyre type checker
|
|
156
|
+
.pyre/
|
|
157
|
+
|
|
158
|
+
# pytype static type analyzer
|
|
159
|
+
.pytype/
|
|
160
|
+
|
|
161
|
+
# Cython debug symbols
|
|
162
|
+
cython_debug/
|
|
163
|
+
|
|
164
|
+
# PyCharm
|
|
165
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
166
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
167
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
168
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
169
|
+
#.idea/
|
|
170
|
+
|
|
171
|
+
# PyPI configuration file
|
|
172
|
+
.pypirc
|
tokenomics-0.5.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Piotr Mazurek
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tokenomics
|
|
3
|
+
Version: 0.5.1
|
|
4
|
+
Summary: LLM inference benchmarking toolkit
|
|
5
|
+
Project-URL: Homepage, https://github.com/LiquidAI/tokenomics
|
|
6
|
+
Author: Liquid AI
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Requires-Dist: aiohttp
|
|
14
|
+
Requires-Dist: datasets>=3.2.0
|
|
15
|
+
Requires-Dist: matplotlib
|
|
16
|
+
Requires-Dist: numpy
|
|
17
|
+
Requires-Dist: openai
|
|
18
|
+
Requires-Dist: seaborn
|
|
19
|
+
Requires-Dist: tokenizers
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# Tokenomics
|
|
23
|
+
|
|
24
|
+
Benchmarking suite for OpenAI-compatible inference servers. Measures throughput, latency, and steady-state performance.
|
|
25
|
+
|
|
26
|
+

|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
uv venv --python 3.12 --seed && source .venv/bin/activate
|
|
32
|
+
uv pip install -e .
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Completion Benchmark
|
|
36
|
+
|
|
37
|
+
Sends chat completion requests to any OpenAI-compatible server and records per-request and system-wide metrics.
|
|
38
|
+
|
|
39
|
+
### Usage
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Burst mode — fires all requests at once
|
|
43
|
+
tokenomics completion \
|
|
44
|
+
--dataset-config examples/dataset_configs/aime_simple.json \
|
|
45
|
+
--scenario "N(100,50)/(50,0)" \
|
|
46
|
+
--model your-model \
|
|
47
|
+
--batch-sizes 1,2,4,8
|
|
48
|
+
|
|
49
|
+
# Sustained mode — maintains constant concurrency via semaphore
|
|
50
|
+
tokenomics completion \
|
|
51
|
+
--dataset-config examples/dataset_configs/aime_simple.json \
|
|
52
|
+
--scenario "N(100,50)/(50,0)" \
|
|
53
|
+
--model your-model \
|
|
54
|
+
--max-concurrency 1,2,4,8 \
|
|
55
|
+
--num-prompts 128
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The two modes are mutually exclusive. Burst is good for peak throughput; sustained gives realistic production numbers.
|
|
59
|
+
|
|
60
|
+
### Traffic Scenarios
|
|
61
|
+
|
|
62
|
+
| Pattern | Example | Description |
|
|
63
|
+
|---------|---------|-------------|
|
|
64
|
+
| `D(in,out)` | `D(100,50)` | Fixed token counts |
|
|
65
|
+
| `N(mu,sigma)/(mu,sigma)` | `N(100,50)/(50,0)` | Normal distribution |
|
|
66
|
+
| `U(min,max)/(min,max)` | `U(50,150)/(20,80)` | Uniform distribution |
|
|
67
|
+
| `I(w,h)` | `I(512,512)` | Image input |
|
|
68
|
+
|
|
69
|
+
### Key Options
|
|
70
|
+
|
|
71
|
+
| Flag | Description |
|
|
72
|
+
|------|-------------|
|
|
73
|
+
| `--dataset-config` | Path to JSON dataset config (see `examples/dataset_configs/`) |
|
|
74
|
+
| `--scenario` | Traffic pattern |
|
|
75
|
+
| `--model` | Model name |
|
|
76
|
+
| `--api-base` | Server URL (default: `http://localhost:8000/v1`) |
|
|
77
|
+
| `--batch-sizes` | Burst mode sweep points |
|
|
78
|
+
| `--max-concurrency` | Sustained mode sweep points |
|
|
79
|
+
| `--num-prompts` | Prompts per sweep point in sustained mode |
|
|
80
|
+
| `--num-runs` | Runs per sweep point (default: 3) |
|
|
81
|
+
| `--max-tokens` | Max output tokens (default: 4096) |
|
|
82
|
+
| `--results-dir` | Output directory (one JSON per sweep value) |
|
|
83
|
+
| `--lora-strategy` | LoRA distribution: single, uniform, zipf, mixed, all-unique |
|
|
84
|
+
| `--lora-names` | Comma-separated LoRA adapter names |
|
|
85
|
+
|
|
86
|
+
### Metrics
|
|
87
|
+
|
|
88
|
+
**Per-request:**
|
|
89
|
+
- **TTFT** — time to first token (prefill latency)
|
|
90
|
+
- **Decode throughput** — output tokens/s per request
|
|
91
|
+
- **TPOT** — time per output token
|
|
92
|
+
|
|
93
|
+
**System-wide:**
|
|
94
|
+
- **End-to-end output throughput** — `total_output_tokens / wall_time`, includes ramp-up and drain
|
|
95
|
+
- **Steady-state output throughput** — median tok/s across time buckets where the batch is >= 80% full, isolating true decode performance
|
|
96
|
+
|
|
97
|
+
### Plotting
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Single benchmark
|
|
101
|
+
tokenomics plot-completion results_dir/ plot.png
|
|
102
|
+
|
|
103
|
+
# Compare multiple benchmarks
|
|
104
|
+
tokenomics plot-completion output.png results_dir1/ results_dir2/
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Produces a 6-panel dashboard:
|
|
108
|
+
|
|
109
|
+
| | Left | Right |
|
|
110
|
+
|---|------|-------|
|
|
111
|
+
| **Row 1** | TTFT | Decode throughput per request |
|
|
112
|
+
| **Row 2** | End-to-end output throughput | Latency breakdown (prefill vs decode) |
|
|
113
|
+
| **Row 3** | Steady-state output throughput | Time-series token buckets |
|
|
114
|
+
|
|
115
|
+
## Embedding Benchmark
|
|
116
|
+
|
|
117
|
+
Tests concurrent embedding throughput.
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
tokenomics embedding \
|
|
121
|
+
--model Qwen/Qwen3-Embedding-4B \
|
|
122
|
+
--sequence_lengths "200" \
|
|
123
|
+
--batch_sizes "1,8,16,32,64,128,256,512" \
|
|
124
|
+
--num_runs 3 \
|
|
125
|
+
--results-dir embedding_results/
|
|
126
|
+
|
|
127
|
+
tokenomics plot-embedding embedding_results/ embedding_plot.png
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+

|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Tokenomics
|
|
2
|
+
|
|
3
|
+
Benchmarking suite for OpenAI-compatible inference servers. Measures throughput, latency, and steady-state performance.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
uv venv --python 3.12 --seed && source .venv/bin/activate
|
|
11
|
+
uv pip install -e .
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Completion Benchmark
|
|
15
|
+
|
|
16
|
+
Sends chat completion requests to any OpenAI-compatible server and records per-request and system-wide metrics.
|
|
17
|
+
|
|
18
|
+
### Usage
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Burst mode — fires all requests at once
|
|
22
|
+
tokenomics completion \
|
|
23
|
+
--dataset-config examples/dataset_configs/aime_simple.json \
|
|
24
|
+
--scenario "N(100,50)/(50,0)" \
|
|
25
|
+
--model your-model \
|
|
26
|
+
--batch-sizes 1,2,4,8
|
|
27
|
+
|
|
28
|
+
# Sustained mode — maintains constant concurrency via semaphore
|
|
29
|
+
tokenomics completion \
|
|
30
|
+
--dataset-config examples/dataset_configs/aime_simple.json \
|
|
31
|
+
--scenario "N(100,50)/(50,0)" \
|
|
32
|
+
--model your-model \
|
|
33
|
+
--max-concurrency 1,2,4,8 \
|
|
34
|
+
--num-prompts 128
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The two modes are mutually exclusive. Burst is good for peak throughput; sustained gives realistic production numbers.
|
|
38
|
+
|
|
39
|
+
### Traffic Scenarios
|
|
40
|
+
|
|
41
|
+
| Pattern | Example | Description |
|
|
42
|
+
|---------|---------|-------------|
|
|
43
|
+
| `D(in,out)` | `D(100,50)` | Fixed token counts |
|
|
44
|
+
| `N(mu,sigma)/(mu,sigma)` | `N(100,50)/(50,0)` | Normal distribution |
|
|
45
|
+
| `U(min,max)/(min,max)` | `U(50,150)/(20,80)` | Uniform distribution |
|
|
46
|
+
| `I(w,h)` | `I(512,512)` | Image input |
|
|
47
|
+
|
|
48
|
+
### Key Options
|
|
49
|
+
|
|
50
|
+
| Flag | Description |
|
|
51
|
+
|------|-------------|
|
|
52
|
+
| `--dataset-config` | Path to JSON dataset config (see `examples/dataset_configs/`) |
|
|
53
|
+
| `--scenario` | Traffic pattern |
|
|
54
|
+
| `--model` | Model name |
|
|
55
|
+
| `--api-base` | Server URL (default: `http://localhost:8000/v1`) |
|
|
56
|
+
| `--batch-sizes` | Burst mode sweep points |
|
|
57
|
+
| `--max-concurrency` | Sustained mode sweep points |
|
|
58
|
+
| `--num-prompts` | Prompts per sweep point in sustained mode |
|
|
59
|
+
| `--num-runs` | Runs per sweep point (default: 3) |
|
|
60
|
+
| `--max-tokens` | Max output tokens (default: 4096) |
|
|
61
|
+
| `--results-dir` | Output directory (one JSON per sweep value) |
|
|
62
|
+
| `--lora-strategy` | LoRA distribution: single, uniform, zipf, mixed, all-unique |
|
|
63
|
+
| `--lora-names` | Comma-separated LoRA adapter names |
|
|
64
|
+
|
|
65
|
+
### Metrics
|
|
66
|
+
|
|
67
|
+
**Per-request:**
|
|
68
|
+
- **TTFT** — time to first token (prefill latency)
|
|
69
|
+
- **Decode throughput** — output tokens/s per request
|
|
70
|
+
- **TPOT** — time per output token
|
|
71
|
+
|
|
72
|
+
**System-wide:**
|
|
73
|
+
- **End-to-end output throughput** — `total_output_tokens / wall_time`, includes ramp-up and drain
|
|
74
|
+
- **Steady-state output throughput** — median tok/s across time buckets where the batch is >= 80% full, isolating true decode performance
|
|
75
|
+
|
|
76
|
+
### Plotting
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Single benchmark
|
|
80
|
+
tokenomics plot-completion results_dir/ plot.png
|
|
81
|
+
|
|
82
|
+
# Compare multiple benchmarks
|
|
83
|
+
tokenomics plot-completion output.png results_dir1/ results_dir2/
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Produces a 6-panel dashboard:
|
|
87
|
+
|
|
88
|
+
| | Left | Right |
|
|
89
|
+
|---|------|-------|
|
|
90
|
+
| **Row 1** | TTFT | Decode throughput per request |
|
|
91
|
+
| **Row 2** | End-to-end output throughput | Latency breakdown (prefill vs decode) |
|
|
92
|
+
| **Row 3** | Steady-state output throughput | Time-series token buckets |
|
|
93
|
+
|
|
94
|
+
## Embedding Benchmark
|
|
95
|
+
|
|
96
|
+
Tests concurrent embedding throughput.
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
tokenomics embedding \
|
|
100
|
+
--model Qwen/Qwen3-Embedding-4B \
|
|
101
|
+
--sequence_lengths "200" \
|
|
102
|
+
--batch_sizes "1,8,16,32,64,128,256,512" \
|
|
103
|
+
--num_runs 3 \
|
|
104
|
+
--results-dir embedding_results/
|
|
105
|
+
|
|
106
|
+
tokenomics plot-embedding embedding_results/ embedding_plot.png
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+

|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Write a short story about a robot learning to paint.
|
|
2
|
+
Explain quantum computing in simple terms.
|
|
3
|
+
What are the best practices for sustainable software development?
|
|
4
|
+
Create a recipe for chocolate chip cookies with a twist.
|
|
5
|
+
Describe the process of photosynthesis step by step.
|
|
6
|
+
Write a poem about the changing seasons.
|
|
7
|
+
How do machine learning algorithms work?
|
|
8
|
+
Explain the history of the internet in 200 words.
|
|
9
|
+
What are the benefits of renewable energy?
|
|
10
|
+
Create a dialogue between two characters meeting for the first time.
|
|
11
|
+
Describe your ideal vacation destination.
|
|
12
|
+
How does blockchain technology work?
|
|
13
|
+
Write instructions for assembling a piece of furniture.
|
|
14
|
+
Explain the concept of emotional intelligence.
|
|
15
|
+
What are the key principles of effective leadership?
|
|
16
|
+
Create a marketing strategy for a new product.
|
|
17
|
+
Describe the water cycle and its importance.
|
|
18
|
+
Write a review of your favorite book or movie.
|
|
19
|
+
How do you solve conflicts in a team environment?
|
|
20
|
+
Explain the basics of personal finance management.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
What is 2+2?
|
|
2
|
+
Hello world
|
|
3
|
+
How are you?
|
|
4
|
+
Good morning
|
|
5
|
+
Thank you
|
|
6
|
+
Yes or no?
|
|
7
|
+
Maybe later
|
|
8
|
+
Not sure
|
|
9
|
+
Could be
|
|
10
|
+
Why not?
|
|
11
|
+
Sounds good
|
|
12
|
+
Perfect choice
|
|
13
|
+
Almost done
|
|
14
|
+
Getting close
|
|
15
|
+
Nearly there
|
|
16
|
+
Just finished
|
|
17
|
+
All set
|
|
18
|
+
Ready now
|
|
19
|
+
Let's go
|
|
20
|
+
Here we are
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "tokenomics"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "LLM inference benchmarking toolkit"
|
|
9
|
+
requires-python = ">=3.10"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "Liquid AI" },
|
|
13
|
+
]
|
|
14
|
+
readme = "README.md"
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
]
|
|
20
|
+
dependencies = [
|
|
21
|
+
"datasets>=3.2.0",
|
|
22
|
+
"openai",
|
|
23
|
+
"matplotlib",
|
|
24
|
+
"seaborn",
|
|
25
|
+
"aiohttp",
|
|
26
|
+
"numpy",
|
|
27
|
+
"tokenizers",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://github.com/LiquidAI/tokenomics"
|
|
32
|
+
|
|
33
|
+
[tool.hatch.version]
|
|
34
|
+
path = "tokenomics/__init__.py"
|
|
35
|
+
|
|
36
|
+
[project.scripts]
|
|
37
|
+
tokenomics = "tokenomics.cli:main"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Usage: ./run_benchmark.sh
|
|
3
|
+
MODEL="${MODEL:-LiquidAI/LFM2-24B-A2B}"
|
|
4
|
+
API_BASE="${API_BASE:-http://tus1-p13-g57:30000/v1}"
|
|
5
|
+
IN_TOKENS="${IN_TOKENS:-1024}"
|
|
6
|
+
OUT_TOKENS="${OUT_TOKENS:-512}"
|
|
7
|
+
NUM_RUNS="${NUM_RUNS:-1}"
|
|
8
|
+
WARMUP_RUNS="${WARMUP_RUNS:-1}"
|
|
9
|
+
|
|
10
|
+
MODEL_NAME=$(basename "$MODEL")
|
|
11
|
+
RESULTS_DIR="${RESULTS_DIR:-${MODEL_NAME}-MI325X-TP1/}"
|
|
12
|
+
|
|
13
|
+
tokenomics completion \
|
|
14
|
+
--model "$MODEL" \
|
|
15
|
+
--scenario "N(${IN_TOKENS},0)/(${OUT_TOKENS},0)" \
|
|
16
|
+
--dataset-config examples/dataset_configs/aime_simple.json \
|
|
17
|
+
--api-base "$API_BASE" \
|
|
18
|
+
--max-concurrency 1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192 \
|
|
19
|
+
--num-runs "$NUM_RUNS" \
|
|
20
|
+
--description "${MODEL_NAME} burst mode MI325X TP1" \
|
|
21
|
+
--warmup-runs "$WARMUP_RUNS" \
|
|
22
|
+
--results-dir "$RESULTS_DIR"
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
MODEL="Qwen/Qwen3-4B"
|
|
4
|
+
TOKENIZER="Qwen/Qwen3-4B"
|
|
5
|
+
API_BASE="http://localhost:8000/v1"
|
|
6
|
+
DATASET_CONFIG="examples/dataset_configs/aime_simple.json"
|
|
7
|
+
SCENARIO="N(3000,50)/(50,0)"
|
|
8
|
+
BATCH_SIZES="1,2,4,8,16,32,64,128"
|
|
9
|
+
NUM_RUNS=3
|
|
10
|
+
RESULTS_BASE="${1:-lora_results}"
|
|
11
|
+
|
|
12
|
+
echo "Test 1: Baseline (no LoRA)"
|
|
13
|
+
tokenomics completion \
|
|
14
|
+
--model "$MODEL" \
|
|
15
|
+
--scenario "$SCENARIO" \
|
|
16
|
+
--dataset-config "$DATASET_CONFIG" \
|
|
17
|
+
--api-base "$API_BASE" \
|
|
18
|
+
--batch-sizes "$BATCH_SIZES" \
|
|
19
|
+
--num-runs "$NUM_RUNS" \
|
|
20
|
+
--tokenizer "$TOKENIZER" \
|
|
21
|
+
--description "Baseline: No LoRA" \
|
|
22
|
+
--results-dir "$RESULTS_BASE/baseline"
|
|
23
|
+
|
|
24
|
+
echo ""
|
|
25
|
+
echo "Test 2: Uniform 4 LoRAs"
|
|
26
|
+
tokenomics completion \
|
|
27
|
+
--model "$MODEL" \
|
|
28
|
+
--scenario "$SCENARIO" \
|
|
29
|
+
--dataset-config "$DATASET_CONFIG" \
|
|
30
|
+
--api-base "$API_BASE" \
|
|
31
|
+
--batch-sizes "$BATCH_SIZES" \
|
|
32
|
+
--num-runs "$NUM_RUNS" \
|
|
33
|
+
--tokenizer "$TOKENIZER" \
|
|
34
|
+
--lora-strategy uniform \
|
|
35
|
+
--lora-names lora_finance,lora_medical,lora_legal,lora_coding \
|
|
36
|
+
--description "Uniform: 4 LoRAs" \
|
|
37
|
+
--results-dir "$RESULTS_BASE/uniform_4"
|
|
38
|
+
|
|
39
|
+
echo ""
|
|
40
|
+
echo "Test 3: All unique 8 LoRAs"
|
|
41
|
+
tokenomics completion \
|
|
42
|
+
--model "$MODEL" \
|
|
43
|
+
--scenario "$SCENARIO" \
|
|
44
|
+
--dataset-config "$DATASET_CONFIG" \
|
|
45
|
+
--api-base "$API_BASE" \
|
|
46
|
+
--batch-sizes "$BATCH_SIZES" \
|
|
47
|
+
--num-runs "$NUM_RUNS" \
|
|
48
|
+
--tokenizer "$TOKENIZER" \
|
|
49
|
+
--lora-strategy all-unique \
|
|
50
|
+
--lora-names lora_finance,lora_medical,lora_legal,lora_coding,lora_creative,lora_technical,lora_customer,lora_research \
|
|
51
|
+
--description "Stress test: 8 unique LoRAs" \
|
|
52
|
+
--results-dir "$RESULTS_BASE/all_unique_8"
|
|
53
|
+
|
|
54
|
+
echo ""
|
|
55
|
+
echo "Done. Results in $RESULTS_BASE/"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
MODEL="LiquidAI/LFM2.5-1.2B-Instruct"
|
|
4
|
+
TP_SIZE=1
|
|
5
|
+
|
|
6
|
+
echo "Starting SGLang server with model: ${MODEL}"
|
|
7
|
+
echo "Tensor Parallel Size: ${TP_SIZE}"
|
|
8
|
+
|
|
9
|
+
python -m sglang.launch_server \
|
|
10
|
+
--model-path "${MODEL}" \
|
|
11
|
+
--tp-size "${TP_SIZE}" \
|
|
12
|
+
--port 8000
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# SGLang server with LoRA support for benchmarking
|
|
3
|
+
# Uses Qwen/Qwen3-4B with 8 demo LoRA adapters
|
|
4
|
+
|
|
5
|
+
MODEL="Qwen/Qwen3-4B"
|
|
6
|
+
TP_SIZE=1
|
|
7
|
+
LORA_ADAPTER="ahmadmuf/product-price-predictor-2025-05-17_07.41.06"
|
|
8
|
+
|
|
9
|
+
echo "Starting SGLang server with LoRA support"
|
|
10
|
+
echo "Model: ${MODEL}"
|
|
11
|
+
echo "LoRA Adapter: ${LORA_ADAPTER} (same adapter for all 8 slots)"
|
|
12
|
+
|
|
13
|
+
python -m sglang.launch_server \
|
|
14
|
+
--model-path "${MODEL}" \
|
|
15
|
+
--tp-size "${TP_SIZE}" \
|
|
16
|
+
--enable-lora \
|
|
17
|
+
--max-loras-per-batch 8 \
|
|
18
|
+
--lora-backend csgmv \
|
|
19
|
+
--lora-paths \
|
|
20
|
+
lora_finance="${LORA_ADAPTER}" \
|
|
21
|
+
lora_medical="${LORA_ADAPTER}" \
|
|
22
|
+
lora_legal="${LORA_ADAPTER}" \
|
|
23
|
+
lora_coding="${LORA_ADAPTER}" \
|
|
24
|
+
lora_creative="${LORA_ADAPTER}" \
|
|
25
|
+
lora_technical="${LORA_ADAPTER}" \
|
|
26
|
+
lora_customer="${LORA_ADAPTER}" \
|
|
27
|
+
lora_research="${LORA_ADAPTER}" \
|
|
28
|
+
--port 8000
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.5.1"
|