Learning With Errors needs an error distribution. Every sample draws a fresh error from a discrete Gaussian or a centred binomial, and that sampling step has to be correct, unbiased, and constant-time. Three of the most serious implementation problems in deployed lattice cryptography — KyberSlash timing, biased Falcon sampling, and faulty nonces in signature schemes — live in exactly that code.

Learning With Rounding asks whether the sampling can be removed. It can, if the noise is allowed to be produced by rounding a scaled inner product instead. What makes LWR interesting is not that it is simpler — it is that the resulting “noise” is a deterministic function of the secret, which changes both the proof and the implementation.

Definition

Fix a dimension nn, a modulus q≥2q \ge 2, and a smaller modulus pp dividing qq. Write the scaled rounding function as

⌊x⌉p=⌊pqx⌉ mod p,\lfloor x \rceil_p = \left\lfloor \frac{p}{q} x \right\rceil \bmod p,

where ⌊⋅⌉\lfloor \cdot \rceil rounds to the nearest integer. For a secret s∈Zqns \in \mathbb{Z}_q^n, the LWR distribution produces pairs (a,b)∈Zqn×Zp(a, b) \in \mathbb{Z}_q^n \times \mathbb{Z}_p by:

  1. Sample a←Zqna \leftarrow \mathbb{Z}_q^n uniformly at random.
  2. Output (a,  b=⌊⟨a,s⟩⌉p)(a,\; b = \lfloor \langle a, s \rangle \rceil_p).

Compare the two side by side. LWE has three steps and two sampled values; LWR has two steps and one.

LWE and LWR produce samples of the same shape
Sample valueModulus of the outputRandomness used per sample
LWEb=⟨a,s⟩+e mod qb = \langle a, s \rangle + e \bmod q, with e←χe \leftarrow \chiZq\mathbb{Z}_qFor aa and for ee
LWRb=⌊pq⟨a,s⟩⌉ mod pb = \lfloor \tfrac{p}{q} \langle a, s \rangle \rceil \bmod pZp\mathbb{Z}_pFor aa only

Both problems come in decision and search forms, and the decision form is the one that gives pseudorandomness: distinguishing LWR samples from uniform pairs in Zqn×Zp\mathbb{Z}_q^n \times \mathbb{Z}_p is assumed hard. Because bb lives in the smaller ring Zp\mathbb{Z}_p, an LWR public key or ciphertext can also be shorter than an LWE one at the same dimension, which is the other half of the appeal.

Worked example: n = 2, q = 8, p = 2

Take the smallest parameters that still show the structure: n=2n = 2, q=8q = 8, p=2p = 2, so p/q=1/4p/q = 1/4, and the secret s=(3,5)s = (3, 5). Each row is one sample.

Five LWR samples with q = 8, p = 2 and secret s = (3, 5)
aa⟨a,s⟩\langle a, s \rangle14⟨a,s⟩\tfrac{1}{4}\langle a, s \rangleRoundedb mod 2b \bmod 2Rounding error
(1, 2)133.2531+0.25
(2, 1)112.7531−0.25
(3, 3)246.00600
(1, 0)30.7511−0.25
(0, 1)51.2511+0.25

Download the Python example to recompute the table with exact rational arithmetic and to regenerate the comparison below.

Two things are worth noticing. The third row lands exactly on an integer, so its rounding error is zero — with p/q=1/4p/q = 1/4 that happens whenever ⟨a,s⟩\langle a, s \rangle is a multiple of 4, which is one sample in four here. And the error never exceeds half a step in the scaled domain, 1/21/2, which is the bound that makes decryption work at all.

The error is a function of the secret

This is the single most important difference from LWE, and it is easy to miss because the samples look identical in shape. Hold a=(1,2)a = (1, 2) fixed and change the secret:

Same a, three secrets: the output bit collides while the errors differ
ss⟨a,s⟩\langle a, s \rangle14⟨a,s⟩\tfrac{1}{4}\langle a, s \ranglebbRounding error
(3, 5)133.251+0.25
(1, 1)30.751−0.25
(7, 2)112.751−0.25

All three secrets produce b=1b = 1, but the underlying rounding errors differ. In LWE the same three secrets would also produce values of bb drawn from an error distribution that says nothing about which secret was used, because ee is sampled independently. In LWR the remainder carries information about ⟨a,s⟩\langle a, s \rangle beyond the rounded bit: knowing where a value sits within its rounding bin is knowing something about the inner product, and hence about ss.

Why that makes the reduction harder, not easier

A first instinct is that LWR should be at least as hard as LWE, since rounding throws information away. That intuition is right and useless as a proof: an LWE solver gets to see ⟨a,s⟩+e\langle a, s \rangle + e with ee independent of ss, and an LWR instance gives it a value whose distance from an integer is a deterministic function of the secret. Turning one into the other means showing the rounding remainders behave like the independent noise, which requires the ratio p/qp/q to be small enough that the remainders are spread finely relative to the modulus.

That is the content of the Banerjee–Peikert–Rosen result, and it is why their theorem carries conditions on the parameters rather than being a clean equivalence like the search-to-decision reduction for LWE.

Hardness

