[Bug]/[Feature]: Dense CPU offload TPS ignores measured DDR bandwidth and the actual GPU/RAM split
Bug description
llmfit already measures effective system RAM bandwidth and uses ddr_bandwidth_gbps when estimating MoeOffload throughput.
However, ordinary dense CpuOffload does not appear to use that measured DDR bandwidth when estimating decode speed.
For a dense model that does not fully fit in VRAM, the current estimator effectively starts from the GPU-bandwidth roofline and applies the CpuOffload run-mode factor.
That means two systems with the same GPU but very different system-memory bandwidth can receive essentially the same CPU-offload TPS estimate, even though the RAM-resident portion of the model may dominate inference time.
Current behavior
The normal bandwidth path computes approximately:
active_gb = params × quant_bytes_per_param
raw_tps = gpu_bandwidth / active_gb × efficiency
estimated_tps = raw_tps × run_mode_factorFor CpuOffload, this still starts from GPU bandwidth.
By contrast, MoeOffload has a dedicated DDR-aware path:
expert_read_time = active_gb / ddr_bandwidth
gpu_compute_time = active_gb / (gpu_bandwidth × efficiency)
tps = 1 / (expert_read_time + gpu_compute_time)estimate_basis.ddr_bandwidth_gbps is likewise currently populated for MoeOffload, but not ordinary CpuOffload.
Why this matters
For a dense model partially resident in VRAM and partially resident in system RAM, the two portions operate at dramatically different memory bandwidths.
For example, a discrete GPU may provide roughly:
GPU VRAM: 900+ GB/s
System RAM: 40–100 GB/sIf a substantial percentage of the weights are processed from system RAM, representing the entire model using the GPU bandwidth and then applying a fixed multiplier can significantly misestimate actual throughput.
This becomes especially important when llmfit is being used programmatically to choose between quantizations or models near the VRAM limit.
Expected behavior
Dense CpuOffload should use a mixed GPU + DDR bandwidth model.
Conceptually:
gpu_time = gpu_resident_bytes / effective_gpu_bandwidth
ram_time = ram_resident_bytes / effective_ddr_bandwidth
time_per_token = gpu_time + ram_time
estimated_tps = 1 / time_per_tokenThe existing measured ddr_bandwidth_gbps should be reused rather than adding another RAM benchmark.
A more complete version could include the existing efficiency/run-mode calibration factors as appropriate.
Determining the split
Ideally, the estimator should use the same estimated layer/tensor placement that the run plan expects llama.cpp to use.
If an exact placement cannot be known before runtime, an approximate layer-granular split would still be preferable to treating the entire model as GPU-bandwidth-bound.
At minimum:
GPU-resident weight bytes = bytes assigned to VRAM
RAM-resident weight bytes = remaining offloaded weight bytesThe estimate should not assume a smooth byte split if the planner already has enough information to approximate the actual layer split.
Estimate provenance
For a CpuOffload estimate, estimate_basis should also expose the RAM bandwidth used:
{
"gpu_bandwidth_gbps": 912,
"ddr_bandwidth_gbps": 55,
"method": "gpu_ddr_offload_roofline"
}This would make the estimate reproducible and distinguish it from a GPU-only roofline.
Existing functionality that should be reused
llmfit already has:
- effective RAM bandwidth measurement
CalcConfig::ddr_bandwidth_gbpsLLMFIT_DDR_BANDWIDTH- hardware-profile DDR bandwidth overrides
- GPU memory-bandwidth detection
CpuOffloadrun-mode detection- DDR-aware
MoeOffloadestimation estimate_basisprovenance
The missing piece appears to be applying both GPU and DDR bandwidth to ordinary dense CPU+GPU offload.
Related issues
- #3 introduced CPU/RAM offloading support at a broad level.
- #805 fixed the separate MoE/
CpuOffloadestimator problem and explicitly left dense model behavior unchanged. - #921 fixed another MoE estimation path.
- #1036 is related to beyond-VRAM inference, but specifically concerns Unsloth Studio's runtime behavior rather than the generic llama.cpp-style dense
CpuOffloadestimator.
Suggested acceptance criteria
- Dense
CpuOffloadTPS depends on both GPU bandwidth and DDR bandwidth. - Changing
ddr_bandwidth_gbpschanges dense offload TPS when some model weights reside in RAM. - Fully GPU-resident models remain unchanged.
-
MoeOffloadretains its existing MoE-specific estimator rather than being double-adjusted. -
estimate_basis.ddr_bandwidth_gbpsis populated for DDR-dependentCpuOffloadestimates. - The estimator uses an estimated layer/tensor split when available instead of an arbitrary fixed offload multiplier.
- Tests verify that slower DDR produces lower TPS for an otherwise identical partially offloaded dense model.
- Tests verify convergence toward the existing GPU estimate as the RAM-resident portion approaches zero.
Goal
Make pre-runtime TPS estimates reflect the actual bottleneck of dense CPU+GPU inference: the portion of model traffic served by VRAM should use GPU bandwidth, while the portion served by system RAM should use the already-measured DDR bandwidth.
Source: AlexsJones/llmfit