Skip to content

Commit e633fa3

Browse files
committed
update README
1 parent 191d1fa commit e633fa3

1 file changed

Lines changed: 71 additions & 72 deletions

File tree

tools/recipes/README.md

Lines changed: 71 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
Utilities for consuming deployment configurations from [vLLM Recipes](https://recipes.vllm.ai/) and converting them into files that can be used directly with vLLM.
44

5+
6+
## Optimized Deployment Flow
7+
8+
The recipe provides the validated deployment baseline. Hardware and workload
9+
information are optional inputs that can refine deployment-sensitive values
10+
before the generated configuration is passed to vLLM.
11+
12+
```mermaid
13+
flowchart LR
14+
R["vLLM Recipe"] --> C["Recipe Converter"]
15+
H["Hardware Info (optional)"] --> C
16+
W["Workload Info (optional)"] --> C
17+
C --> F["config.yml + env.sh"]
18+
F --> D["vLLM Docker Image"]
19+
D --> E["OpenAI Endpoint"]
20+
```
21+
22+
523
## `recipe_json_to_vllm_config.py`
624

725
Converts a hardware-specific vLLM Recipes JSON rendering into:
@@ -157,31 +175,64 @@ Single-process renderings such as `single_node_tp` can be converted directly. Mu
157175

158176
## Optional Runtime Tuning
159177

160-
The Recipes JSON remains the baseline. vLLM Recipes contain the validated model,
161-
hardware, strategy, environment variables, and serving arguments for a known
162-
configuration. Runtime tuning is optional and refines only deployment-sensitive
163-
arguments when more information about the user's actual hardware or workload is
164-
available.
178+
The Recipes JSON remains the baseline. vLLM Recipes already provide validated
179+
model, hardware, strategy, environment variables, and serving arguments.
180+
Runtime tuning is optional and is intended for parameters whose best value can
181+
depend on the actual deployment resources or expected request workload.
182+
183+
### Deployment-Time Parameters
184+
185+
The parameters below may already exist in a recipe. They are candidates for
186+
deployment-time refinement when the recipe value is missing, generic, or based
187+
on a validation environment that differs from the user's target deployment.
188+
189+
| Runtime parameter | Why it may need deployment-time refinement | Main decision input | Current draft policy |
190+
| --- | --- | --- | --- |
191+
| `tensor-parallel-size` | The effective CPU/NUMA topology available to a container or pod can differ from the system used to validate the recipe. | Hardware topology | Use the largest power-of-two TP value that does not exceed the effective NUMA-node count. |
192+
| `gpu-memory-utilization` | Available memory can differ by machine size, container limits, and other memory use. The vLLM option name is also used by the CPU backend. | Hardware memory + recipe baseline | Compute a conservative safe fraction, reserve 10%, cap at `0.90`, and never increase a smaller recipe value. If the recipe omits it, start from `0.80`. |
193+
| `max-num-seqs` | The useful scheduler concurrency depends on the number of requests expected to be active at the same time. | Workload concurrency | Set `max-num-seqs` to `--concurrency`. |
194+
| `max-num-batched-tokens` | The batching budget depends strongly on request input length and concurrency. | Workload token shape + concurrency | Compute `input_tokens * min(concurrency, 8)`, round up to a power of two, and clamp to `2048..32768`. |
195+
| `data-parallel-size` | The required replica count depends on the requested throughput and the capacity of one replica. | Capacity target | Keep the recipe value today. `--target-qps` is captured for a future capacity-based policy. |
196+
197+
These policies are intentionally isolated in `runtime_tuning.py` so the
198+
decision rules can evolve as more benchmark data becomes available.
165199

166-
This is useful because some performance parameters may be absent from a recipe,
167-
may use a general/default value, or may have been selected for the hardware and
168-
workload used when that recipe was validated. The converter does not replace
169-
Recipes; it adapts the recipe baseline to the deployment context available when
170-
`config.yml` is generated.
200+
### How Runtime Tuning Determines the Values
171201

172-
### Information Used for Runtime Tuning
202+
The converter can combine the recipe baseline with optional deployment
203+
information. Different information sources are used for different parameters:
173204

174-
| Information source | How the tool gets it | Examples | Purpose |
205+
| Information source | How it is obtained | Examples | Parameters it can help determine |
175206
| --- | --- | --- | --- |
176-
| vLLM Recipe | Recipes JSON API or direct recipe JSON | model ID, recipe hardware, strategy, existing `argv`, environment variables | Provides the validated baseline and identifies which hardware tuning policy may be used. |
177-
| Hardware | `--detect-hardware` | effective NUMA nodes, allowed CPUs, physical cores, per-NUMA total/available memory | Refines topology- and memory-dependent settings. |
178-
| Workload | Optional CLI inputs | `--input-tokens`, `--output-tokens`, `--concurrency` | Refines scheduler concurrency and batching for the expected request shape. |
179-
| SLO / capacity | Optional CLI inputs | `--ttft-sla-ms`, `--tpot-sla-ms`, `--target-qps` | Supplies constraints for current or future SLA/capacity-aware policies. |
207+
| vLLM Recipe | Recipes JSON API or direct recipe JSON | model ID, recipe hardware, strategy, existing `argv`, environment variables | Provides the baseline for all parameters and selects the applicable hardware tuning policy. |
208+
| Hardware (optional) | `--detect-hardware` | effective NUMA nodes, allowed CPUs, physical cores, per-NUMA total/available memory | `tensor-parallel-size`, `gpu-memory-utilization` |
209+
| Workload (optional) | User CLI inputs | `--input-tokens`, `--output-tokens`, `--concurrency` | `max-num-seqs`, `max-num-batched-tokens`; output length is also available for future KV-cache-aware policies. |
210+
| SLO / capacity (optional) | User CLI inputs | `--ttft-sla-ms`, `--tpot-sla-ms`, `--target-qps` | Future SLA-aware batching and `data-parallel-size` capacity decisions. |
180211

181212
All additional inputs are optional. If none are supplied, the converter keeps
182213
the normal Recipes conversion behavior.
183214

184-
Example with hardware and workload information:
215+
The effective precedence is:
216+
217+
```text
218+
vLLM defaults
219+
-> vLLM Recipes baseline
220+
-> hardware refinement (optional)
221+
-> workload / SLO refinement (optional)
222+
-> config.yml + env.sh
223+
```
224+
225+
For example, hardware detection can refine TP and memory sizing without any
226+
workload input:
227+
228+
```bash
229+
python3 tools/recipes/recipe_json_to_vllm_config.py \
230+
--model meta-llama/Llama-3.1-8B-Instruct \
231+
--hardware xeon6 \
232+
--detect-hardware
233+
```
234+
235+
Workload information can be added when it is known:
185236

186237
```bash
187238
python3 tools/recipes/recipe_json_to_vllm_config.py \
@@ -195,53 +246,21 @@ python3 tools/recipes/recipe_json_to_vllm_config.py \
195246
--tpot-sla-ms 100
196247
```
197248

198-
### Parameters That May Need Deployment-Time Refinement
199-
200-
vLLM Recipes can already contain the parameters below. Runtime tuning is useful
201-
when a parameter is missing or when the recipe's validated value does not match
202-
the resources or workload of the target deployment.
203-
204-
| Runtime parameter | Why the recipe alone may not be enough | Additional information used | Current draft policy |
205-
| --- | --- | --- | --- |
206-
| `tensor-parallel-size` | The recipe topology may differ from the NUMA resources actually available to the container or pod. | Effective NUMA-node count from `--detect-hardware` | Use the largest power-of-two TP value that does not exceed the effective NUMA-node count. |
207-
| `gpu-memory-utilization` | Available memory can differ because of machine size, container limits, or other memory use. The vLLM option name is also used by the CPU backend. | Per-NUMA total/available memory plus the recipe value, if present | Compute a conservative safe fraction, reserve 10%, cap at `0.90`, and never increase a smaller recipe value. If the recipe omits it, start from `0.80`. |
208-
| `max-num-seqs` | The best scheduler concurrency depends on the expected number of concurrent requests. | `--concurrency` | Set `max-num-seqs` to the requested concurrency. |
209-
| `max-num-batched-tokens` | The useful batching budget depends strongly on request input length and concurrency. | `--input-tokens` and `--concurrency` | Compute `input_tokens * min(concurrency, 8)`, round up to a power of two, and clamp to `2048..32768`. |
210-
| `data-parallel-size` | The required replica count depends on target throughput and the capacity of one replica. | `--target-qps` plus a future per-replica capacity model | Keep the recipe value today. `target_qps` is recorded for future capacity-based tuning. |
211-
212249
`--output-tokens`, `--ttft-sla-ms`, and `--tpot-sla-ms` are accepted as policy
213250
inputs, but the current draft does not force them into an arbitrary formula.
214251
Output length affects KV-cache residency and request lifetime, while TTFT and
215252
TPOT constrain how aggressive scheduler batching can be. These inputs can be
216253
used once benchmark-derived or otherwise validated decision rules are available.
217254

218-
The effective precedence is:
219-
220-
```text
221-
vLLM defaults
222-
-> vLLM Recipes baseline
223-
-> optional hardware refinement
224-
-> optional workload/SLO refinement
225-
-> config.yml + env.sh
226-
```
227-
228255
### Runtime-Tuning Hardware Scope
229256

230257
Runtime tuning is selected from the resolved recipe JSON's `hardware` field,
231258
rather than by inspecting which physical devices happen to be present on the
232259
host. This matters because a GPU server also exposes its host CPU topology.
233260

234-
The current runtime-tuning policy registry contains `xeon6`:
235-
236-
```bash
237-
python3 tools/recipes/recipe_json_to_vllm_config.py \
238-
--model meta-llama/Llama-3.1-8B-Instruct \
239-
--hardware xeon6 \
240-
--detect-hardware
241-
```
242-
243-
A tuning request for unregistered recipe hardware, such as `b200`, fails before
244-
host hardware detection:
261+
The current runtime-tuning policy registry contains `xeon6`. A tuning request
262+
for unregistered recipe hardware, such as `b200`, fails before host hardware
263+
detection:
245264

246265
```text
247266
ERROR: Runtime tuning is not supported for recipe hardware 'b200'.
@@ -251,26 +270,6 @@ Currently supported: xeon6.
251270
Plain recipe conversion remains available for all recipe hardware. The gate only
252271
applies when optional runtime-tuning inputs are requested.
253272

254-
### Optimized Deployment Flow
255-
256-
The recipe supplies the validated baseline. The converter can optionally combine
257-
it with the target hardware and workload information, then generate files that
258-
can be consumed directly by a standard vLLM Docker image.
259-
260-
```mermaid
261-
flowchart LR
262-
R["vLLM Recipe"] --> C["Recipe Converter"]
263-
H["Hardware Info"] --> C
264-
W["Optional Workload Info"] --> C
265-
C --> F["config.yml + env.sh"]
266-
F --> D["vLLM Docker Image"]
267-
D --> E["OpenAI Endpoint"]
268-
```
269-
270-
This keeps optimization knowledge in vLLM Recipes and serving in vLLM. The tool
271-
is the deployment bridge that converts a validated recipe plus optional local
272-
deployment information into an immediately consumable vLLM configuration.
273-
274273
The implementation remains modular:
275274

276275
- `hardware_detection.py` collects effective CPU/NUMA/memory information.

0 commit comments

Comments
 (0)