Papers
Topics
Authors
Recent
Search
2000 character limit reached

Working-Set-Aware Batch Size Control

Updated 14 July 2026
  • The paper presents an adaptive algorithm that uses memory footprint signals to balance throughput, stability, and convergence.
  • It integrates real-time telemetry from memory, CPU, and network metrics to adjust per-node batch sizes in distributed training.
  • Empirical results show improved model accuracy and training speed, with scalability across heterogeneous clusters and policy transfer.

Working-set-aware batch size control is the adaptive selection of batch size from signals that represent the memory footprint that must remain resident, together with compute, communication, and training-dynamics indicators. In distributed machine learning, this problem is explicit in DYNAMIX, which formulates batch size optimization as a sequential decision-making problem solved with Proximal Policy Optimization (PPO): the controller observes memory utilization as a working-set proxy, CPU utilization, throughput, retransmissions, accuracy-derived statistics, and iteration time, then emits per-node batch size adjustments under safety constraints to balance throughput, convergence, and stability (Dai et al., 9 Oct 2025).

1. Definition and operating context

The formal notion of a working set originates in Denning’s definition of the working set at time tt with window size Δ\Delta as the set of distinct pages referenced in the interval [tΔ,t][t-\Delta,t]:

WSS(t,Δ)={pP:p is referenced at least once in [tΔ,t]}.\mathrm{WSS}(t, \Delta) = \left|\{p \in \mathcal{P} : p\text{ is referenced at least once in }[t-\Delta,\, t]\}\right|.

In systems terms, WSS is the memory footprint that must be resident to avoid thrashing; if residency falls short of the current working set, page fault activity, reclamation pressure, and latency increase. This differs from RSS, which counts currently mapped physical pages regardless of whether they are actively used, and from total physical memory usage, which is not attributable to a single workload (Lian et al., 2023).

In distributed training, working-set-aware control treats batch size as a systems-and-optimization variable rather than a fixed hyperparameter. The “right” batch size depends on model phase, optimizer, and the hardware and network state of each node. Static or heuristic batch sizing often fails on heterogeneous clusters because nodes differ in GPU memory, CPU speed, and NIC bandwidth; contention varies over time; the optimal batch size shifts across training phases; and the memory footprint associated with activations, gradients, parameters, and optimizer state changes with micro-batching, mixed precision, and checkpointing. Communication regimes also change: when network congestion rises, large batches reduce synchronization frequency; when GPUs are underutilized, increasing batch size can improve throughput; when memory is tight, smaller batches avoid OOM and paging or thrashing (Dai et al., 9 Oct 2025).

A common misconception is that working-set awareness is equivalent to tracking raw memory occupancy. The systems literature instead distinguishes current usage from temporal locality: WSS measures the set of pages actually touched in a time window, whereas RSS can be inflated by cold pages or deflated by sharing and reclamation. This is why WSS is described as the right signal for dynamic batch size control when the objective is to sustain throughput without triggering page faults and OS reclaim (Lian et al., 2023).

2. Control formulation as a sequential decision problem

DYNAMIX formalizes batch size control as a Markov decision process in which observations are aggregated every kk iterations to stabilize decisions. The local state for worker ii at decision step tt concatenates network-level metrics, system-level utilization, and training statistical efficiency signals; a shared global state includes signals such as global loss trajectory and validation accuracy under BSP (Dai et al., 9 Oct 2025).

Component Definition in DYNAMIX Role
State stis_t^i TptiT p_t^i, RtxtiRtx_t^i, CPU time-to-wall-clock ratio, memory utilization, Δ\Delta0, Δ\Delta1, Δ\Delta2, Δ\Delta3, Δ\Delta4, Δ\Delta5 Senses communication, resource pressure, and training dynamics
Action Δ\Delta6 Δ\Delta7 with Δ\Delta8 Per-node discrete batch adjustment
Bounds Δ\Delta9, [tΔ,t][t-\Delta,t]0 Enforces safe operating range
Reward Accuracy terms, iteration-time penalty, optimizer-specific stability penalties Balances convergence, throughput, and stability

The reward explicitly couples statistical progress to systems efficiency. For SGD, DYNAMIX uses

[tΔ,t][t-\Delta,t]1

For adaptive optimizers such as Adam and LAMB, it adds penalties on gradient-normalization statistics:

[tΔ,t][t-\Delta,t]2

The discounted objective is

[tΔ,t][t-\Delta,t]3

