verl icon indicating copy to clipboard operation
verl copied to clipboard

[RFC] A crash-durable replay buffer for the V1 trainer, behind TransferQueue

Open savaresejeremy opened this issue 3 months ago • 2 comments

Prototype branch: https://github.com/savaresejeremy/verl/tree/feat/durable-replay-buffer. The accounting and overhead numbers in this RFC can be reproduced by running the harnesses in experiments/durable_buffer/ on that branch. Measurements from a cluster or a shared filesystem are labeled where they appear.

1. Summary

verl V1 already stores every rollout trajectory in TransferQueue as it is produced, and since #7037 it can checkpoint that queue at trainer.save_freq boundaries and re-issue in-flight prompts after a restart. What that path does not recover is everything produced since the last checkpoint, and trainer.save_freq is minutes to tens of minutes of generation. Checkpointing more often does not close that window, because with the default in-memory backend the snapshot has to copy the buffer's bytes out, and training sits paused at a step boundary while that copy runs. No shipped TransferQueue storage backend closes it either: the external tiers exist for capacity or caching, and none of them fences writes, reconciles at restore, or defines any restore semantics. This RFC proposes a durable storage backend behind TransferQueue's existing backend registry, a metadata-only journal that shrinks the loss window from trainer.save_freq to a configurable cadence of seconds, restore-time reconciliation that makes the recovered buffer safe to train on, and, in later phases, a sampling and lifecycle policy surface for the V1 ReplayBuffer built on seams that already exist. The backend, journal, and reconciliation need zero verl-core changes: registration rides the existing VERL_USE_EXTERNAL_MODULES hook, though the package still couples to upstream internals in two places, which section 8 names.

The measured costs and effects:

shape, kill point lost, in-memory buffer lost, checkpoint-only lost, 2-second journal
27B-like, kill@6 2,400 s 1,200 s 0
27B-like, kill@8 3,200 s 3,200 s 0
27B-like, kill@10 4,000 s 0 0

These numbers come from a deterministic accounting harness that drives the real backend, journal, and reconciler through a scripted training schedule, models a crash at step N (a kill@N row), and counts what a resume has to regenerate. The 27B-like shape copies the step timing and response counts of a measured two-node 27B run without rerunning the model, which is what the suffix marks. Losses are priced in trajectory-generation-seconds: each lost trajectory contributes the seconds it took to generate, and since trajectories generate many at a time, redoing a loss takes far less wall-clock time than the summed figure. The kill@10 row lands on a checkpoint boundary, the one case where a checkpoint alone loses nothing. Section 11.1 carries the full matrix and parameters, including a second, modeled shape for multi-minute tool-use rollouts whose losses run to hours of generation work per crash. The producer-path overhead is 0.28 to 0.30 ms per trajectory, and a journal tick costs 18 ms at 5,000 live objects on local disk. In a kill drill on a single 8x B200 cluster node, a stock resume after a kill -9 re-issued all 32 prompt groups that the trainer checkpoint recorded as in flight. A resume that ran the reconciler first re-issued none of them: the journal's cut was two steps newer than the checkpoint, and by then all 32 groups had finished generating. The two resumes differ by exactly 3,328 stored objects (128 trajectories times 26 fields). The backend, journal, and reconciler all run today on the prototype branch against main as of 2026-08-26: 253 package tests pass, and verl's own V1 trainer suites run on the durable backend with 153 of 155 passing, against 155 of 155 in-memory (the two failures are checkpoint-semantics tests explained in section 12).

There is no accompanying PR yet. The review on the previous replay-buffer attempt (#2466) asked that a buffer of this scope get an RFC with design choices before code, land under verl.experimental.*, and ship with a user-facing doc. Phase 1 is written and running on the branch linked above, and it converts to a PR once the layering and phasing here have a maintainer's read. It is a large landing (117 files; section 13 discloses the shape), and the split is clean if reviewers prefer smaller pieces: backend and journal first, the offline tools after, the benchmark harnesses separately.

We are asking for one decision, which is open question 1: should the durable storage backend land in verl's experimental namespace (the shape #2466's review asked for), or be proposed to TransferQueue directly? Either answer unblocks a PR within a week on the verl side, and the design does not change. The component table in section 13 makes routing a one-line answer. Everything else here can be settled in review.

2. Where this sits

The layering follows the boundary stated on #7414: "We don't want Mooncake exposed to trainer directly, instead it should be hided behind TransferQueue, so that we can switch storage backend without any modification to trainer." Everything storage-shaped in this proposal is a TransferQueue storage backend, registered through TransferQueue's existing StorageBootstrapProvider / StorageClientFactory / StorageManagerFactory registries and selected by the existing transfer_queue.backend.storage_backend config key. The trainer sees no new backend type and no new data-plane API.

The durable backend writes to the same shared filesystem TransferQueue's own checkpointing already requires, so a cluster that can run tq.save_checkpoint today can run this with no new dependency. TransferQueue's Mooncake backend illustrates the difference in kind: its offload.enabled spills to SSD under a capacity watermark, and a crash still loses the queue's metadata and anything unspilled, because spill manages capacity and promises nothing about recovery. The storage-client contract here is small (put / get / clear plus four durability calls), so an object-store tier can come later without redesigning anything. The fence that recovery consumes is per-writer log offsets, which an object store serves unchanged, and in the offline audit manifest a content ETag would take the inode's place.

No verl-core change is required to make that reachable. verl already ships two general import-for-side-effects hooks in verl/__init__.py: the VERL_USE_EXTERNAL_MODULES environment variable (documented in docs/extend_guide.rst for registering external engines) and the verl.plugins entry-point group. Either one imports a backend's registration module in every process that imports verl, which is a superset of the processes that touch TransferQueue, so an out-of-tree storage backend needs only a registration module plus either one environment variable forwarded through runtime_env or a package entry point.

The mechanism could therefore live out of tree, but in-tree is the right home. Recovery straddles the boundary between verl's checkpoint layout (global_step_N/transfer_queue, data.pt) and TransferQueue's two documented checkpoint limitations, and nobody outside the tree can own that seam. Two of the open questions below are also changes only verl can make: backend-agnostic variants of the two checkpoint tests, and an explicit dataloader handoff to the buffer. The precedent points the same way: #2466's review asked for this in verl's own experimental namespace, which is where phase 1 puts it.

The trainer-visible half of this proposal, sampling and lifecycle policy, is not storage and does not touch that boundary. It enters through two seams that already exist and one that the code asks for: the trainer.v1.sampler.custom_sampler path; the per-trajectory min_global_steps / max_global_steps version tags, which the trainer's metrics already consume for staleness telemetry but which nothing in the buffer's sampling path consumes; and the TODO at the top of replay_buffer.py that says custom sampling should eventually push down into TransferQueue's own Sampler.

3. Motivation

