solvers.InferenceScalingModel
solvers.InferenceScalingModel()Models inference-time compute scaling (Wall 12: Reasoning/CoT Cost).
This model quantifies the cost of ‘System-2 thinking’ — inference-time compute scaling via chain-of-thought (CoT) reasoning, where the model generates K intermediate reasoning steps before producing the final answer. Each step incurs the full cost of autoregressive decoding.
Literature Source: 1. Wei et al. (2022), “Chain-of-Thought Prompting Elicits Reasoning in Large Language Models.” 2. Snell et al. (2024), “Scaling LLM Test-Time Compute Optimally Can Be More Effective Than Scaling Model Parameters.” 3. OpenAI (2024), “Learning to Reason with LLMs.” (o1 reasoning model.)
Methods
| Name | Description |
|---|---|
| solve | Solve for inference-time reasoning cost. |
solve
solvers.InferenceScalingModel.solve(
model,
hardware,
reasoning_steps=8,
context_length=2048,
precision='fp16',
efficiency=0.5,
)Solve for inference-time reasoning cost.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| model | TransformerWorkload | The language model used for reasoning. | required |
| hardware | HardwareNode | The target hardware node. | required |
| reasoning_steps | int | Nonnegative reasoning-step count K; each uses the declared token budget. | 8 |
| context_length | int | Positive fixed input context length in tokens. | 2048 |
| precision | str | Weight and KV element precision, such as fp16 or int8. | 'fp16' |
| efficiency | float | Compute efficiency fraction in (0, 1]; default 0.5. | 0.5 |
Returns
| Name | Type | Description |
|---|---|---|
| InferenceScalingResult | Total reasoning time, TDP-based energy per query in joules, and token counts. |
See Also
ServingModel.solve : Prefill, decode, and memory feasibility.
Notes
Equation: generated_tokens = K*N_step; T = TTFT + K*N_step*ITL; energy = TDP*T when TDP is available, otherwise zero is returned. N_step is the declared TOKENS_PER_REASONING_STEP calibration default.
Assumptions: nonnegative reasoning-step count, fixed context for every decode step, and the batch-one ServingModel assumptions. Excludes: reasoning-quality prediction, growing contexts, verification work, measured power, and price. Feasibility is inherited from serving; a computed duration for an infeasible configuration is not deployable.
References
Derivation: multiply a supplied step count by an assumed token budget and per-token latency, then add one prefill. Energy uses a TDP-time proxy; neither token budget nor power is a measured workload trace.
Examples
>>> from mlsysim import Hardware, Models
>>> from mlsysim.solvers import InferenceScalingModel
>>> solver = InferenceScalingModel()
>>> a = solver.solve(Models.Language.Llama3_8B, Hardware.Cloud.H100, reasoning_steps=1)
>>> b = solver.solve(Models.Language.Llama3_8B, Hardware.Cloud.H100, reasoning_steps=2)
>>> bool(b.tokens_generated == 2*a.tokens_generated and b.total_reasoning_time > a.total_reasoning_time)
True