---
title: Partitioned Buffer Sampling
url: https://www.emergentmind.com/topics/partitioned-buffer-sampling
type: topic
---

# Partitioned Buffer Sampling

Partitioned Buffer Sampling refers to a class of algorithms and methodologies wherein a memory buffer is divided or managed according to specific sampling strategies designed to efficiently retain representative or high-utility data—either in continual learning settings for machine learning or for scalable partitioning in streaming graph analytics. Exemplified by advanced techniques in both continual learning (e.g., class-adaptive buffer partitioning) and graph processing (e.g., buffered streaming graph partitioning), partitioned buffer sampling addresses the dual challenge of memory efficiency and computational performance by employing principled measurement of sample or node importance, difficulty, or contribution prior to sampling and placement. The predominant goal is to maximize learning stability, data representativeness, or partition quality under fixed or constrained buffer capacity.

## 1. Conceptual Foundations of Partitioned Buffer Sampling

Partitioned buffer sampling arises in scenarios where it is infeasible or suboptimal to store all historical data for streaming or sequential tasks, due to limited memory or computational budgets. Unlike uniform or reservoir sampling, which uniformly allocate buffer slots or treat all samples equally, partitioned buffer sampling selectively allocates buffer space among "partitions"—with the definition of partition varying by context (e.g., per-class in continual learning, per batch of vertices in graph streaming).

In continual learning, class-adaptive buffer partitioning assigns buffer slots based on the measured “difficulty” or volatility of class samples, thereby improving long-term knowledge retention and minimizing catastrophic forgetting [2311.16485]. In streaming graph partitioning, the buffered streaming model enables improved vertex assignment decisions by first accumulating a batch of vertices, constructing a local model graph, and then partitioning with reference to both current and historical graph structure [2102.09384].

## 2. Methodological Frameworks

### Continual Learning: Class-Adaptive Partitioning

The Class-Adaptive Sampling Policy (CASP) exemplifies partitioned buffer sampling in the continual learning domain. Let $D_1, D_2, \dots, D_T$ be a sequence of disjoint tasks, each with data $D_t = \{(X_i, Y_i)\}$ and $K_t$ classes. A fixed-capacity buffer $B$ maintains at most $M$ examples, with per-class quota $q_j = |B_t(C_j)|$ such that $\sum_j q_j = M_t$ after task $t$. CASP measures per-class and per-sample “vulnerability” by tracking fluctuations in softmax confidence during surrogate model training:
- Per-sample vulnerability: $V(X_i) = \sqrt{\frac{1}{E} \sum_{e=1}^E (\gamma_i(e) - \bar\Gamma(X_i))^2}$, where $\gamma_i(e) = P_{\hat{\theta}_e}(Y_i|X_i)$ and $E$ is the number of surrogate epochs.
- Per-class vulnerability: $V(C_j) = \sqrt{\frac{1}{E} \sum_{e=1}^E (\Gamma(C_j, e) - \bar\Gamma(C_j))^2}$, with $\Gamma(C_j, e)$ the average confidence for class $C_j$ at epoch $e$.

Buffer slots are allocated proportional to $V(C_j)$:
$$
q_j \leftarrow \mathrm{round}\left[ \frac{V(C_j)}{\sum_{l=0}^{K_t-1} V(C_l)} \cdot M_t \right].
$$
Within each class, the $q_j$ most challenging samples (highest $V(X_i)$) are retained [2311.16485].

### Streaming Graph Partitioning: Buffered and Batched Vertex Assignment

In the “HeiStream” algorithm, the buffer comprises a batch of $\delta$ vertices and their edges, received as a single batch from a streaming input. A model graph $\mathcal{B}$ is constructed to represent both the batch and the current $k$-partition of assigned vertices:
- The induced subgraph among buffered vertices;
- $k$ artificial “block-nodes” summarizing already-assigned partitions;
- Edges from current-batch vertices to block-nodes, weighted by incident edge counts to respective partitions;
- Optionally, “ghost edges” to represent future or unseen neighbors via contraction and halved edge weight.

The model graph is then subjected to a multilevel partitioning process:
1. Coarsening via size-constrained label propagation (SCLaP);
2. Initial partitioning at the coarsest level using a generalized Fennel objective;
3. Uncoarsening with further SCLaP-based local refinement;
4. Final assignment of batch vertices to balanced blocks, subject to buffer (batch) constraints [2102.09384].

## 3. Algorithmic Workflows

### CASP in Continual Learning

CASP's buffer update can be summarized as:
1. Train a surrogate model on $D_t$ for $E$ epochs, recording softmax probabilities for each sample.
2. Compute per-sample and per-class confidence means and vulnerabilities.
3. Allocate buffer quotas per class based on vulnerability measures.
4. For each class, select the $q_j$ highest-vulnerability samples to retain.
5. Merge with prior buffer if necessary, evicting or discarding samples to maintain capacity [2311.16485].

During ongoing training, replay batches are sampled uniformly at random from the constructed, partitioned buffer; CASP modifies only the construction, not the sampling, of the buffer itself.