The stated rationale is that the reward encourages accuracy and positive learning trajectory, penalizes slow steps and unstable gradient statistics, and discourages extreme batches, thereby implicitly rewarding working-set-aware decisions that keep memory and compute within safe, efficient regimes (Dai et al., 9 Oct 2025).

PPO is used in standard clipped-surrogate form:

[tΔ,t][t-\Delta,t]4

with

[tΔ,t][t-\Delta,t]5

DYNAMIX also states the standard value and entropy terms,

[tΔ,t][t-\Delta,t]6

and the combined objective

[tΔ,t][t-\Delta,t]7

Generalized Advantage Estimation is given, if used, by

[tΔ,t][t-\Delta,t]8

The implementation reports simplified PPO updates in its low-variance setting (Dai et al., 9 Oct 2025).

3. Working-set modeling, memory footprint, and telemetry

In DYNAMIX, memory utilization is the core working-set signal. It functions as a proxy for when activations, gradients, parameters, and optimizer state approach device capacity. Combined with iteration time and CPU or GPU utilization, this enables the policy to back off when memory utilization is high or fluctuating, exploit headroom when utilization is stable and below thresholds, and distinguish communication-bound from compute-bound phases (Dai et al., 9 Oct 2025).

The paper makes this proxy explicit through a simple footprint model:

[tΔ,t][t-\Delta,t]9

where WSS(t,Δ)={pP:p is referenced at least once in [tΔ,t]}.\mathrm{WSS}(t, \Delta) = \left|\{p \in \mathcal{P} : p\text{ is referenced at least once in }[t-\Delta,\, t]\}\right|.0 includes parameters, optimizer states, and persistent buffers, and WSS(t,Δ)={pP:p is referenced at least once in [tΔ,t]}.\mathrm{WSS}(t, \Delta) = \left|\{p \in \mathcal{P} : p\text{ is referenced at least once in }[t-\Delta,\, t]\}\right|.1 covers per-sample activations and gradients. The corresponding safe-batch constraint is

WSS(t,Δ)={pP:p is referenced at least once in [tΔ,t]}.\mathrm{WSS}(t, \Delta) = \left|\{p \in \mathcal{P} : p\text{ is referenced at least once in }[t-\Delta,\, t]\}\right|.2

and, with a headroom margin WSS(t,Δ)={pP:p is referenced at least once in [tΔ,t]}.\mathrm{WSS}(t, \Delta) = \left|\{p \in \mathcal{P} : p\text{ is referenced at least once in }[t-\Delta,\, t]\}\right|.3,

WSS(t,Δ)={pP:p is referenced at least once in [tΔ,t]}.\mathrm{WSS}(t, \Delta) = \left|\{p \in \mathcal{P} : p\text{ is referenced at least once in }[t-\Delta,\, t]\}\right|.4

This provides a direct interpretation of “working-set-aware” control: batch size is admitted only when the estimated footprint fits comfortably inside available memory (Dai et al., 9 Oct 2025).

Several standard memory-saving techniques change WSS(t,Δ)={pP:p is referenced at least once in [tΔ,t]}.\mathrm{WSS}(t, \Delta) = \left|\{p \in \mathcal{P} : p\text{ is referenced at least once in }[t-\Delta,\, t]\}\right|.5 and therefore change the admissible control region. Mixed precision reduces both WSS(t,Δ)={pP:p is referenced at least once in [tΔ,t]}.\mathrm{WSS}(t, \Delta) = \left|\{p \in \mathcal{P} : p\text{ is referenced at least once in }[t-\Delta,\, t]\}\right|.6 and WSS(t,Δ)={pP:p is referenced at least once in [tΔ,t]}.\mathrm{WSS}(t, \Delta) = \left|\{p \in \mathcal{P} : p\text{ is referenced at least once in }[t-\Delta,\, t]\}\right|.7; activation checkpointing reduces WSS(t,Δ)={pP:p is referenced at least once in [tΔ,t]}.\mathrm{WSS}(t, \Delta) = \left|\{p \in \mathcal{P} : p\text{ is referenced at least once in }[t-\Delta,\, t]\}\right|.8 at a compute cost; gradient accumulation and micro-batching decouple per-device memory from global batch; and per-buffer instrumentation can sharpen pre-checks before an increase. DYNAMIX notes that users can extend the state with per-GPU memory used and free, allocation and free headroom, per-buffer footprints, cache and NUMA counters, PCIe or NVLink utilization, disk and I/O queue depth, and NIC bandwidth (Dai et al., 9 Oct 2025).

