Reinforcement learning agents in sparse-reward tasks get a success signal only at the end of an episode. They learn mostly by keeping and replaying past experience. Hindsight relabeling turns failed episodes into training data by pretending the state the agent actually reached was the goal. Episodic memories store the rare high returns so they are not averaged away. Both methods get better the more experience they can keep, yet in practice memory is capped and old data is thrown out. Scientific computing has a mature answer to "too much floating-point data": error-bounded lossy compression. Compressors such as SZ predict each value from its neighbors and store only a coarsely rounded residual, and they guarantee that every reconstructed number lies within a user-chosen tolerance $\epsilon$ of the original. This note proposes compressing RL replay memory with such a compressor and choosing the tolerances from the task's own reward rule, so that a fixed memory budget holds several times more episodes with a proof that stored rewards and learning targets are distorted by a known, small amount.
The idea fits sparse rewards especially well. A sparse goal reward is a threshold test ("is the object within distance $\delta$ of the goal?"). A pointwise error bound on stored coordinates therefore tells us exactly which relabeled rewards could ever flip: only those whose true distance lies in a narrow band around $\delta$. Robot trajectories are also smooth in time, which is the property prediction-based scientific compressors exploit. The claim has to survive a hard premise check, though. If replay capacity does not limit learning at realistic budgets, or if simply keeping successful episodes forever solves the problem, the compression machinery is not worth building, and the experiments are designed to find that out early.
Core Claim
Under a fixed replay-memory budget small enough that hindsight-relabeled off-policy learning degrades, compressing each stored episode with a time-predictive, error-bounded compressor recovers full-buffer performance at a fraction of the bytes. This works if the per-channel tolerances are set by two rules. The first is a reward-margin rule: channels that enter the reward test get a tolerance small enough that relabeled reward labels can only change inside a negligible distance band, or they are stored losslessly. The second is a value-sensitivity rule: all other channels get the loosest tolerance whose effect on the learning target stays below a small fraction of the natural noise in that target. The specific prediction is that this beats equal-byte alternatives that lack pointwise guarantees or ignore the reward structure, namely half-precision or 8-bit storage, image codecs, and uniform-tolerance compression.
The two rules are simple inequalities. If each stored goal coordinate in $\mathbb{R}^k$ is reconstructed within $\epsilon_g$, then for any two time steps $t, t'$ of an episode, the reconstructed distance $\|\hat g_t - \hat g_{t'}\|$ differs from the true distance $\|g_t - g_{t'}\|$ by at most
$$2\epsilon_g\sqrt{k},$$
so a hindsight reward can only differ from the uncompressed one when the true distance lies within $2\epsilon_g\sqrt{k}$ of the success threshold $\delta$. For the remaining $d$ observation channels with tolerance $\epsilon$, a critic $Q$ with input-gradient norm $L_Q$ changes the bootstrapped target $y = r + \gamma Q(s', a')$ by roughly
$$|\Delta y| \le \gamma L_Q \epsilon \sqrt{d},$$
where $\gamma$ is the discount. The bound follows from a first-order expansion plus the fact that a per-coordinate bound $\epsilon$ implies an L2 bound $\epsilon\sqrt{d}$. We choose $\epsilon$ so that this quantity is below a fraction $\rho$ of the running standard deviation of temporal-difference errors.
Research Program
The work borrows its compressor and its analysis method from two prior lines. The compressor follows the SZ pipeline of prediction, error-controlled quantization with bin width $2\epsilon$, and entropy coding, as characterized in SDRBench. That benchmark also reports that prediction-based SZ dominates transform-based ZFP in compression rate at equal tolerance (ZFP over-preserves precision), so we start from the predictive design. Each episode is stored as a time-by-channel array: about 25 floats per step for state-based Fetch, or a stack of frames for pixel observations. A Lorenzo-style predictor runs along the time axis, and along space as well for frames. Per-channel and per-region tolerances use the multi-interval and bitmap constraints of Liu et al., which reported a Hurricane Katrina ratio rising "from 37 to 80" while keeping storm-surge detail. Our analogue of the storm surge is the gripper, the object, and the goal region. Decompression happens at sample time on the GPU, following the cuSZ line (Tian et al.; GPU optimization; GPU Huffman decoding).
The value-sensitivity rule adapts the "1% rule" of Jin et al.. That work compressed supervised training activations with cuSZ and showed that the accumulated gradient error is roughly zero-mean Gaussian, so momentum optimizers absorb it. It reported up to 13.5× activation-memory reduction with top-1 loss below 0.3%. It never touched RL. Bootstrapped targets differ from supervised gradients because errors can compound through repeated bootstrapping. We will therefore measure, not assume, whether target perturbation stays zero-mean. This is a constraint the proposal must earn. The tolerance is fixed when an episode is written, using the current critic-gradient and TD-noise estimates. We also test whether recompressing old episodes as the critic sharpens is needed.
Retaining more experience matters for sparse rewards because of how the main methods work. Hindsight Experience Replay draws goals from states reached later in the same episode, so goal diversity scales with the number of stored episodes. Model-Free Episodic Control evicts entries with a least-recently-used rule and can drop rare high-return memories. These papers motivate the capacity premise without establishing it, which is why the premise is tested first.
The closest existing work differs in what gets compressed and what is guaranteed. Reward-Free Policy Space Compression compresses the space of policies into a few representatives under a divergence bound, in tabular River Swim, and never stores or compresses experience data. Drop-Bottleneck learns to drop latent features for robust curiosity, with no reconstruction guarantee and an uncompressed policy input. Reward function compression studies how humans compress goal rules into heuristics and explicitly leaves open how lossy reward compression biases learning. Our reward-band bound answers a narrow, algorithmic version of that question.
Baselines
The naive reference point is DDPG with hindsight relabeling and an uncompressed float32 buffer of first-in-first-out episodes, run in two forms. One has an unlimited buffer, which gives the performance ceiling. The other has a buffer capped at the same byte budget as the compressed methods, which gives the floor that compression must lift. For context, Episodic Self-Imitation Learning with Hindsight reports success rates of 0.986 on FetchPickAndPlace and 0.812 on FetchSlide with unconstrained memory. Hindsight Experience Replay says DDPG+HER "solved all three tasks almost perfectly" but gives no exact percentage in the file. We found no reported result on Lacuna for any method under a capped replay-memory budget, so our own unlimited-buffer runs define the ceiling. Beating the floor means recovering at least most of the gap to that ceiling at equal bytes.
The strongest competitor on this question is low-precision storage: float16 for states and 8-bit quantization of pixels and floats. It is trivial, fast, and already gives 2–4× savings. It is also effectively error-bounded with a fixed tolerance, just without temporal prediction. Second is a generic lossy image or video codec for pixel observations, which saves more bytes but offers no pointwise guarantee. Third is a success-preserving buffer that never evicts episodes containing a real success and evicts only failures, because it targets the rare-success loss directly without any compression. All baselines share the same agent, network sizes, environment steps, and a matched hyperparameter search of equal trial count. Byte budgets count compressed payload plus all metadata, and wall-clock time includes decompression. Beating a baseline means a higher final success rate, or fewer environment steps to a fixed success level, at equal bytes, with non-overlapping confidence intervals across at least ten seeds.
Two ablations isolate the key ingredient. The first replaces the reward-margin and value-sensitivity tolerances with one uniform tolerance at matched bytes. The second removes temporal prediction, quantizing raw values at the same tolerance. This separates "smooth trajectories compress well" from "reward-aware allocation matters."
Why not just…?
Why not just store float16 or int8? This is the most serious threat. On state-based Fetch, where each step is about 25 floats, it may capture most of the benefit, because the buffer is small and capacity may never bind. We expect the predictive compressor to win only where trajectories are long and smooth or observations are images. In those cases temporal residuals are far smaller than raw values, which is where SDRBench reports SZ at "~58:1" against Zstd's "1.15:1" on Hurricane Isabel. That is a scientific field, though, not a trajectory, and we found no reported trajectory compression ratio on Lacuna. If float16 matches us at equal bytes on the pixel tasks, the proposal reduces to "use half precision," and we will report that.
Why not just keep successful episodes forever? For MFEC-style memories this may be enough. For hindsight relabeling, failed episodes carry the curriculum, because their reached states become goals. The success-preserving baseline is run at equal bytes. If it closes the gap alone, compression adds nothing for this question. If combining it with compression helps beyond either alone, the two address different losses.
Why not just store learned latents (a VAE or Drop-Bottleneck code) instead of observations? Latents shrink storage further, but they freeze the representation. Loss is its own Reward found that representation learning is the bottleneck under sparse reward and that reconstruction-trained encoders waste capacity on background. Storing latents would lock in an early, weak encoder. We include a stored-VAE-latent baseline in the pixel setting to test this directly.
Why not just use JPEG or a video codec? These codecs are tuned for perception, not numerical accuracy, and give no pointwise bound. A small object such as the block or puck can be blurred below the reward threshold. The reward-band analysis predicts measurable label flips for these codecs and none outside the band for ours, and we count flipped hindsight labels directly against the uncompressed buffer.
Proposed Experiments and Decisive Checks
The first experiment is the premise check, run before building anything else. We sweep the uncompressed buffer size for DDPG+HER on FetchPush, FetchPickAndPlace, and FetchSlide, using both state observations and rendered 84×84 pixel observations, and find the budget where success begins to fall. For scale, a million RGB frames of that size occupy about 21 GB, while a million state vectors occupy about 100 MB. We therefore expect capacity to bind only in the pixel setting. If success is flat across budgets in both settings, we redirect the work to the bandwidth-limited case of actors streaming experience to a learner, where bytes in transit matter regardless of buffer size.
At the binding budgets, the main comparison runs all baselines and ablations at equal bytes. It reports success versus environment steps, compression ratio, flipped hindsight labels, the measured distribution of target perturbation compared with the bound above, and wall-clock overhead. Jin et al.'s 17% compression overhead is a reference point to stay under. A secondary test applies the same compressor to the memory table of MFEC on sparse Atari games and the Labyrinth maze. It replaces least-recently-used eviction at a fixed budget with compressed retention and checks whether rare returns survive longer.
The decisive outcome comes from the pixel Fetch tasks. Reward-aware compression must beat both float16/int8 storage and the success-preserving buffer at equal bytes, and the uniform-tolerance ablation must fall measurably short of it. If all of that holds, the claim stands. If float16 or the success-preserving buffer matches it, the claim is false, and the useful finding is that sparse-reward replay needs retention policy, not compression.
References
- SDRBench: Scientific Data Reduction Benchmark for Lossy Compressors
- Optimizing Error-Bounded Lossy Compression for Scientific Data With Diverse Constraints
- cuSZ: An Efficient GPU-Based Error-Bounded Lossy Compression Framework for Scientific Data
- Optimizing Error-Bounded Lossy Compression for Scientific Data on GPUs
- Optimizing Huffman Decoding for Error-Bounded Lossy Compression on GPUs
- A novel memory-efficient deep learning training framework via error-bounded lossy compression
- Hindsight Experience Replay
- Model-Free Episodic Control
- Reward-Free Policy Space Compression for Reinforcement Learning
- Drop-Bottleneck: Learning Discrete Compressed Representation for Noise-Robust Exploration
- Reward function compression facilitates goal-dependent reinforcement learning
- Episodic Self-Imitation Learning with Hindsight
- Loss is its own Reward: Self-Supervision for Reinforcement Learning