Relative Entropy Coding (REC)
- Relative Entropy Coding (REC) is a framework that uses KL divergence to manage source uncertainty and enable precise channel simulation.
- It comprises two formulations—uncertainty-ball for robust lossless and rate–distortion coding, and stochastic codes for exact simulation with minimum expected lengths.
- REC underpins advanced compression systems including learned latent coding, privacy-preserving communication, and efficient VAE-based image processing.
Searching arXiv for the cited REC literature to ground the article and confirm coverage. Relative Entropy Coding (REC) denotes a family of coding frameworks in which relative entropy governs either robustness to source uncertainty or the expected length of a stochastic code. In one line of work, REC studies lossless or rate–distortion coding when the true source law is only known to lie in a relative-entropy ball around a nominal distribution. In another, now more common, line of work, REC is a channel-simulation problem: given , the encoder and decoder share randomness , transmit a finite binary string, and require $\dec(\enc(X,Z),Z)\sim P_{Y\mid X}$ exactly. Across both usages, the central object is a KL-type mismatch between a nominal law and a target law, but the operational questions differ: minimax robustness in the former, exact stochastic simulation at minimum expected rate in the latter [(Baer et al., 2011); (Flamich, 19 Jun 2025); (Flamich et al., 7 Feb 2026)].
1. Formal definitions and problem classes
In the uncertainty-ball formulation, the source alphabet is , is a known nominal distribution, and the true law is only known to satisfy
The admissible set is the relative-entropy ball
and the code is specified by a length vector , either real-valued or integer-valued, satisfying the -ary Kraft inequality 0 (Baer et al., 2011).
In the stochastic-code formulation, REC generalises classical source coding by replacing the task of encoding a fixed message with the task of encoding a random or uncertain message. A stochastic code is a triple
1
with 2, such that for every 3,
4
Its cost is the expected binary-string length
5
This formulation extends naturally to continuous spaces, since 6 can be finite even when 7 or ordinary entropy coding is not directly applicable (Flamich et al., 7 Feb 2026, Flamich, 19 Jun 2025).
A common misconception is that REC is merely entropy coding for continuous variables. The stochastic-code formulation is stricter: the decoder must generate a sample with the exact prescribed conditional law 8, not merely reproduce a quantised surrogate. The uncertainty-ball formulation is different again: there the decoder is ordinary, but the code must be robust against source mismatch measured by relative entropy [(Baer et al., 2011); (Flamich et al., 7 Feb 2026)].
2. Minimax REC over relative-entropy balls
For uncertain discrete sources, the basic minimax objectives are: 9
$\dec(\enc(X,Z),Z)\sim P_{Y\mid X}$0
$\dec(\enc(X,Z),Z)\sim P_{Y\mid X}$1
and
$\dec(\enc(X,Z),Z)\sim P_{Y\mid X}$2
The first is minimax average length; the second is minimax average redundancy; the third is the Gawrychowski–Gagie shifted redundancy utility; the fourth is maximal minimax pointwise redundancy (Baer et al., 2011).
For minimax average redundancy, the maximising distribution lies in a tilted family
$\dec(\enc(X,Z),Z)\sim P_{Y\mid X}$3
with $\dec(\enc(X,Z),Z)\sim P_{Y\mid X}$4 chosen so that $\dec(\enc(X,Z),Z)\sim P_{Y\mid X}$5. Substituting this tilt reduces the code-design problem to an exponential-Huffman objective. In the $\dec(\enc(X,Z),Z)\sim P_{Y\mid X}$6-domain the cost is
$\dec(\enc(X,Z),Z)\sim P_{Y\mid X}$7
which is exactly the exponential Huffman problem. The optimal real-valued lengths are
$\dec(\enc(X,Z),Z)\sim P_{Y\mid X}$8
while optimal integer prefix lengths are obtained by running the ordinary $\dec(\enc(X,Z),Z)\sim P_{Y\mid X}$9-ary Huffman algorithm on modified weights
0
As 1, one has 2, 3, and 4, recovering the ordinary Shannon code for 5 (Baer et al., 2011).
The same uncertainty model extends to rate–distortion. With nominal source law 6, distortion 7, and uncertainty class 8, the robust rate–distortion problem is
9
and under mild compactness and convexity assumptions these coincide: 0 The corresponding saddle-point representation is
1
with
2
At the saddle 3,
4
and 5 reduces the expression to the classical rate–distortion function (Rezaei et al., 2013).
3. Stochastic REC and one-shot information limits
In channel-simulation REC, a standard lower bound is
6
Classical constructions show that the lower bound is achievable within a logarithmic gap, and lower bounds show that this 7 gap is unavoidable in general. In particular, one standard achievability statement is
8
bits (Hill et al., 25 Apr 2026).
Recent work argues that mutual information is not the exact one-shot operational quantity for REC. The refinement is based on a width function and channel-simulation divergence. For 9, the width at level 0 is
1
and the channel-simulation divergence is
2
The associated functional information is
3
One always has
4
so 5 refines 6 without exceeding it by more than a logarithmic term (Hill et al., 25 Apr 2026).
This refinement also appears in the broader CSD formalism, where the communication lower bound is expressed directly in terms of channel-simulation divergence rather than mutual information alone. In that formulation,
7
and any channel-simulation or REC scheme must satisfy
8
A plausible implication is that modern REC theory treats KL divergence as a first-order descriptor and width-based quantities as the sharp one-shot descriptors (Flamich, 19 Jun 2025).
4. Algorithmic constructions and computational barriers
The canonical exact REC primitives are rejection sampling and Poisson/A*-type selection samplers. In the rejection-sampling code, proposals 9 are drawn from 0, one accepts the first 1 with 2, where 3, and transmits an integer code for the accepted index 4. Its rate is controlled by 5, not directly by 6, so it is optimal only in special cases. In the Poisson functional representation, one draws 7 with 8 arrival increments and selects
9
which ensures 0 (Flamich et al., 7 Feb 2026, He et al., 2024).
The main computational obstacle is that generic REC can be exponentially slow. In the Poisson functional representation analysis,
1
so encoding time is on the order of
2
At a more abstract level, any selection sampler must satisfy
3
which is a general-purpose runtime barrier (He et al., 2024, Flamich, 19 Jun 2025).
Several algorithmic lines attack this barrier by exploiting structure. For continuous distributions over 4 with unimodal density ratio, AS* coding has 5 expected runtime, AD* has the same behaviour empirically, and both achieve expected codelength 6. The approximate depth-limited variant DAD* fixes the code length and, in conjunction with the IsoKL VAE parameterisation, amortises per-latent overhead in VAE compression pipelines (Flamich et al., 2022).
Greedy Rejection Coding (GRC) generalises rejection-based REC to arbitrary partitioning processes. Under sample-splitting on 7 with unimodal density ratio 8, GRCS has expected runtime upper bounded by
9
and its expected codelength is optimal: 0 Under the same assumptions, GRCD is conjectured and experimentally observed to satisfy
1
A different acceleration strategy is space partitioning. The support of 2 is partitioned into 3 bins 4 with 5, one chooses bin weights 6, and defines an induced prior
7
For exact PFR, the recommended choice is
8
for approximate ORC, it is
9
The resulting expected draws satisfy
0
that is, an exponential speedup factor 1 (He et al., 2024).
5. Singular channels and asymptotic refinements
A singular channel is one for which there exists a measurable 2 such that
3
Equivalently, the likelihood ratio depends only on 4, not on 5. Canonical examples given in the literature are the additive uniform noise channel 6, 7, and the binary erasure channel (Flamich et al., 7 Apr 2026).
Singularity is the regime in which the usual logarithmic redundancy can collapse. For singular channels, one has
8
exactly, and the ring-toss code achieves
9
In general, the same construction yields
00
This is the tightest one-shot mutual-information-based upper bound stated in the cited material, and it establishes that rejection sampling is optimal for REC when the rate is measured by functional information (Hill et al., 25 Apr 2026).
The asymptotic picture is correspondingly sharp. For nonsingular channels satisfying mild moment conditions,
01
so the logarithmic redundancy coefficient is 02. For singular channels,
03
exactly, so the redundancy vanishes asymptotically in that scale (Hill et al., 25 Apr 2026).
Bits-Back Rejection Sampling (BBRS) gives an implementable singular-channel construction with the same asymptotic efficiency as Sriramu and Wagner’s sampler. Its one-shot rate bound is
04
where 05 is a quantised log-density ratio. For i.i.d. product channels, the analysis yields
06
hence the asymptotic logarithmic redundancy
07
for singular channels (Flamich et al., 7 Apr 2026).
6. Practical systems and applications
REC has been adopted most visibly in learned compression. A direct latent-space implementation is iREC, which encodes a single latent sample 08 relative to a prior 09 using a shared random stream of prior samples and beam search over auxiliary blocks. Its expected latent codelength is designed to satisfy
10
so that with residual coding the total expected description length is close to the negative ELBO. On Cifar10, ImageNet32, and Kodak, iREC outperforms all single-image bits-back variants reported in the paper and comes within 11 of the ELBO; for 321232 images, encoding speed is reported as 13 min per image, while decoding requires only RNG plus lookup and is real-time (Flamich et al., 2020).
A* and GRC variants were developed partly to make REC practical for continuous-latent VAEs. On MNIST, A* coding with IKVAE and the depth-limited DAD* approximation yields one-shot lossless compression near the theoretically optimal limit. In the 50-latent IKVAE setting, AD* gives 14 bpp while DAD* gives 15 bpp, and the overhead for signalling code lengths drops from 16 bits for AD* to 17 bits for DAD* (Flamich et al., 2022).
Space partitioning further improves practicability in neural compression. In the reported experiments, REC with space partitioning handles 18 about three times greater than what previous methods can manage, and reduces the bitrate by approximately 19–20 in VAE-based lossless compression on MNIST and INR-based lossy compression on CIFAR-10, compared to previous methods. In the CIFAR-10 RECOMBINER setting, the achieved rates lie within 21 of the theoretical REC bound 22 (He et al., 2024).
REC also supports privacy-preserving communication. In DP-REC, the sender clips the client update, forms Gaussian target and prior laws, draws 23 shared prior-noise vectors, computes importance weights
24
samples an index 25, and transmits 26 together with the seed. For Gaussian 27, the Rényi divergence satisfies
28
which feeds directly into privacy accounting. Reported communication gains range from 29 to 30, and on FEMNIST the end-to-end communication is 31 GB versus 32 GB for DP-FedAvg at 33 (Triastcyn et al., 2021).
The broader systems literature positions REC as a foundation for image, audio, video, and protein data compression using Bayesian implicit neural representations, and also for privacy-aware and realism-constrained compression. One thesis-level synthesis states that COMBINER matches or beats state-of-the-art while using 34 less compute, and that REC is a natural foundation for privacy-preserving or perceptual coding because it works directly with stochastic reconstruction laws rather than quantised codebooks (Flamich, 19 Jun 2025, Flamich et al., 7 Feb 2026).