Skip to main content

The 3-Tier Resolver Guide

Models evaluate physics. Solvers find limits. Optimizers search for trade-offs.

MLSys·im provides 276 concrete resolvers covering the 22 Systems Walls across six core domains (Node, Data, Algorithm, Fleet, Ops, and Analysis) plus chapter-specific resolvers across Volumes I–IV (including Agentic AI and Physical AI / Robotics). See the Textbook & Chapter Map for how each resolver aligns with textbook chapters and study sheets.

To make engineering decisions systematic, the tools are organized into a 3-Tier Architecture:

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    A["<b>1. Analytical Models</b><br/><i>Y = f(X)</i><br/><span style='font-size:0.8em;color:#666;'>Evaluate consequences</span>"]
    B["<b>2. Analysis Solvers</b><br/><i>X = f⁻¹(Y)</i><br/><span style='font-size:0.8em;color:#666;'>Find exact limits</span>"]
    C["<b>3. Optimizers (DSE)</b><br/><i>max f(X)</i><br/><span style='font-size:0.8em;color:#666;'>Search design space</span>"]

    A --> B
    A --> C

    style A fill:#e0f2fe,stroke:#0284c7,stroke-width:2px
    style B fill:#fef08a,stroke:#d97706
    style C fill:#dcfce3,stroke:#10b981

  1. Analytical Models (*Model): The Physics Engine. Given a configuration, evaluate the consequences (\(Y = f(X)\)).
  2. Analysis Solvers (*Solver): The Math Engine. Given a target, algebraically solve for the required input (\(X = f^{-1}(Y)\)).
  3. Optimizers (*Optimizer): The Engineering Engine. Search a design space to maximize or minimize an objective (\(\max f(X)\)).
TipQuick Start

Use Engine.solve() for generic single-device Roofline analysis. Use a specialized solver when the question requires its accounting, such as KV-aware decode in ServingModel. See Choosing a Python API for executable examples and the scope of scenarios.


1. Analytical Models (The Physics Engine)

These models answer the question “What happens if I run this exact setup?”

Domain 1: Node (Single-Accelerator Resources)

Model Key Inputs Key Outputs Best For
SingleNodeModel model, hardware, batch_size latency, throughput, bottleneck “Is my model memory-bound?”
TrainingMemoryModel model, hardware, batch_size, seq_len weights, gradients, optimizer, activations “Why does training need so much more memory?”
EfficiencyModel model, hardware, workload_type mfu, achievable FLOP/s “What MFU will my workload achieve?”
ServingModel model, hardware, seq_len TTFT, ITL, KV-cache footprint, decode stall proxy “Can I serve this LLM on this GPU?”
ServingCapacityModel model, hardware, QPS, target P99 replicas, capacity, queue wait “How many replicas do I need for this SLA?”
ContinuousBatchingModel model, hardware, max_seq_len, mean_request_tokens, page_size static vs paged capacity, internal fragmentation, speedup vs static “How much concurrency does paging buy over static KV reservation?”
WeightStreamingModel model, hardware, seq_len, batch_size throughput_tokens_per_sec, optimal_batch_size “Cerebras wafer-scale inference?”
TailLatencyModel arrival_rate_qps, service_latency_ms, num_replicas p50_latency, p99_latency, queue_utilization “Will I meet P99 total latency SLAs?”

Domain 2: Data (Movement & Pipelines)

Model Key Inputs Key Outputs Best For
DataModel workload_data_rate, hardware utilization, is_stalled “Is my storage/IO the bottleneck?”
TransformationModel batch_size, cpu_throughput transform_time, is_bottleneck “Is CPU preprocessing starving my GPU?”
TopologyModel fabric, topology, num_nodes effective_bw, bisection_bw “What topology should I use?”

Domain 3: Algorithm (Scaling & Compression)

Model Key Inputs Key Outputs Best For
ScalingModel compute_budget optimal_parameters, optimal_tokens “What is my optimal model size?”
InferenceScalingModel model, hardware, reasoning_steps total_reasoning_time “How much does CoT reasoning cost?”
CompressionModel model, hardware, method, target_bitwidth, group_size, accuracy_delta compressed_size_gb, compression_ratio, estimated_accuracy_delta “How much memory does group quantization or pruning save?”

Domain 4: Fleet (Multi-Node Coordination)

Model Key Inputs Key Outputs Best For
DistributedModel model, fleet, tp/pp/dp sizes scaling efficiency, comm overhead “How many GPUs do I actually need?”
MoERoutingModel sparse model, batch, seq_len, EP active experts, routed bytes, all-to-all “How much does hot-expert imbalance cost?”
ReliabilityModel fleet, job_duration MTBF, failure probability “Will my training job complete?”
OrchestrationModel fleet, arrival_rate, avg_duration avg_wait_time, utilization “How busy is my cluster?”

Domain 5: Ops (Economics, Sustainability & Safety)

Model Key Inputs Key Outputs Best For
EconomicsModel fleet, duration_days, kwh_price CapEx, OpEx, total TCO “What will this cost over 3 years?”
SustainabilityModel fleet, duration_days, datacenter energy, carbon (kg CO₂e), water “Where should I train to minimize carbon?”
CheckpointModel model, hardware, optimizer checkpoint_size, MFU penalty “How much MFU do I lose to checkpoints?”
ResponsibleEngineeringModel base_training_time, epsilon, delta, sample_rate, steps, clipping_step_overhead noise_multiplier, dp_slowdown_factor, additional_data_requirement “What noise multiplier and clipping overhead does DP-SGD require?”