### HeiStream in Buffered Streaming Graph Partitioning

The key steps per vertex batch:
1. Build the model graph $\mathcal{B}$ from the incoming batch and existing partitions.
2. Iteratively coarsen $\mathcal{B}$ via SCLaP until subgraph size falls below a threshold.
3. Partition the coarsest graph using the generalized Fennel objective.
4. Uncoarsen, refining with SCLaP-based moves.
5. Assign batch vertices permanently to blocks subject to balance constraints [2102.09384].

## 4. Complexity and Performance Characteristics

### Translation to Computational Complexity

For CASP:
- Surrogate model training: $O(E \cdot |D_t| \cdot C)$ per task ($E$ epochs, $C$ per step).
- Computing vulnerability: $O(E \cdot |D_t|)$.
- Sorting per class for selection: $O(\sum_j |C_j| \log |C_j|)$.
- Buffer sampling overhead is negligible compared to standard experience replay; CASP adds only $\sim$5–10% overhead and is an order of magnitude faster than gradient or Shapley-based alternatives due to one-update-per-task frequency [2311.16485].

For HeiStream:
- Space: $O(\delta + k)$.
- Multilevel coarsening and refinement: $O(|\mathcal{B}| + |E_\mathcal{B}|)$ per batch, $O(n+m)$ total over all batches and levels.
- Initial partitioning: $O(|\mathcal{B}|)$ per batch.
- Overall, running time is independent of $k$; classic streaming models scale as $O(nk + m)$ [2102.09384].

### Experimental Findings

CASP (Continual Learning):
- On Split CIFAR100 (10 tasks × 10 classes), CASP+ER increases average end accuracy from 13.26% to 16.81% and reduces average forgetting from 52.56 to 50.27.
- Gains extend across MIR, SCR, DVC, PCR methods.
- Outperforms GSS and ASER in accuracy (by 4–6 pp) and forgetting (by 3–8 pp) while being 4–6× faster.
- Ablations confirm superiority of high-vulnerability class allocation and top-challenging sample selection [2311.16485].

HeiStream (Graph Partitioning):
- For batch size $\delta = 32$k, HeiStream achieves 75.9% fewer edge cuts than Fennel and produces the best solution for 63.3% of test instances.
- Extended model with ghost edges further improves cut at additional cost.
- Supports partitioning of graphs up to 100 million nodes and 1 billion edges with 16 GB RAM, outperforming alternatives in edge cut and scalability [2102.09384].

| Setting              | Method        | Key Metrics/Improvements      |
|----------------------|--------------|------------------------------|
| Continual Learning   | CASP+ER      | +3.55 pp accuracy, −2.29 forgetting (CIFAR100, ER) |
| Graph Partitioning   | HeiStream    | −75.9% edge cut vs Fennel ($\delta=32$k)    |

## 5. Comparative Significance and Context

Partitioned buffer sampling advances beyond classical uniform or reservoir sampling by introducing adaptive, statistics-driven allocation within the buffer. In continual learning, this addresses the underappreciated heterogeneity in class difficulty and its impact on forgetting and transfer, resulting in superior stability–plasticity trade-offs at minimal additional cost. In streaming graph partitioning, buffering batches enables the use of multilevel partitioners—offering a solution quality akin to offline methods while maintaining memory and time efficiency suited for streaming.

This method bridges the gap between lightweight streaming and high-quality offline algorithms, as indicated by the superior results of HeiStream over state-of-the-art streaming partitioners such as Fennel and LDG, both in terms of cut quality and computational overhead [2102.09384].

## 6. Applications and Extensions

Partitioned buffer sampling is broadly applicable in:
- Continual learning for deep neural networks, where buffer partitioning policies such as CASP can be plugged into existing experience replay backbones (ER, MIR, SCR, DVC, PCR) for robust long-term adaptation [2311.16485].
- Massive graph partitioning in resource-constrained environments, enabling single-pass, memory-efficient block assignment at quality levels previously accessible only to offline algorithms [2102.09384].

A plausible implication is that further extensions of buffer partitioning schemes, e.g., per-instance adaptation or temporal-difficulty weighting, could generalize to other memory-limited optimization domains.

## 7. Limitations and Trade-Offs

Partitioned buffer sampling inherits several trade-offs:
- The degree of adaptivity is bounded by the reliability of vulnerability or contribution estimates—overfitting or under-estimation may skew buffer representation.
- In streaming graph partitioning, buffer (batch) size $\delta$ must be tuned; small $\delta$ converges to lower-quality streaming, large $\delta$ increases memory and may slow updates.
- Advanced model-graph features (e.g., ghost edges) improve partition quality but at the cost of additional computation per batch, reflected in increased per-batch processing time [2102.09384].

In summary, partitioned buffer sampling operationalizes principled, adaptive memory allocation in settings where data arrives sequentially and storage constraints preclude exhaustive retention, achieving demonstrably superior empirical outcomes across learning and partitioning domains [2311.16485][2102.09384].

Source: https://www.emergentmind.com/topics/partitioned-buffer-sampling