A stricter notion of working-set telemetry comes from OS-level WSS estimation. An eBPF-based method attaches a kprobe to __handle_mm_fault, records per-pid page fault counts in BPF_HASH maps, emits samples through BPF_PERF_OUTPUT(events), and uses page fault count together with inter-sample interval WSS(t,Δ)={pP:p is referenced at least once in [tΔ,t]}.\mathrm{WSS}(t, \Delta) = \left|\{p \in \mathcal{P} : p\text{ is referenced at least once in }[t-\Delta,\, t]\}\right|.9 as features for a LightGBM 3.3.2 regression model. The reported implementation uses Linux 5.13.0 and BCC v0.23.0, reports average RMSE kk0, average update latency kk1 s per sample window, a 65kk2 reduction in time overhead relative to Brendan Gregg’s vanilla WSS tool, and a 98.5% overhead reduction relative to traditional VM-based methods (Lian et al., 2023). DYNAMIX itself does not require such explicit WSS estimation; it uses memory utilization as the working-set proxy. A plausible implication is that eBPF-style WSS estimators could refine the state when page-fault behavior is a dominant failure mode.

4. Distributed operation and per-node adaptation

Working-set-aware batch size control is particularly motivated by BSP-style distributed training, where per-rank imbalance produces stragglers and communication stalls. DYNAMIX uses a centralized agent that emits per-node actions from local state kk3 plus shared global state kk4, allowing fast nodes to increase batch size while slower or memory-constrained nodes decrease it. The stated effect is mitigation of stragglers under BSP and improved alignment between per-rank compute and communication capacity (Dai et al., 9 Oct 2025).

The communication logic is bidirectional rather than monotone. Larger batches reduce synchronization frequency, amortize all-reduce latency, and lower sensitivity to retransmissions or low throughput; however, they also increase per-synchronization payload, so further increases can hurt throughput if NIC, PCIe, or NVLink utilization saturates. DYNAMIX therefore includes throughput kk5 and retransmissions kk6 in the state to sense compute-bound versus communication-bound regimes and adapt batch size accordingly (Dai et al., 9 Oct 2025).

Operationally, DYNAMIX aggregates observations over kk7 iterations before each decision, uses discrete increments kk8 and kk9 to smooth updates, and applies guardrails such as bounds, headroom checks, and rejection of increases after OOM or timeout events. The reported online loop is: run ii0 iterations at current ii1; collect ii2, ii3, CPU ratio, memory utilization, ii4, ii5, ii6, ii7, ii8, and ii9; build local and global state; compute action; enforce constraints; apply the new batch; run the next tt0 iterations; compute reward; and update PPO. Optional guardrails include hysteresis, cooldowns, and per-node clipping based on recent OOM or timeout history (Dai et al., 9 Oct 2025).

The implementation claims low systems overhead: workers collect metrics with low overhead using eBPF for system and network telemetry and the training loop for accuracy and timing signals, and the decision-making overhead is reported as less than 0.1% of iteration time across tested settings. This is significant because explicit memory and communication models are avoided; instead, the controller learns from observed signatures of the working set (Dai et al., 9 Oct 2025).

5. Relation to batch-size theory and adjacent adaptive methods

Batch size has long been understood as a control on optimization noise. One influential result showed that learning-rate decay can often be replaced by increasing batch size while preserving training and test curves, with the noise scale for SGD approximated by

tt1

and, with momentum tt2,

tt3

This yields the operational scaling rules tt4 and tt5, together with the recommendation to keep tt6 and often below roughly tt7 before reverting to learning-rate decay (Smith et al., 2017). Stagewise Enlargement of Batch Size (SEBS) provides a complementary theoretical account: under bounded gradient variance, tt8-smoothness, tt9-weak quasi-convexity, and the stis_t^i0-PL condition, it links proper batch size to the gap between initialization and optimum and enlarges batch size geometrically by stage while maintaining computation complexity stis_t^i1 and reducing iteration complexity to stis_t^i2 (Zhao et al., 2020).

A different line of work seeks to learn or estimate the optimal batch size online. For strongly convex and smooth objectives, adaptive SGD can choose

stis_t^i3

where stis_t^i4 is an expected-smoothness term induced by the sampling rule and stis_t^i5 is the gradient noise at the optimum under batch size stis_t^i6 (Alfarra et al., 2020). For Transformers, another dynamic criterion monitors the angle between successive accumulated gradients,