Banerjee, Peikert and Rosen introduced LWR at EUROCRYPT 2012 and proved that LWE reduces to it: an efficient solver for decisional LWR at modulus pp yields an efficient solver for decisional LWE at a larger modulus qq, for qq polynomial in nn and suitably larger than pp. Combined with Regev's quantum reduction from worst-case lattice problems to LWE, that places LWR under the same worst-case umbrella — with the same caveats about approximation factors that apply to every lattice hardness claim.

Two consequences matter in practice. First, the reduction runs in the direction LWE-hard implies LWR-hard, so LWR inherits a lower bound on its difficulty rather than offering an independent assumption. Second, because the modulus ratio appears in the reduction, an implementation that picks pp too close to qq is not covered by the same statement. Parameter sets are chosen to sit inside the theorem, not merely to decrypt correctly.

The same paper used LWR to build pseudorandom functions and deterministic encryption directly from lattices, which is a construction LWE does not give as cleanly: a PRF needs a keyed function that is deterministic, and rounding supplies the determinism for free.

What you gain

No noise sampler

Encryption and key generation draw randomness only for the public matrix AA, which is usually expanded from a seed by a standard hash or XOF. There is no Gaussian, no binomial, no rejection loop with a secret-dependent branch. That removes the entire category of sampling side channels — the timing leak in KyberSlash, the floating-point and CDT hazards in Falcon sampling, and the bias bugs that appear when a discrete Gaussian is approximated.

See lattice side channels and faults for what those bugs cost in practice.

Deterministic, and easier to make constant-time
Rounding is a shift, an add and a mask when pp and qq are powers of two. That is a handful of instructions with no data-dependent branch, versus a rejection sampler whose iteration count depends on secret values. Constant-time correctness becomes a property of the arithmetic rather than a property you must prove about a loop.
Smaller public material
Because bb lives in Zp\mathbb{Z}_p rather than Zq\mathbb{Z}_q, each sample costs log⁡p\log p bits instead of log⁡q\log q. At q=213q = 2^{13} and p=210p = 2^{10} that is a 23% saving per coefficient before any further compression.

What it costs

The modulus stops being free
Clean rounding wants p∣qp \mid q, and the schemes that reached the later NIST rounds used powers of two for both. That is incompatible with the design point of ML-KEM, whose q=3329q = 3329 is prime specifically so that x256+1x^{256} + 1 splits completely and the NTT applies. An LWR scheme gives up that trick, or gives up clean rounding.
Correctness analysis is less forgiving
In LWE the decryption failure probability follows from a tail bound on independent noise, which is well understood and easy to tune. In LWR the rounding remainders accumulate through a polynomial product and are correlated with the secret, so the bound has to be argued rather than sampled. A scheme can decrypt correctly on every test vector and still have a failure rate that is worse than claimed.
No standard adopted it
SABER and Round2 both reached the third and fourth rounds of the NIST PQC competition on Module-LWR assumptions. ML-KEM was selected for standardisation as FIPS 203, and HQC was selected in 2025 as the backup from a different family. LWR remains a well-analysed alternative without a FIPS number, which for most organisations settles the question regardless of its technical merits.

ML-KEM rounds, but it is not LWR

This confusion is common because both schemes contain a rounding step and both use moduli that are close to powers of two. They are doing different jobs.

ML-KEM forms a ciphertext as Compressd(As+e)\mathrm{Compress}_d(As + e), where ee is sampled from a centred binomial distribution and Compressd(x)=⌊2dqx⌉ mod 2d\mathrm{Compress}_d(x) = \lfloor \tfrac{2^d}{q} x \rceil \bmod 2^d. The noise is sampled; the rounding is a lossy encoding applied afterwards purely to reduce the byte count from log⁡q≈11.7\log q \approx 11.7 bits per coefficient to dd bits. See what happens to one ML-KEM coefficient for the full path.

LWR deletes the ee. The rounding is the noise, and the hardness argument has to explain why a deterministic function of the secret is indistinguishable from uniform. The superficial similarity — a floor-bracket in the formula — hides a different assumption, a different proof and a different failure analysis.

A related detail: q=3329q = 3329 is not divisible by any power of two, so ML-KEM's compression is not the clean p∣qp \mid q case at all. Its correctness analysis has to bound the extra rounding term explicitly, which is part of why the FIPS 203 failure probabilities are stated per parameter set rather than derived from a single formula.

When LWR is the right answer

Check Your Understanding

  1. Q1. In LWR the value b=⌊(p/q)⟨a,s⌉ mod pb = \lfloor (p/q)\langle a, s \rceil \bmod p differs from (p/q)⟨a,s⌉ mod p(p/q)\langle a, s \rceil \bmod p by a rounding error. How does that error differ from LWE noise?

  2. Q2. Why does LWR constrain the choice of modulus more than LWE does?

  3. Q3. ML-KEM compresses ciphertext coefficients by computing Compressd(x)=⌊(2d/q)x⌉ mod 2d\mathrm{Compress}_d(x) = \lfloor (2^d/q)x \rceil \bmod 2^d. Is ML-KEM therefore an LWR scheme?

References and further reading