guidellm.benchmark.schemas.base
Base schemas for benchmark execution, metric accumulation, and result compilation.
Defines abstract interfaces and configuration models for coordinating benchmark execution with schedulers. The module centers around three key abstractions: BenchmarkConfig encapsulates execution parameters and constraints; BenchmarkAccumulator tracks incremental metrics during scheduler runs; and Benchmark compiles final results with comprehensive latency, throughput, and concurrency distributions. Supports configurable warmup/cooldown phases, transient period handling, and flexible metric sampling strategies.
BenchmarkAccumulatorT = TypeVar('BenchmarkAccumulatorT', bound='BenchmarkAccumulator[Any, Any]') module-attribute
Generic type variable for benchmark accumulator implementations
BenchmarkT = TypeVar('BenchmarkT', bound='Benchmark') module-attribute
Generic type variable for benchmark result implementations
Benchmark
Bases: StandardBaseDict, ABC, Generic[BenchmarkAccumulatorT]
Compile and expose final benchmark execution metrics.
Defines the interface for benchmark result implementations capturing comprehensive performance metrics including latency distributions, throughput measurements, and concurrency patterns. Subclasses implement compilation logic to transform accumulated metrics and scheduler state into structured results with statistical summaries.
Source code in src/guidellm/benchmark/schemas/base.py
duration abstractmethod property
Returns:
| Type | Description |
|---|---|
float | Benchmark execution duration in seconds |
end_time abstractmethod property
Returns:
| Type | Description |
|---|---|
float | Benchmark completion timestamp in seconds since epoch |
request_concurrency abstractmethod property
Returns:
| Type | Description |
|---|---|
StatusDistributionSummary | Statistical distribution of concurrent request counts |
request_latency abstractmethod property
Returns:
| Type | Description |
|---|---|
StatusDistributionSummary | Statistical distribution of request latencies |
request_throughput abstractmethod property
Returns:
| Type | Description |
|---|---|
StatusDistributionSummary | Statistical distribution of throughput measurements |
start_time abstractmethod property
Returns:
| Type | Description |
|---|---|
float | Benchmark start timestamp in seconds since epoch |
compile(accumulator, scheduler_state) abstractmethod classmethod
Transform accumulated metrics into final benchmark results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
accumulator | BenchmarkAccumulatorT | Accumulator instance with collected metrics and state | required |
scheduler_state | SchedulerState | Scheduler's final state after execution completion | required |
Returns:
| Type | Description |
|---|---|
Any | Compiled benchmark instance with complete statistical results |
Source code in src/guidellm/benchmark/schemas/base.py
BenchmarkAccumulator
Bases: StandardBaseDict, ABC, Generic[RequestT, ResponseT]
Track and accumulate benchmark metrics during scheduler execution.
Maintains incremental metric estimates as requests are processed, enabling real-time progress monitoring and efficient metric compilation. Subclasses implement specific metric calculation strategies based on request/response characteristics and scheduler state evolution.
Source code in src/guidellm/benchmark/schemas/base.py
update_estimate(response, request, info, scheduler_state) abstractmethod
Incrementally update metrics with completed request data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
response | ResponseT | None | Backend response data if request succeeded | required |
request | RequestT | Request instance submitted to backend | required |
info | RequestInfo | Request timing, status, and execution metadata | required |
scheduler_state | SchedulerState | Current scheduler state with queue and concurrency info | required |
Source code in src/guidellm/benchmark/schemas/base.py
BenchmarkConfig
Bases: StandardBaseDict
Encapsulate execution parameters and constraints for benchmark runs.
Defines comprehensive configuration including scheduler strategy, constraint sets, transient phase handling, metric sampling preferences, and execution metadata. Coordinates profile, request, backend, and environment configurations to enable reproducible benchmark execution with precise control over metric collection.
Source code in src/guidellm/benchmark/schemas/base.py
TransientPhaseConfig
Bases: StandardBaseModel
Configure warmup and cooldown phases for benchmark execution.
Supports flexible phase definition through percentage or absolute value specifications with multiple interpretation modes. Phases can be bounded by duration, request count, or both, enabling precise control over transient periods that should be excluded from final benchmark metrics.
Source code in src/guidellm/benchmark/schemas/base.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | |
compute_limits(max_requests, max_seconds, enforce_preference=True)
Calculate phase boundaries from benchmark constraints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_requests | int | float | None | Total request budget for benchmark execution | required |
max_seconds | float | None | Total duration budget for benchmark execution | required |
enforce_preference | bool | Whether to enforce preferred mode when both duration and request constraints are available | True |
Returns:
| Type | Description |
|---|---|
tuple[float | None, int | None] | Tuple of (phase duration in seconds, phase request count) |
Source code in src/guidellm/benchmark/schemas/base.py
compute_transition_time(info, state, period)
Determine transition timestamp for entering or exiting phase.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
info | RequestInfo | RequestInfo for current request to calculate against | required |
state | SchedulerState | SchedulerState with current progress metrics and scheduler info | required |
period | Literal['start', 'end'] | Phase period, either "start" for warmup or "end" for cooldown | required |
Returns:
| Type | Description |
|---|---|
tuple[bool, float | None] | Tuple of (phase active flag, transition timestamp if applicable) |
Source code in src/guidellm/benchmark/schemas/base.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | |
create_from_value(value) classmethod
Create configuration from flexible input formats.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value | int | float | dict | TransientPhaseConfig | None | Configuration as int/float (percent if <1.0, absolute otherwise), dict (validated to model), TransientPhaseConfig instance, or None for defaults | required |
Returns:
| Type | Description |
|---|---|
TransientPhaseConfig | Configured TransientPhaseConfig instance |
Raises:
| Type | Description |
|---|---|
ValueError | If value type is unsupported |