The maintainers have asked for the durability half by name. Ascend/TransferQueue#121 states that fully-async checkpointing needs three things saved: the training engine state, the stateful dataloader, and TransferQueue itself. TransferQueue's checkpointing shipped in 0.1.9 and verl wired it up in #7037, but TransferQueue's own docs/checkpoint.md lists two residual gaps in its Known Limitations: "Save consistency is not guaranteed under concurrent clears" and "Load is not transactional — partial restore has no rollback". By design the checkpoint is also a pickle on a shared filesystem, written at a step boundary while training waits. The same document already anticipates external persistence: for persistent external backends, include_storage=False "is valid". This proposal is that external backend, taking the adjacent path (the storage hook stays on and writes fence artifacts instead of a data copy), plus the reconciliation that the two documented gaps make necessary.

The sampling half was also a maintainer's own roadmap item before it was narrowed. A line on the Q3 roadmap (#6985) read "Enhance default replay buffer sampling strategy", clarified on that thread to mean the ReplayBuffer sampling path specifically; it was replaced in July by "Support DAPO dynamic sample filter and refill", which shipped as #7082. The narrower item is done. The broader one has no owner, and phase 2 here is an offer to pick it up rather than a claim that it was dropped. Adjacent to it, the current maintainer priority list (stated on discussion #7273) names asynchronous training with partial rollout as a focus area, and that regime is where the training loop rests on the buffer, which is why staleness awareness, durability and admission control belong in it. And #7100 carries a specific unanswered user question this design speaks to: whether a completed rollout must wait in the buffer until train_batch_size rollouts accumulate, or can trigger training sooner.

The cost of the gap is measurable and grows with generation cost. Generation is the expensive part of RL post-training. On a two-node 27B run we measured, generation is fully overlapped with training, which means the buffer is the only place that work lives until it is trained on; a crash there destroys work that never showed up in the step clock. We priced this with a deterministic accounting harness that drives the real backend, journal, and reconciler at that workload's measured shape: the in-memory buffer loses 2,400 to 4,000 trajectory-generation-seconds per crash, and a 2-second journal loses none; the modeled agentic shape with 300-second trajectories puts the same loss at 16,800 to 21,600. Checkpoint-boundary durability alone does not close this. In the same harness, a buffer that persists only at trainer.save_freq recovers half the untrained work when the crash lands one step past a checkpoint, and nothing once the buffer has turned over since, which holds for three of the five checkpoint-cycle positions at the measured shape. The pricing here is per crash, not per crash rate: how often a fleet loses a job to preemption, spot reclamation, or a driver fault is a property of that fleet, and the cost of one lost buffer follows from the workload.

A restart also re-serves prompts. verl restores the dataloader from data.pt at the trainer checkpoint, so every prompt dispatched after that checkpoint is fetched again even when its trajectories survived. Journaling the dataloader position next to the buffer snapshot removes this in the harness's deterministic schedule: the crashes that duplicate at all (48 to 144 trajectories per crash across the rows of section 11.1's table) fall to zero.

4. Goals

  • Trajectory bytes survive process death, written as produced, with no training-path stall. Loss window for finished trajectories becomes the journal cadence.
  • SimpleStorage remains the default storage backend with no behavioral regression; the durable backend is opt-in config and changes no verl-core file.
  • Restore is safe by construction: for journal-snapshot restores, the recovered buffer never serves another sample's bytes under a restored key. Section 12 demonstrates the index-recycling failure this requires fencing against, and section 8 states the exact scope and the residual windows.
  • Recovery composes with what exists: tq.load_checkpoint plus _reissue_inflight_prompts stay the resume path; the reconciler runs before them, offline, and a completely stock resume picks up the result.
  • The sampling and lifecycle surface grows through existing seams (custom_sampler, TransferQueue Sampler, the version tags above), with vocabulary aligned to what other TransferQueue adopters already ship.
  • Each landing phase is separately reviewable and independently useful, and the first phase is prepared as a PR that follows this RFC's discussion.

