fix(estimator): correct multi-GPU memory estimates #163
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 372 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.354
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #163"
general
weight: 0.35
xingliu-netizen
What
The memory estimator underestimates or misreports per-GPU VRAM when
num_gpus > 1:device_map="balanced") isn't modeled. Every term is divided bynum_gpus, even though one process runs the whole micro-batch.Why and fixes
count_fsdp_gatheradds4 × max(root_unit, decoder_block)parameters (16-bit weight + gradient), as DeepSpeed'sestimate_zero3_model_states_mem_needsdoes. The root unit is the embeddings, plus thelm_headwhen it isn't tied.enable_model_splittingstops dividingtokens_per_gpuand divides only the layer activations. Output logits stay whole, because the last GPU holds all of them.num_gpusbefore the comparison, so both sides are per GPU.Changes
BasicEstimator: newcount_fsdp_gatherargument (defaultFalse);_calc_additionalnow returns the gather term when it's enabled andnum_gpus > 1; storestrust_remote_code.LoRAEstimator/QLoRAEstimator: newenable_model_splittingargument (defaultFalse);_resolve_tokens_per_gpuand a new_calc_intermediate_activationsoverride handle split mode.QLoRAEstimator._apply_overhead: per-GPU offload comparison.OSFTEstimator,OSFTEstimatorExperimental,estimate(): pass the new flags through and document them.num_gpus > 1.Test
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
New Features
Memory estimates can account for FSDP gather memory when enabled.
LoRA and QLoRA estimates can account for model splitting across GPUs and report per-GPU memory.
LoRA estimates reflect full per-process micro-batches and replicated models when splitting is disabled.
LoRA and QLoRA estimates support configurable target modules and fused-loss selection, including related output-head memory.
Estimates account for dense, multimodal, and mixture-of-experts configurations, QLoRA weight precision, and decoder-layer working memory.
Model-size information can be cached in the user’s cache directory; estimates remain available if caching fails.
Documentation
* Clarified estimate calibration, batch-size interpretation, model splitting, and cache behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->