stis_t^i7

and triggers an optimizer step when the newest angle exceeds stis_t^i8, with reported default stis_t^i9 (Xu et al., 2020). DYNAMIX adopts yet another control surface: it does not estimate an optimal batch size from optimization statistics alone, but jointly conditions on training signals, resource utilization, and communication state (Dai et al., 9 Oct 2025). This suggests a broader formulation in which classical schedule-based enlargement and systems-aware control occupy different points on the same design spectrum.

The importance of this distinction is reinforced by domains in which smaller, not larger, batches improve learning. In replay-based deep RL, reducing batch size from 32 to 8 in QR-DQN produced significant gains on 38 of 60 ALE games, an average performance improvement of 98.25%, and a 29% wall-time speedup, indicating that optimal batch behavior is highly objective- and regime-dependent rather than universally increasing with system capacity (Obando-Ceron et al., 2023). Working-set-aware control therefore does not imply monotone enlargement; it implies conditioning batch size on the active statistical and systems regime.

6. Empirical results, deployment practice, and limitations

DYNAMIX reports up to 6.3% improvement in final model accuracy and up to 46% reduction in total training time relative to static batch baselines, with scalability to 32 nodes and policy transfer across related architectures (Dai et al., 9 Oct 2025).

Setting Static baseline DYNAMIX
BytePS heterogeneous cluster, 8 GPUs (RTX 3090/T4 mix) TptiT p_t^i0, TptiT p_t^i1 s, 71.4% TptiT p_t^i2 s, 80%
OSC, 8 nodes, VGG16/SGD TptiT p_t^i3, 85.3% in 853 s 91.3% in 652 s
OSC, 16 nodes, VGG16/SGD TptiT p_t^i4, 83.4% in 543 s 91.5% in 479 s
OSC, 32 nodes, VGG16/SGD TptiT p_t^i5, 81.3% in 734 s 92.6% in 421 s

The paper also reports policy transfer: policies trained on VGG16 transfer to VGG19, and policies trained on ResNet34 transfer to ResNet50, maintaining benefits without retraining. The evaluated baselines are static batch sizes chosen via standard practice; heuristic controllers and linear scaling rules are discussed in related work but are not directly benchmarked. No ablations are reported that isolate individual state features or reward components (Dai et al., 9 Oct 2025).

Deployment guidance centers on instrumentation and guardrails. The recommended telemetry includes GPU memory used and free, allocator headroom, OOM counters, footprint proxies for parameters and optimizer states, activation and gradient buffers, per-sample memory estimate TptiT p_t^i6, iteration time TptiT p_t^i7, samples per second, batch and validation accuracy, loss slope, gradient norm and variance proxies TptiT p_t^i8 and TptiT p_t^i9, CPU and GPU utilization, NIC throughput, retransmissions, PCIe or NVLink bandwidth, queue backlogs, and optional cache or NUMA metrics. The paper recommends maintaining memory headroom RtxtiRtx_t^i0, for example 5–10% of device memory, rejecting actions that violate the footprint constraint, capping iteration time with rollback if RtxtiRtx_t^i1 exceeds a threshold, and aligning decisions with DDP or BSP barriers (Dai et al., 9 Oct 2025).

The stated limitations are characteristic of RL-based runtime control. Non-stationarity and delayed rewards challenge credit assignment; longer aggregation windows RtxtiRtx_t^i2 improve stability but slow responsiveness. The paper identifies constrained RL as a way to encode explicit OOM or time caps and communication budgets, model-based predictors of RtxtiRtx_t^i3 or communication time as a way to tighten guardrails and reduce exploration costs, and deeper working-set awareness via per-layer activation footprint, cache and NUMA locality, and allocator fragmentation models as directions for future work (Dai et al., 9 Oct 2025).

The same general principle appears outside training. In LLM inference, memory-aware and SLA-constrained dynamic batching monitors residual memory budget and latency, treating KV cache as the dominant dynamic component of the working set; the reported outcome is throughput gains of 8% to 28% and capacity improvements of 22% relative to static batching in vLLM-compatible settings (Pang et al., 7 Mar 2025). This broader pattern supports the view that working-set-aware batch size control is not a single algorithm but a systems-optimization interface: batch size becomes a runtime control variable governed by resident footprint, communication regime, and task-level efficiency criteria.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Working-Set-Aware Batch Size Control.