5. Non-goals

  • No new data-plane API at the trainer boundary, and no second serialization format. Storage stays behind TransferQueue (#7414).
  • No change to V1 sampling defaults. max_off_policy_threshold / max_off_policy_strategy, DAPO filter and refill, and the eviction matrix from #7082 keep their semantics; new policy is opt-in through the custom-sampler path, which owns its filtering semantics.
  • No new configuration system and no new structures at the controller boundary: everything configures under the existing transfer_queue.backend and trainer.v1.sampler namespaces.
  • No default timeout on ReplayBuffer.sample() (#7155; section 9.4 states the maintainer position and the observability that answers it).
  • No capacity tiering. TransferQueue's Mooncake backend already offers SSD offload under a watermark. That solves DRAM pressure, not crash recovery, and the two are complementary.
  • No cross-run buffer reuse or buffer-as-a-service lifecycle is designed in this RFC; section 13's last phase names it as the direction to explore.
  • No crash-frequency claims; section 3 prices single crashes and says why.

6. What V1 already does

#7037 and #7082 both changed this baseline recently, and the delta this RFC proposes only makes sense against what they already do. The V1 ReplayBuffer holds no durable state of its own: _sync_metadata_from_transfer_queue rebuilds every in-memory index from one tq.kv_list() call on each poll, so the buffer is a projection of TransferQueue metadata and recovering the buffer is exactly recovering TransferQueue. Staleness control drops or waits on prompt groups whose span exceeds max_off_policy_threshold. DAPO group filtering evicts finished groups with a degenerate reward metric, and #7082 unified the eviction and refill matrix across sync and async modes. Since #7037, non-sync trainers persist each prompt's tensor fields into TransferQueue at submit time, checkpoint the queue into global_step_N/transfer_queue at trainer.save_freq, restore it on resume, and re-issue prompts that were pending or running at the checkpoint. trainer_separate_async additionally requires the buffer to expose wait_for_sampleable and get_sampleable_count (#7373).

The rest of this design leans on how that checkpoint behaves. For the default in-memory backend, a usable checkpoint must copy the buffer's bytes out (TransferQueue forces include_storage=True there for exactly that reason), which makes the snapshot O(buffer bytes) and pauses training while it is taken. The checkpoint cadence is trainer.save_freq, so everything produced since the last checkpoint is lost with the process even though it was already fully written into the queue.

7. Durability mechanisms

Each mechanism below ends at the call site it touches, and all of them are implemented on the prototype branch.

7.1 A durable storage backend. DurableFS stores one object per (sample, field) on a shared filesystem, published atomically (write to a temp name, rename), with each mutation intent-logged to a per-writer append-only log before it is published. It registers through TransferQueue's three existing registries and is selected by transfer_queue.backend.storage_backend: DurableFS.

  • Per-(sample, field) rather than packed-per-trajectory is deliberate: verl reads fields selectively (the DAPO and staleness paths fetch single fields), and on an earlier prototype a packed layout measured two orders of magnitude of byte amplification on a one-field read.
  • Serialization uses TransferQueue's own codec, so tensor and non-tensor semantics cannot drift from the in-memory backends.
  • The client contract stays small: TransferQueue's put / get / clear, plus four durability extensions (indexed clear, offset capture, manifest write, close). Adding an object-store tier later fits inside that surface: the fence recovery consumes is per-writer log offsets, which an object store serves unchanged, and the audit manifest's inode column becomes a content ETag.
  • The per-writer logs are append-only with no rotation in the prototype, and a log cannot be deleted while any snapshot still records an offset into it, so log count grows with the number of writer process incarnations over a run's life and log bytes grow with total mutations. Phase 1 documents that growth as a limitation. Keeping long-lived stores maintainable needs a log retirement protocol, which is follow-on work: a writer seals a log at a recorded final length, and the offsets validator accepts a sealed log as fully replayed.
  • The backend keeps TransferQueue's storage-checkpoint hook enabled, and for a persistent store that hook writes the fence artifacts reconciliation needs (kilobytes of log offsets) rather than a data copy, so the snapshot cost drops from O(buffer bytes) to O(metadata) without the unrecoverable snapshots that disabling the hook outright would produce.

7.2 Registration. The backend ships a registration module and needs no change to verl core. Setting VERL_USE_EXTERNAL_MODULES=verl.experimental.durable_buffer.register (verl's existing hook) and forwarding it to workers through runtime_env registers it in every process. A backend distributed as its own package can use the verl.plugins entry-point group instead and skip the environment variable entirely, though the two paths fail differently: a mistyped module name on the env-var path fails import verl loudly, while entry-point load failures are logged at debug level and skipped. A test in the suite covers the env-var path end to end from a Ray worker's point of view: a fresh interpreter with only the environment variable set imports verl and ends up with all three registries carrying the backend, with a no-env-var negative control; the runtime_env forwarding itself is what the cluster drill in section 11.4 exercises.

7.3 A journal. tq.save_checkpoint already produces a metadata-only snapshot when the backend persists its own data, and that snapshot is small: the controller pickle measured about 1.5 MB at 50,000 live objects. A JournalWriter takes that snapshot every few seconds into a ring of slots, capturing, before the controller state is pickled, the fence offsets (the per-writer log positions, taken early so a mutation racing the snapshot can only be over-fenced, which is the safe direction) and, optionally, the trainer dataloader's state_dict. The ring tolerates a crash mid-tick and stays independent of TransferQueue's own checkpoint-replacement protocol. It admits one writer at a time, enforced by a lease in the ring root plus a read-time cross-check of the fence stamp against the snapshot's own metadata, so two journals on one root are refused instead of silently interleaved. A refused lease disables journaling without failing the run. Both documented wiring paths degrade to journaling-off with a warning (the buffer subclass also reports it as a metric; the driver call signals by returning nothing). Each snapshot carries a stamp: the TransferQueue version, plus a fingerprint of the controller fields that reconciliation reads, computed from the live snapshot at tick time. Wiring is one start_journal call in a driver (the package's recommended path, since nothing about the buffer changes; it records the training step by default), or config-only through the existing trainer.v1.sampler.custom_sampler seam, where a ReplayBufferAsync subclass runs the journal on a background thread.

7.4 Restore-time reconciliation. The journal is a snapshot at time T of a store that kept changing until the crash, so the two must be reconciled before anything samples. The reconciler applies three rules:

  • DROP: metadata whose expected objects are gone (the sample was consumed after T), applied store-wide across partitions and closed over trajectory groups, so a group that lost one member to a mid-batch clear does not survive as an untrainable fragment.
  • FENCE: objects the snapshot does not expect, or whose write identity changed since it. This is the correctness-critical rule: TransferQueue recycles freed sample indexes, so an index the snapshot still attributes to a consumed sample can hold a different sample's bytes after the crash, and fencing on index membership alone silently trains on mislabeled data when a whole trajectory group's indexes are reused; partial reuse is already caught by the group closure in the drop rule above. Section 12 shows the demonstration.
  • PROMOTE (optional): a group fully generated before the crash whose terminal prompt tag was lost is re-tagged instead of regenerated, and only when its expected size is durably known or explicitly asserted. This rule found no candidates in any of the four reconciliations measured on this branch: the trainer's re-issue reads the checkpoint's older cut, promotion reads the journal's newer one, and by that newer cut the groups in question are already resolved. It pays off only when the two cuts disagree about whether a group finished.

Fencing replays the per-writer logs from the snapshot's recorded offsets and adds one names-only directory listing; this path makes no per-object stat calls, which is what makes it affordable on shared filesystems where each metadata operation costs about 0.4 ms above roughly 20,000 objects (measured; section 11.4).

7.5 An offline restore tool. Between crash and resume, one command rewrites the latest trainer checkpoint's transfer_queue directory (and its data.pt dataloader state, from the journal) so that a completely stock resume picks up seconds-old buffer state through the existing tq.load_checkpoint plus _reissue_inflight_prompts path. It is plan-then-execute with a read-only dry run and an exclusive per-checkpoint lock; every artifact it consumes is validated fail-closed before any mutation, and any outcome that leaves the checkpoint without a live queue directory exits non-zero. The tool refuses to run against a reachable live queue controller, and an inconclusive probe counts as a controller being present. Those protections have two limits: store exclusivity is an assumption (there is no store-level writer lease, and reconciliation deletes objects a live run would still be publishing), and controller presence is decided from the host running the tool, which probes every Ray instance it can discover there, so a live cluster this host cannot discover or cannot reach reads as absent. The user doc carries the operational detail (publication transaction and backup semantics, lock handling after a same-failure kill).

8. Guarantees and residual windows

  • Finished trajectories: the loss window is the journal cadence when a tick completes inside its interval, and the general bound is the larger of the cadence and the tick duration. On a shared filesystem the tick contends with other traffic to the mount, so the achieved window needs measuring on the target filesystem: section 11.4 reports median ticks well inside a 2-second interval with single-tick tails of 9 to 13 s, so the typical window is the cadence and the worst case is a tail tick. The opt-in poll-tick mode degrades the bound to the trainer's step time. Anything finished before the last completed tick survives; the rest is regenerated through the trainer's existing re-issue path. Section 11.2 confirms the cadence bound with a sweep.
  • Never mislabeled data, for journal snapshots, against process-level failure: write-identity fencing plus intent logging (the log record is flushed before the mutation publishes) means a restored key never serves another sample's bytes. The intent record and the object publish are flushed rather than fsynced, so the ordering holds across a killed process but not across a lost node or a power failure, where a durable rename can outlive a lost log record; closing that needs an fsync barrier on the op log before each publish, offered as opt-in config because on a shared filesystem that barrier costs enough to keep it off by default. The property holds for snapshots whose fence offsets were captured before the controller state, which is what the journal does, while reconciling against a plain trainer checkpoint (the no-journal fallback) keeps a window as wide as the controller pickle, because the framework captures those offsets after the pickle at that call site; the tick figures in 11.4 put that at 58 to 163 ms at the sizes measured.
  • A put or clear that straddles the snapshot converges to regeneration (wasteful, bounded) instead of serving stale or partial state, and a clear batch interrupted part-way through its deletions drops the whole trajectory group instead of leaving a fragment nothing can complete. Races between a snapshot and a mutation resolve to fence or drop, never to keep-wrong.
  • Prompt accounting is bounded, not exact, and there are exactly two windows: a duplicate-dispatch window and a skip window, each no wider than one journal tick. Both are stated in the prototype's documentation, and a dispatch log upstream would close both. Journaling the dataloader position eliminates the duplicate re-dispatch that checkpoint-restored loaders cause today.
  • Everything recovery consumes is validated fail-closed: a log record naming a path outside the store, a symlinked artifact, an undecodable stamp, or an untrusted snapshot mode aborts recovery before any mutation instead of degrading to "nothing changed". Snapshots are bound to a store lineage id so a journal can never destructively reconcile a store it was not taken against.
  • Fencing does not trust clocks: it uses log order and write identity, and a wall-clock fence mode exists only as an explicitly requested legacy flow. Snapshot-slot selection is also clock-free, ranked by a persisted tick sequence; the journal-versus-checkpoint comparison prefers the recorded training step, which the recommended wiring records by default, and falls back to the snapshot timestamp when no step was recorded or when the steps tie.
  • The contract has residuals too. Path validation is check-then-use rather than fd-pinned (the threat model is misconfiguration on trusted shared storage, not a racing local attacker). Buffer state that outlives the job is not yet a buffer service lifecycle, so streams of work spanning multiple jobs are the last phase's territory. And the zero-core-changes property is bought with two couplings to upstream internals: the DurableReplayBuffer subclass delegates to the base sample beneath its rollout-skip decorator (a compatibility test pins the stack), and it discovers the trainer's dataloader through the bound refill_fn (open question 6 proposes the explicit handoff).

9. Sampling and lifecycle policy

None of this section is shipped code. It is design, aligned with the prior art cited alongside each mechanism, and the phased plan keeps it behind the durability phase.

9.1 Policy-version staleness at sampling time. V1's staleness control is measured in dataloader steps from the prompt's dispatch tag. The tags for a stronger contract already exist: agent_loop_tq stamps every trajectory with min_global_steps and max_global_steps, the weight versions its generation spanned. Today only the trainer's metrics read those stamps, for staleness telemetry, and the buffer's sampling path ignores them. The proposal is a sampling-time filter over those version stamps with a bounded window, re-evaluated on each draw because the trainer's version advances between draws, plus per-dataset tolerance overrides and a starvation signal: when a mixed-task run has one slow-generating dataset, a single global tolerance silently drops that dataset to zero representation, and a log line plus a per-dataset counter turns a silent data-mix corruption into an operator-visible event. NeMo-RL, which also builds on TransferQueue, ships this contract shape in main today (its async trainer is not yet production-wired) as PromptGroupSampler with admit / select / evict over per-group start-weight version stamps, its concrete samplers taking a max_staleness_versions window. We align names and semantics with that instead of inventing a third vocabulary, so the contract can be stated as an interface that verl's ReplayBuffer, TransferQueue's Sampler, and NeMo-RL's adapter-mediated buffer can each implement without any of them depending on the others. NeMo-RL's own async design proposal weighs four placements for this kind of filter (tag stamps, a small version field, versioned partitions, and a driver-side ledger) and leaves the choice open. The proposal here is compatible with any of them, because the filter is a sampler-layer predicate over stamps that already exist rather than a new storage feature, and versioned partitions remain the cheaper option where whole generations retire at once.

9.2 A composable validator registry with rejection-reason observability. V1 filters groups on one DAPO metric. Production RL runs filter on more: degenerate repetition, truncation, format violations, null advantage, reward windows. The proposal is a small registry of per-sample validators and batch-level filters, referenced from two pipelines: a producer-side pass for properties that are final at production time (run once, never re-checked) and a buffer-side pass for properties that depend on trainer state or buffer composition (run per draw). Every failing validator appends its name to the sample's rejection metadata, and the pipeline emits per-reason counters. The split makes those counters diagnostic: producer-side rejections falling while buffer-side rejections rise reads as a model-health change, not an infrastructure one. Rejections are either transient (re-evaluated on the next draw, sample retained) or terminal (the sample is evicted with its reason recorded), and only transient rejections retain a sample, so a group past its staleness window or failing a validator whose predicate cannot change is terminal and the buffer cannot accumulate permanently unsampleable state. Eviction stays a single authority, composed with #7082's matrix rather than parallel to it. The registry enters through the custom-sampler path, which the #7082 review established as owning its filtering semantics.

9.3 A replay budget. max_replays with a decayed sampling weight (1 / (1 + replay_count * decay)) expresses consume-and-discard (budget 1, today's behavior, the default), bounded reuse, and uniform reuse with one knob pair. decay is non-negative, and at budget 1 any decay value gives that same default. Reuse is additionally bounded by the staleness window of 9.1, which is re-evaluated on every draw against an advancing policy version, so the effective replay count is the smaller of max_replays and the replays a sample can complete inside its window; the budget and the window are configured together rather than independently. Recent results make this worth exposing: a systematic study shows strict on-policy sampling is suboptimal when generation is expensive, and separate work reports that rollout-level prioritized replay with age-bounded eviction improves quality at fixed compute. Both lines of work presume a buffer that accumulates value across steps, which is also the strongest algorithmic argument for durability, because a buffer holding reusable trajectories loses more when the process dies than a consume-and-discard buffer does.

9.4 Fill-level signals and admission. The buffer's occupancy and admission state should be reported, not inferred: a fill-level gauge, a sampleable-count gauge (the get_sampleable_count surface from #7373 already exposes the number), and an optional admission gate that pauses prompt dispatch when the buffer's sampleable occupancy exceeds a configured multiple of a training batch. The gate reads sampleable occupancy rather than total occupancy so that a policy rendering the buffer unsampleable shows up as a starvation rate and a stalled fill gauge instead of pausing dispatch against a full-but-unusable buffer. No default timeout and no default gating: #7155's diagnosis was a silent unbounded wait, the maintainer position there was that sample() should not gain a default timeout, and these signals make the silent case diagnosable.

10. Configuration

Illustrative, under existing namespaces; final names follow the conventions of the target revision.

transfer_queue:
  backend:
    storage_backend: DurableFS          # default remains SimpleStorage
    DurableFS:
      root: /shared/fs/runs/${trainer.experiment_name}/buffer

trainer:
  v1:
    sampler:
      custom_sampler:
        path: verl/experimental/durable_buffer/buffer.py
        name: DurableReplayBuffer
      sampler_kwargs:
        durable_buffer:
          journal_root: /shared/fs/runs/${trainer.experiment_name}/journal
          interval_s: 2.0

verl deliberately withholds the DAPO filtering and refill knobs (filter_groups_metric, sync_refill_failed_groups, and the batch-size trio) from custom samplers, so a run that uses them must re-supply them under sampler_kwargs.durable_buffer.*; the prototype forwards them into the base constructor so base validation still applies. A run that keeps the stock sampler can skip the subclass entirely and start the journal with one start_journal call in the driver (section 7.3), which avoids the re-supply.

Registration goes through verl's existing external-modules hook. The variable must reach every Ray worker, and verl's launcher forwards only what its runtime_env configuration carries; a worker inherits the environment of the raylet that spawned it, and on a multi-node cluster those raylets were started from a different shell than the driver's, so the worker half rides the existing ray_kwargs override channel:

export VERL_USE_EXTERNAL_MODULES=verl.experimental.durable_buffer.register   # driver
python -m verl.trainer.main_ppo ... \
    '+ray_kwargs.ray_init.runtime_env.env_vars.VERL_USE_EXTERNAL_MODULES=verl.experimental.durable_buffer.register'

Restore runs between crash and resume, and --dry-run previews it:

python -m verl.experimental.durable_buffer.restore_tool \
    --store <buffer root> --journal <journal root> \
    --ckpt-dir <trainer.default_local_dir> --group-size <rollout.n>

11. Evaluation

Each artifact under experiments/durable_buffer/ carries its own provenance (commit, harness content digest, dependency versions, invocation), and rerunning that invocation on the prototype branch reproduces the accounting and overhead numbers; the shared-filesystem and cluster measurements sit in the branch under the same scheme, labeled where they appear. The one exception says so where it stands. The accounting harness runs the real backend, journal, and reconciler under a deterministic model of the V1 async loop, so its recovery numbers are exact rather than sampled; only the timing columns carry run-to-run noise. Trainer-mode scope: the cluster smoke and drills ran under the V1 async trainer (colocate_async), and verl's V1 suites exercise the durable backend across the V1 trainer paths; sync mode persists no rollout payloads into TransferQueue, so the durability half does not apply to it.

11.1 Crash cost by workload shape. The harness models two shapes. The 27B-like shape: 8 prompt groups dispatched per step, 2 of them still generating when the step ends, group size 8, 4 groups trained per step (so the buffer accumulates 2 finished groups per step), 100-second steps, 25 seconds of generation per trajectory, save_freq=5. The agentic shape: 6 groups dispatched per step, 2 still generating, group size 8, 3 trained per step, 600-second steps, 300 seconds per trajectory (a modeled regime for multi-minute tool-use rollouts, not a measured figure), save_freq=5. The none arm is today's in-memory buffer; ckpt persists the queue only at trainer checkpoints (what queue checkpointing alone buys); journal adds a 2-second journal; journal_dl also journals the dataloader position. The unit is trajectory-generation-seconds: trajectories lost times the per-trajectory generation cost that the shape models (the 25-second figure is a modeled parameter consistent with the measured run's 100-second steps and per-step response count). The unit sums each lost trajectory's generation cost, so it counts concurrent generation work rather than wall-clock time on the machine that produced it.

shape kill@ lost (none) lost (ckpt) lost (journal) duplicates (journal) duplicates (journal_dl)
27B-like 6 2,400 s 1,200 s 0 48 traj 0
27B-like 8 3,200 s 3,200 s 0 144 traj 0
27B-like 10 4,000 s 0 0 0 0
agentic 7 16,800 s 16,800 s 0 64 traj 0
agentic 9 21,600 s 21,600 s 0 128 traj 0

Checkpoint-granular durability degrades with distance from the boundary: it recovers everything when the kill lands on a checkpoint step (kill@10), half when the kill lands one step past one (kill@6: 6 of 12 untrained groups recovered), and nothing once the buffer has cycled its contents since (kill@8 and both agentic rows). Three of the five rows recover nothing. And durability without dataloader journaling trades loss for duplication: the buffer survives but the restored loader re-serves prompts whose trajectories are already there; journaling the loader position removes all of it under the harness's deterministic schedule (the general contract is the two bounded windows in section 8).

11.2 Journal cadence sweep. Same 27B-like shape, kill fixed at step 8, journal cadence swept: 2, 10, and 30 seconds lose nothing; a 60-second cadence loses one group (8 trajectories, 200 generation-seconds). The claim "loss window equals journal cadence" is a bound, and the sweep confirms it.

11.3 Overhead and scaling limits. Producer path: one process writes 17,200 to 18,800 trajectories/s into the in-memory backend and 2,800 to 2,900 trajectories/s into the durable backend on local disk, an added 0.28 to 0.30 ms per trajectory across a 4x response-length spread; the cost tracks object count, not bytes. For scale, one rollout replica on the measured two-node run produced roughly 0.7 trajectories per second (0.78 in steady state, excluding the first step's warmup), so even the shared-filesystem write rate in 11.4 leaves about 110x of headroom per rollout replica at the steady-state rate, and the writes happen in rollout workers off the training critical path. Journal tick, on local disk: 18 ms at 5,000 live objects, 152 ms at 50,000, about 3 microseconds per object, dominated by the controller pickle (the fence capture itself is proportional to writer count, not store size). Reconciliation at 5 percent churn: 0.06 s at 5,000 objects, 0.59 s at 50,000 (one names-only directory listing, log replay, and the drops themselves; the default fence path makes no per-object stat calls). End-to-end recovery is dominated by process bring-up, not reconciliation: re-attach plus reconcile plus first sample measured about 3 seconds in-process on local disk, against roughly four minutes to load a 27B policy onto an inference node (measured on the two-node run cited in section 3).

These figures are measured at up to 50,000 live objects, and they extrapolate; nothing in them plateaus. The controller pickle that dominates the tick is O(live metadata) at roughly 3 microseconds per object, so at a million live objects a tick approaches seconds and the achievable loss window becomes the tick duration rather than the configured cadence; at that size the options are a longer cadence or an incremental controller snapshot, which belongs upstream in TransferQueue. Reconciliation's membership check is one directory listing of a flat store, and the restore path performs a small number of full metadata listings, so both scale with the buffer size, not with the churn. We claim validation at the measured scale, not above it.

11.4 Kill drill on a live cluster node. Run on a single 8x B200 node with the store and journal on its shared filesystem, Qwen2.5-0.5B on GSM8K under the V1 async trainer (group size 4, 512-token responses), kill -9 at step 7 with the last trainer checkpoint at step 5, resume target step 14. Both arms reached the target with exit code 0:

stock resume reconciled resume (restore tool first)
in-flight prompt groups re-issued 32 0
object puts during the resume 48,192 44,864
difference 3,328 objects = 128 trajectories x 26 fields

The zero is a property of the cut rather than of reconciliation itself. A resume re-issues whatever the metadata it loads records as pending or running: the stock arm loads the step-5 checkpoint, where 32 groups were in flight, and the reconciled arm loads the journal's step-7 cut, where those groups had already resolved. Reconciliation never removes an in-flight prompt, since the drop rule clears only prompts already finished or failed, so a journal cut that does catch prompts in flight re-issues them unless the optional PROMOTE rule can prove their groups already complete, and the saving is whatever the newer cut has already resolved.

The reconciler reported reconciled from a journal cut at step 7 against the step-5 checkpoint (the journal being newer than the trainer's own checkpoint is the reason it exists), fenced 3,004 objects, dropped 128 samples and 32 prompts, and made zero per-object stat calls across the 4,022 objects it listed; its reconciliation work took 4.9 s inside a 19 s tool invocation, the difference being process and queue bring-up. The light drill's 3,328-object delta and its 128 x 26 decomposition have now reproduced three times, and on this branch the absolute put counts matched to the object across both runs. A 20-step smoke on the same setup completed 20 of 20 steps across two preemptions and a stock resume_mode=auto restart, with 173 journal ticks on its final attempt and zero journal failures. A heavier shape (group size 8, 1,024-token responses) completed both arms on this branch with a checkpoint that happened to hold zero in-flight prompts, so both arms re-issued nothing and their object accounting matched exactly, which confirms the delta identity from the zero side. Across all five measured drills (three light, two heavy, spanning an earlier prototype and this branch) the arms differ by exactly (in-flight prompt groups at the checkpoint) x (group size) x (26 fields) whenever the journal's cut is past those groups, from zero here to 6,032 objects at the earlier heavy drill's 29 in-flight groups. On the heavy store the reconciler fenced 4,238 objects and dropped 504 samples in 19.8 s inside a 31.9 s tool invocation. Across the four reconciliations measured on this branch the optional PROMOTE rule rescued nothing, for the reason 7.4 gives: the two cuts it compares did not disagree in any of them.

The runs also qualify the cadence bound, which assumes a tick completes inside its configured interval. Under cross-job filesystem load this run saw individual ticks of 1.8 to 13.6 s against a 2-second interval, and its per-step tick counter averaged about 2.05 s on a quiet mount, though that counter samples once per step and does not close against wall time. The model-scale runs above, with per-tick instrumentation, put the same filesystem's cost in the tails rather than the steady state: median ticks of about 0.1 to 0.17 s, achieved cadences within seven percent of the 2-second interval, and worst single ticks of 9 to 13 s (an internal-cluster observation, like the paragraph above). So the configured cadence holds as the typical loss window on this filesystem, the tail ticks are what a shared mount costs, and section 8 states the bound as the larger of the two.

One negative result, re-measured on this branch: on the shared filesystem the durable producer path drops to roughly 86 trajectories/s per process (11.5 to 11.7 ms per trajectory; an in-memory control on the same node wrote 7,150/s), because metadata operations there cost about 0.4 ms each at that store size. That price is why the fence is an intent-log offset and not a per-object manifest, and isolating the fence shows the difference: at 50,000 objects a per-object manifest at snapshot time costs 20.8 s on this filesystem, while the op-log offset fence costs 0.018 s, and the fence cost does not move between 5,000 and 50,000 objects (0.018 s at both), because it is proportional to writer count rather than store size. The whole journal tick, fence included, runs 58 to 163 ms across that range, dominated by the controller pickle; restore-time reconciliation at 50,000 objects and 5 percent churn costs 4.4 s here against 0.59 s on local disk, a 6.5-to-7.7x penalty from the storage medium across the sizes measured. All of these artifacts live in the prototype branch with their provenance.

The recovery path has also been exercised at model scale: two kills and three reconciliations on a Qwen3.5-27B run on a single 8x B200 node under the V1 async trainer, every reconciliation clean and every resume completing. Those runs demonstrate the other branch of the cut condition above, because their newer cuts recorded 32 prompts still in flight, so the reconciled resumes re-issued them. This one is an internal-cluster observation and, unlike the artifacts above, its records are not part of the branch.

12. Correctness and validation

The index-recycling failure. A two-process probe against the real queue, run on an earlier prototype, demonstrates the failure this design exists to prevent, and a regression test in the branch pins it. The probe took a snapshot, consumed group A (its sample indexes are freed and recycled), produced group C (the freed indexes are reallocated), crashed, restored the snapshot, and fenced on index membership. The restored key for group A now reads group C's bytes: the probe read 9.0 where A's recorded value was 7.0, with matching shapes and dtypes, invisible to the trainer. Three fence rules were measured against the same reuse timeline: index membership serves wrong bytes; a wall-clock margin fences the recycled objects but also discards a never-consumed group (over-fencing); write identity fences exactly the affected objects. The shipped design fences on write identity derived from intent-log order.

Failure policy. Recovery fails closed everywhere it consumes an artifact: unparseable or traversal-carrying log records, symlinked store internals or checkpoint entries, undecodable stamps, offset files that fail schema validation, and snapshots from a store with a different lineage id all abort recovery before any mutation. No journal snapshot mode captures its fence after the controller state, where an overwrite in the gap would look valid. The restore tool is plan-then-execute: the dry run computes the complete plan with byte-level zero writes, and the same plan is what executes.

Test inventory. The package suite has 253 CPU tests, covering backend semantics, crash-window fault injection at every publication boundary, hostile-artifact refusals (each refusal has a dedicated regression test), the reuse/fencing matrix, group-atomic drops, restore-tool transactions, locking, live-controller refusal and bounded liveness probing, journal-lease and snapshot-fingerprint enforcement, and the interaction with TransferQueue's own checkpoint-replacement protocol. verl's own V1 trainer suites run on the durable backend: 153 of 155 pass, against a 155 of 155 in-memory baseline, and the two failures are tests that wipe the live partition and expect load_checkpoint to repopulate it, which is checkpoint-as-copy semantics; an external store's checkpoint references objects rather than copying them, and no production path wipes a partition and then restores it from a checkpoint. Separately from the suite, a scripted cross-version check (recorded in the branch with its exact commands) wrote a store under TransferQueue 0.1.9 and read it under current main, and the reverse: object bytes identical in both directions.

What the evidence does not show. The accounting harness models the async loop's schedule deterministically; its kills land between dispatches, so the two bounded prompt-accounting windows are empty in these runs and the duplicate counts above are schedule-conditional. No convergence comparison is implied by any number here. Across the 20-step cluster smoke the mean reward rose from 0.008 to about 0.12 and continued rising across a mid-run crash and resume; that is a gross-corruption check on the buffer, not a convergence comparison, since there is no in-memory control arm and 20 steps of a 0.5B model would not support a convergence claim if there were.

13. Phased landing plan

The phases are ordered so the interface and its evidence land before any new policy behavior.

  • Phase 1: the durable backend. verl.experimental.durable_buffer: backend, journal, reconciler, restore tool, DurableReplayBuffer, the 253-test suite, benchmark harnesses, and a user-facing doc covering usage and limitations. Opt-in config; zero verl-core changes; defaults untouched; it targets the V1 buffer that #7357 just consolidated the async workflows onto. Phase 1 is 117 new files and about 24,650 lines, none of them changes to an existing file. The part that runs during training is about 2,150 lines (storage backend, journal, buffer subclass, registration); the consistency checker is about 1,800 lines the package imports, of which the steady-state tick uses only the snapshot schema stamp while full reconciliation runs at recovery; the offline restore tool is about 2,250 lines that nothing in the training path imports; the rest is roughly 8,800 lines of tests and test notes, 8,900 lines of benchmark harnesses and their result artifacts under experiments/ (the cluster and shared-filesystem measurements ship as artifacts too), and a 750-line user doc. If the harnesses should land separately, or the offline tools after the backend, the split is clean and we will take direction on it. The PR goes up once this discussion converges.
  • Phase 2: the policy surface. Version-stamped staleness filtering over the existing min_global_steps / max_global_steps tags, the validator registry, and the replay budget, entering through the custom-sampler path with vocabulary aligned to the PromptGroupSampler shape other TransferQueue adopters ship. Where the right home is TransferQueue's own Sampler layer (the TODO in replay_buffer.py points there), we would propose the corresponding piece to that project instead. This phase is the data structure for the asynchronous-training-with-partial-rollout focus named on discussion #7273.
  • Phase 3: lifecycle. Train-on-arrival semantics for the question #7100 asks, buffer state that spans jobs, and the upstream conversations this RFC's residual windows point at: a dispatch log to close the two prompt-accounting windows, and coordination with TransferQueue's checkpoint work so journal machinery lands on whichever side of the boundary its maintainers prefer.

Component homes, so a routing decision moves rows in this table instead of restarting the design:

Component Natural home Depends on
DurableFS storage backend + client extensions TransferQueue (registers through its three existing registries) nothing verl-side
Journal (metadata snapshot ring + fence capture) either; verl-side today because it calls tq.save_checkpoint on a cadence TQ checkpoint semantics settling
Reconciler (drop / fence / promote) verl, or TQ if load_checkpoint becomes transactional the fence artifacts above
Restore tool (rewrites global_step_N/transfer_queue and data.pt) verl only: it is verl's checkpoint layout reconciler

If the maintainers prefer the backend in TransferQueue, rows 1 and 2 move there and this RFC's phase 1 becomes the verl-side rows plus a piece we would propose to TransferQueue separately; nothing in the design changes.

A note on ownership: TransferQueue's checkpoint atomicity work is active as of this writing (atomic checkpoint replacement landed 2026-08-21, restoring the pre-crash checkpoint when a replacement is interrupted), and some of the journal belongs there long-term. This RFC deliberately builds against the published extension APIs only, and phase boundaries are drawn so pieces can migrate across the verl/TransferQueue line without rework on the other side.

14. Alternatives considered

  • Keep the in-memory buffer and checkpoint more often. The snapshot with include_storage=True copies O(buffer bytes) at a step boundary with training paused; at agentic buffer sizes that is exactly the cost profile checkpointing already struggles with, and section 11.1's ckpt arm shows boundary-granular durability recovering nothing once the buffer contents have been consumed and replaced.
  • TransferQueue's Mooncake backend with SSD offload. Offload is capacity spill under a watermark rather than crash recovery: it has no write fence, nothing reconciles spilled state against the queue's metadata on restart, and it offers no restore contract. It solves a different problem, and Mooncake could be the durable medium under this design's reconciliation.
  • A new data-plane boundary at the trainer. Raised on #7414 for Mooncake and answered on layering rather than capability: a maintainer's answer there was that a storage backend should sit behind TransferQueue so the trainer needs no change. That discussion is still open, and Mooncake's maintainer has since endorsed that proposal's shape, so what remains unsettled there is where such a backend lives. This proposal treats the layering answer on that thread as settled and stays behind TransferQueue.
  • A standalone buffer service beside verl (the #2466 shape). That proposal ran a parallel data plane with its own samplers and persistence, and it was never wired into the trainer's call path, which is where its review stalled. This RFC goes the other way and lands at the seams the trainer already calls.
  • Rely on role-based fault tolerance alone. Recent work restarts only the failed role and keeps rollout workers alive, but its own mechanism presumes rollout state persists somewhere; it removes restart overhead, not the lost buffer. The two compose: role recovery keeps the surviving processes up, and a durable buffer preserves what the dead ones produced.

15. Prior art

  • In verl: #7037 (queue checkpointing and in-flight prompt re-issue: the recovery path this extends), #7082 (the eviction/refill matrix and the custom-sampler semantics), #2466/#2539 (the earlier persistable-buffer proposal: RocksDB plus periodic HDFS snapshots as a parallel subsystem; this RFC folds in every maintainer request from that review, namely an experimental namespace, a user doc, and an RFC with design choices), #6809 (an abandoned draft of a fully-async buffer, evidence that the fully-async path carries its own separate queue today), #7155 (the sample-hang report behind section 9.4's observability-first position), #7513 (a driver-side checkpoint callback hook, trainer.checkpoint_callback_class: it runs custom code after each trainer checkpoint, so it inherits the trainer.save_freq cadence, and the journal keeps its own interval clock precisely because that cadence is the loss window it exists to shrink).
  • In TransferQueue: the checkpoint API and its documented limitations, the atomic-replacement work, Ascend/TransferQueue#121 naming the three checkpoint surfaces, and the pluggable Sampler layer where policy could live once for every adopter.
  • Adjacent frameworks: NeMo-RL's data-plane boundary over TransferQueue, whose async design proposal names this RFC's problem in its own terms: of the collector-ledger option it calls cheapest to land, "on a collector crash the ledger evaporates; needs reconciliation (e.g. walk TQ partition on restart and reseed)". Its PromptGroupSampler interface and per-group weight-version stamping are the closest shipped design to phase 2 (section 9.1). Also slime's out-of-process rollout buffer service with group admission and timeouts (decoupling admission from the trainer, without persistence), and Trinity-RFT's PostgreSQL-backed buffers (the same durability goal on a different medium).
  • Literature: bounded-staleness asynchronous RL systems (AReaL); experience replay for LLM RL, both the systematic reuse study (arXiv 2604.08706) and rollout-level prioritized replay with age-bounded eviction (arXiv 2606.04560), which raise the value of a long-lived buffer and therefore the cost of losing one; role-based fault tolerance (RobustRL, arXiv 2512.22492), whose recovery assumes rollout state already lives somewhere durable.
  • Serving-plane integration: NVIDIA Dynamo's rollout serving and ModelExpress weight distribution both stop short of trajectory storage: Dynamo assigns the training loop, reward pipeline and checkpoint production to the RL framework, and ModelExpress moves weights. Neither owns the rollout data plane between them, which is the layer this RFC proposes. The natural meeting points are the trajectory fields Dynamo's RL surfaces return (token ids, logprobs, routed-expert data), policy-version stamping at the weight-refresh boundary, and buffer fill level as the autoscaling demand signal.

16. Open questions

  1. Where should the durable storage backend land: verl's experimental namespace (as prototyped, the shape #2466's review asked for), or TransferQueue directly? This is the one question that has to be answered before a PR can go up, and answering it needs no further work from us: section 13's component table already assigns every component under both outcomes. The rest of this list is review material.
  2. Should the journal live in verl (as prototyped) or inside TransferQueue's checkpoint API as a cadence mode? Recommendation: keep it verl-side while TransferQueue's checkpoint semantics are still moving, and migrate when they stabilize; the phase boundaries are drawn so this is a relocation, not a redesign. That recommendation has an interim cost: the journal's payload is TransferQueue's own pickle of its controller objects, which carries no schema version, so a TransferQueue upgrade between snapshot and restore can make a journal unreadable or, worse, readable with drifted semantics. The prototype's cross-version evidence covers stored object bytes, not the controller pickle; phase 1 stamps the TransferQueue version and a fingerprint of the controller fields that reconciliation reads (7.3 describes the stamp) and refuses a mismatch, which pins the field names rather than their meaning, so a semantic change behind unchanged names remains the residual risk until the journal lives upstream.
  3. Where should the staleness-policy contract be defined: verl's ReplayBuffer, TransferQueue's Sampler, or as an interface both implement? Recommendation: define it as an interface, not as a dependency. NeMo-RL keeps TransferQueue behind an adapter specifically so the backend can change (their interfaces name a future alternative backend, and nothing in their sampler layer imports transfer_queue), so a contract that requires importing TransferQueue would be unusable to the closest other adopter; their adapter mirrors the TransferQueue methods it uses, so a contract stated as method shapes over version-stamped groups is implementable on both sides. TransferQueue's Sampler remains the right place for a reference implementation, and the in-code TODO in replay_buffer.py still points there for verl's own path.
  4. Are min_global_steps / max_global_steps the policy-version stamp for phase 2, or should phase 2 introduce a distinct field? The existing tags should do: they are produced today, consumed by trainer metrics, and unconsumed by sampling.
  5. Should the two V1 checkpoint tests that assume copy semantics gain backend-agnostic variants that also hold for reference semantics? Worth doing, but as its own small PR rather than folded into phase 1, which keeps phase 1 free of changes to any existing file; the current pair encodes an in-memory implementation detail as the contract.
  6. Should the trainer hand the dataloader to the buffer explicitly instead of the buffer discovering it through the bound refill_fn? Yes: one optional constructor argument, and the discovery path stays as the zero-change fallback.

17. References

  • verl: #7037, #7082, #7373, #7357 (V1 async-workflow consolidation), #7513 (checkpoint callback hook), #7155, #7100, #7414, #2466, #2539, #6809, #6985 (roadmap), discussion #7273 (maintainer priority list), verl/trainer/ppo/v1/replay_buffer.py, verl/__init__.py (external-modules and plugin hooks), docs/extend_guide.rst
  • TransferQueue: Ascend/TransferQueue#121, docs/checkpoint.md, the checkpoint API and atomic-replacement changes, the Sampler layer
  • NeMo-RL: nemo_rl/data_plane/README.md, nemo_rl/data_plane/docs/data-plane-async-proposal.md, nemo_rl/algorithms/async_utils/{replay_buffer,staleness_sampler}.py
  • NVIDIA Dynamo RL overview and the verl-recipe Dynamo backend; ModelExpress
  • arXiv: 2505.24298 (AReaL), 2604.08706, 2606.04560, 2512.22492 (RobustRL)
  • Prototype branch: https://github.com/savaresejeremy/verl/tree/feat/durable-replay-buffer

savaresejeremy avatar Aug 27 '26 03:08 savaresejeremy

Thanks for the detailed RFC. I’m unsure whether the intended behavior is to recover trajectories that were still live in TransferQueue at the time of the crash.

If so, the recovered state appears to be a hybrid: the model and optimizer are restored from an older trainer checkpoint, while the buffer is restored from a newer journal cut. Trajectories already trained between those two points are no longer available, and the corresponding model updates are lost. Meanwhile, the remaining trajectories may have been generated by policy versions newer than the restored model.

In terms of volume, both approaches recover O(live_buffer_size): the checkpoint contains an older live buffer, while the journal contains a fresher one. The journal can reduce rollout regeneration, but it does not reconstruct the training performed since the model checkpoint or provide a consistent point-in-time recovery.

Could you clarify whether the intended design is instead to retain all trajectories produced since the latest model checkpoint—including those already consumed—so they can be replayed after restart without rerunning rollout? If so, the system would presumably also need to preserve their training order or batch assignments.

Begunner avatar Aug 28 '26 05:08 Begunner

Yes, that's the intended behavior. The journal restores the trajectory groups that had finished but not yet been trained as of its last snapshot, along with the list of prompts that were still generating (those start over on resume, since partial generations are not saved). The model and optimizer come back from their own checkpoint. You have the recovered state right: the model updates made since that checkpoint are lost, and there is no consistent point-in-time recovery. On your last question, also no: the current design doesn't retain consumed trajectories for replay, though it could.

On volume, yes: both paths recover O(live buffer). The journal's copy is just fresher: seconds old at the crash, while the newest trainer checkpoint can be a full checkpoint interval old. Until a trajectory has been trained on, the buffer holds the only copy of it. The training steps since the checkpoint are redone on either path. What the buffer decides is whether the rollouts feeding them, usually the expensive half on these workloads, have to be regenerated too. So the design keeps what had finished by the last snapshot and lets training re-run forward from its own checkpoint over surviving inventory rather than regenerated data.

On trajectories from newer policy versions, that is what happens: the surviving inventory can be ahead of the restored model by at most one checkpoint interval. The kill drills checked what survives and what re-issues, not the loss trajectory, so I haven't measured what that gap does to training. I can run that comparison and post the results here if you'd like.

To your point about trajectories already trained between the checkpoint and the snapshot: a stock resume does recover those, and this design gives them up. Stock either still has them in its snapshot or simply regenerates them, and retrains them after the rollback. Here they are gone: consumption deleted their objects, and the restored dataloader (when its position is journaled) does not re-serve their prompts. So the trade is up to one checkpoint interval of already-trained work, given up in exchange for not regenerating the untrained inventory.

A design for retaining them could be: a consume log with deferred deletes, holding each consumed object until the model checkpoint passes the step where it was consumed, plus a re-registration pass in reconciliation so they come back as sampleable inventory with no update landing twice. That would get the consumed work back too, without regenerating it. It would cost storage, since consumed objects stay on disk until the next model checkpoint instead of being deleted right away. One implementation detail would be index recycling: objects are addressed by sample index and field, and TransferQueue reuses freed indexes, so retaining an object safely needs its index pinned or a write identity in the object name, which is partly TransferQueue's call. And on order: it isn't needed for correctness, since the checkpoint boundary already keeps any surviving update from landing twice. It would help with the version gap above, though: replayed in the original order, each batch meets the model at roughly the version distance it had the first time.

savaresejeremy avatar Aug 30 '26 04:08 savaresejeremy