Domain 6: Agentic & Cyber-Physical Systems

Beyond single-node and datacenter fleet models, mlsysim.solvers exports specialized first-principles resolvers for multi-turn agent harnesses and closed-loop embodied machines (documented in full in the API Reference and Scenarios by Domain):

Representative Model Key Inputs Key Outputs Best For
HorizonCompoundingModel step_success, horizons, target_success, target_horizon step_error, success, required_step_error, first_horizon_below_target “How fast does per-step error compound across an agent horizon?”
AcceptedTaskCostModel model_cost, other_cost, acceptance attempt_cost, attempts_per_acceptance, cost_per_accepted “What is the dollar cost per verified solved task?”
AppendOnlyContextModel initial_tokens, tokens_per_turn, turns, context_window last_call_tokens, cumulative_input_tokens, reread_ratio “How quadratically does append-only agent history bill tokens?”
StoppingBudgetModel speed, delay, deceleration, clear_distance delay_travel, braking_travel, stop_distance, spare, fits “Can a robot or vehicle stop inside its perception horizon?”
PhaseLagBudgetModel crossover, sample_period, compute_delay, transport_delay, phase_allowance total_delay, phase_total, delay_margin, fits “Does inference latency destabilize a closed-loop controller?”
EtherCatCycleModel num_axes, bytes_per_axis, baud_rate, header_bytes, hop_delay, cycle frame_time, occupancy, utilization, fits “Will my fieldbus meet a 1 kHz deterministic control deadline?”

2. Analysis Solvers (The Math Engine)

These solvers answer the question “What exact number do I need to hit my target?”

Solver Key Inputs Key Outputs Best For
SensitivitySolver model, hardware, perturbation_pct sensitivities, binding_constraint “Which parameter should I invest in?”
SynthesisSolver model, target_latency required_bw, required_flops “What hardware do I need for this SLA?”

3. Optimizers & Design Space Exploration (DSE)

Domain optimizers (ParallelismOptimizer, BatchingOptimizer, PlacementOptimizer) search standard configurations directly, while the general-purpose DSE engine sweeps arbitrary multi-dimensional parameter grids under explicit user constraints.

Engine Key Inputs Objective Best For
DSE Engine search space, objective, constraints minimize/maximize “What max batch size is safe for my SLA?” or “Where should I build my datacenter?”

Composing Resolvers

Real-world questions require chaining multiple tiers. Here are three common patterns:

Sizing and costing an H100 serving fleet for Llama-3 8B

from mlsysim import Hardware, Models, Q_
from mlsysim.solvers import ServingCapacityModel, EconomicsModel
from mlsysim.systems.types import Fleet, Node, NetworkFabric

capacity = ServingCapacityModel().solve(
    model=Models.Language.Llama3_8B,
    hardware=Hardware.Cloud.H100,
    qps=40.0,
    target_p99_latency_ms=1500.0,
    max_seq_len=4096,
    mean_request_tokens=1024,
    output_tokens=128,
)
nodes_needed = (capacity.required_replicas + 7) // 8
fleet = Fleet(
    name="Serving-H100",
    node=Node(
        name="8xH100",
        accelerator=Hardware.Cloud.H100,
        accelerators_per_node=8,
        intra_node_bw=Q_("450 GB/s"),
    ),
    count=nodes_needed,
    fabric=NetworkFabric(name="IB-NDR", bandwidth=Q_("50 GB/s")),
)
cost = EconomicsModel().solve(fleet=fleet, duration_days=365, kwh_price=0.08)
print(f"Replicas needed: {capacity.required_replicas} GPUs ({nodes_needed} node(s)), P99: {capacity.estimated_p99_latency:~.0f}")
print(f"Annual TCO:      ${cost.tco_usd:,.0f} (CapEx ${cost.capex_usd:,.0f} + OpEx ${cost.total_opex_usd:,.0f})")
Replicas needed: 1024 GPUs (128 node(s)), P99: 1860 ms
Annual TCO:      $10,375,947 (CapEx $8,533,333 + OpEx $1,842,613)

The parameter that matters most for Llama-8B latency

from mlsysim import Hardware, Models
from mlsysim.solvers import SensitivitySolver

sensitivity = SensitivitySolver().solve(
    model=Models.Language.Llama3_8B,
    hardware=Hardware.Cloud.H100,
    precision="fp16",
    perturbation_pct=10.0
)
print(f"Binding constraint: {sensitivity.binding_constraint}")
print(f"BW sensitivity:     {sensitivity.sensitivities['memory_bandwidth']:+.3f}")
print(f"FLOPS sensitivity:  {sensitivity.sensitivities['peak_flops']:+.3f}")
Binding constraint: memory_bandwidth
BW sensitivity:     -0.091
FLOPS sensitivity:  +0.000

The hardware a 50ms SLA requires

from mlsysim import Models
from mlsysim.solvers import SynthesisSolver
from mlsysim.core.units import Q_

synthesis = SynthesisSolver().solve(
    model=Models.Language.Llama3_8B,
    target_latency=Q_("50 ms"),
    precision="fp16"
)
print(f"Required bandwidth: {synthesis.required_bw.to('TB/s'):~.2f}")
print(f"Required FLOPS:     {synthesis.required_flops.to('TFLOPs/s'):~.1f}")
Required bandwidth: 0.32 TB / s
Required FLOPS:     0.6 TFLOPs / s
Back to top