Choosing the parameters of an LWE-based cryptosystem is not guesswork. There is a rigorous methodology — the Core-SVP model — that takes LWE parameters (n,q,σ)(n, q, \sigma) and computes the bit-security of the resulting scheme by estimating the cost of the best known attack. This section explains the methodology, the tools, and the tradeoffs that drive parameter selection for real-world PQC deployments.

Lattice Estimator security pipeline. The estimator evaluates several attack families, optimizes each attack’s parameters and BKZ block size, converts the best result into a cost, then reports the cheapest attack as the security estimate.

Intuition

Choosing the right parameters for lattice cryptography is like choosing the dimensions of a bank vault.

If the walls are too thin (low parameters), robbers (hackers) will break in. But if the walls are fifty feet thick solid steel (extremely high parameters), attacks become more costly, but it’s so heavy and expensive that the bank can’t even afford to open the doors to do business (the cryptography is stronger, but extremely slow and uses too much memory).

Parameter Selection is the rigorous, heavily tested mathematical process of finding the exact “Goldilocks zone”—parameters that resist the best attacks known today, including known quantum approaches, while still being small and fast enough to use every day on your smartphone.

The Core-SVP Security Model

The idea is direct: security is measured by the cost of the best known lattice attack. The best attacks on LWE all reduce to solving SVP in a related lattice via BKZ reduction. The minimum block size β\beta needed for the attack to succeed determines the security — because the cost of BKZ-β\beta is exponential in β\beta.

Definition 34 — Core-SVP Security

The Core-SVP security of an LWE instance is:

λcore=min⁡attacklog⁡2(TSVP(β∗))\lambda_{\mathrm{core}} = \min_{\text{attack}} \log_2(T_{\mathrm{SVP}}(\beta^*))

where the minimum is over all known attacks (primal, dual, combinatorial), and for each attack, β∗\beta^* is the optimal block size that minimizes the total attack cost, and TSVP(β∗)T_{\mathrm{SVP}}(\beta^*) is the cost of running BKZ-β∗\beta^*.

SVP cost models: classical TSVP(β)=20.292βT_{\mathrm{SVP}}(\beta) = 2^{0.292\beta} (using sieving); quantum TSVP(β)=20.265βT_{\mathrm{SVP}}(\beta) = 2^{0.265\beta} (quantum sieving with QRAM).

In practice the model is a formula that goes directly from a BKZ block size β\beta to a bit security level λ\lambda. It is the standard model used by NIST and in essentially all PQC standardization discussions.

Classical Core-SVP:

λclassical(β)=0.292⋅β\lambda_\text{classical}(\beta) = 0.292 \cdot \beta

This comes from the best known classical SVP algorithm (lattice sieving, specifically the BDGL sieve of Becker, Ducas, Gama, Laarhoven 2016), which solves SVP in dimension β\beta in time 20.292β+o(β)2^{0.292\beta + o(\beta)}. The 0.2920.292 constant is the exponent of the sieve’s time complexity (its memory is about 20.2075β2^{0.2075\beta} vectors); the o(β)o(\beta) term and polynomial factors are dropped for security estimation.

Quantum Core-SVP:

λquantum(β)=0.265⋅β\lambda_\text{quantum}(\beta) = 0.265 \cdot \beta

This comes from the quantum speedup of sieving algorithms. A quantum computer can run a variant of the BDGL sieve using Grover’s algorithm to accelerate the nearest-neighbor search step, reducing the exponent from 0.292 to approximately 0.265. This assumes access to a quantum random access memory (QRAM) — a device that does not yet exist but is assumed in the model for a conservative (adversary-favorable) estimate.

The formula in practice: given an LWE parameter set, the security estimation workflow is:

  1. For each attack (primal, dual, hybrid, ...), find the optimal BKZ block size β∗\beta^* that minimizes total attack cost.
  2. Compute λ=⌊0.292⋅β∗⌋\lambda = \lfloor 0.292 \cdot \beta^* \rfloor (classical) or ⌊0.265⋅β∗⌋\lfloor 0.265 \cdot \beta^* \rfloor (quantum).
  3. The security level is min⁡attacksλ\min_{\text{attacks}} \lambda.

Important caveats. The Core-SVP model ignores polynomial factors — it counts only the dominant exponential term. In practice, the BKZ algorithm has polynomial overhead from running multiple tours and the sieve has a significant memory requirement (approximately 20.2075β2^{0.2075\beta} stored vectors). Some security analyses add a “BKZ overhead” term for the number of SVP calls — for example about 8 tours of roughly dd calls each in dimension dd:

λBKZ(β,d)≈0.292β+log⁡2(8d)\lambda_\text{BKZ}(\beta, d) \approx 0.292\beta + \log_2(8d)

The log term is usually small (5–15 bits for realistic parameters) but can matter at the margins. The Lattice Estimator uses a more precise BKZ simulator (Chen-Nguyen) that accounts for the full Gram-Schmidt profile rather than assuming the geometric series assumption (GSA), giving slightly more accurate results than the raw Core-SVP formula.

The Three Main LWE Attacks

Attack 1: The Primal (Usvp) Attack

The primal attack embeds the LWE secret and error as a short vector in a higher-dimensional lattice, then uses BKZ to find it. Given mm LWE samples (A∈Zqm×n,b=As+e)(A \in \mathbb{Z}_q^{m \times n}, b = As + e), construct the (m+n+1)(m+n+1)-dimensional lattice containing the short vector (s,e,1)(s, e, 1). BKZ must find this vector, whose length is ≈n+m⋅σ\approx \sqrt{n+m} \cdot \sigma.

Primal Attack Cost

The primal attack succeeds when the embedded vector becomes the unique shortest vector — i.e., when BKZ-β\beta output root Hermite factor satisfies:

δ02m⋅q2(m−n)/m≤σ2⋅(m+n)\delta_0^{2m} \cdot q^{2(m-n)/m} \leq \sigma^2 \cdot (m+n)

Solving for the optimal number of samples m∗m^* and minimum block size β∗\beta^* gives the primal attack cost 20.292β∗2^{0.292\beta^*}. The Lattice Estimator automates this optimization numerically.

Attack 2: The Dual Attack

The dual attack finds a short vector ww in the dual lattice Λq(A)∗\Lambda_q(A)^*. Such a vector distinguishes LWE samples from random: the inner product ⟨w,b⟩≈⟨w,As⟩+⟨w,e⟩\langle w, b \rangle \approx \langle w, As \rangle + \langle w, e \rangle has small second term (since ww is short and ee is small), making it distinguishable from uniform.

Dual Attack Cost

Find a short dual vector w∈Λq(A)∗w \in \Lambda_q(A)^* with ∥w∥=δm⋅q1−m/n\|w\| = \delta^m \cdot q^{1-m/n} (BKZ output norm in the dual lattice). This distinguishes LWE from random when the advantage satisfies:

ϵ≈e−π∥w∥2σ2\epsilon \approx e^{-\pi \|w\|^2 \sigma^2}

To amplify advantage to a constant, repeat distinguishing with T=1/ϵ2T = 1/\epsilon^2 trials. Total cost: TBKZ(β)⋅TT_{\mathrm{BKZ}}(\beta) \cdot T. For most LWE parameters the primal attack is slightly cheaper. Improved dual attacks (MATZOV 2022) narrowed the gap, though Ducas–Pulles (2023) questioned the heuristics behind them.

Attack 3: Combinatorial Attacks (for binary/ternary secrets)

When the LWE secret distribution is very sparse (binary: s∈{0,1}ns \in \{0,1\}^n, or ternary: s∈{−1,0,1}ns \in \{-1,0,1\}^n), combinatorial attacks become competitive. The most important is the BKW algorithm (Blum-Kalai-Wasserman) and its variants, including meet-in-the-middle and sparse secret lattice attacks.

Dilithium and Kyber use secret coefficients bounded by a small constant η\eta: values in {−η,…,η}\{-\eta, \dots, \eta\} with η=2\eta = 2 or 3 for Kyber (η=3\eta = 3 for the ML-KEM-512 secret) and 2 or 4 for Dilithium. These secrets are not ternary, but they are small, which is why combinatorial and hybrid attacks must be included in the security analysis — the Lattice Estimator accounts for them automatically.

The Lattice Estimator: What It Is and How to Use It

The Lattice Estimator (Albrecht, Player, Scott, and many contributors) is the standard open-source tool for computing security estimates of LWE-based cryptosystems. NIST did not require it, but most lattice-based PQC submissions used it (or its predecessor) for their estimates. It is the de facto reference for the field.

The estimator implements every known attack on LWE — primal uSVP, primal hybrid (lattice reduction + meet-in-the-middle), dual, dual hybrid, BKW variants, Arora-Ge, and exhaustive search — and reports the estimated bit cost of each under multiple cost models (classical sieving at 20.292β2^{0.292\beta}, quantum sieving at 20.265β2^{0.265\beta}, enumeration, or user-specified). The minimum across all attacks is the security estimate.

Installation:

# Option 1: pip (pure Python version, no SageMath required)
pip install lattice-estimator

# Option 2: SageMath version (more features, some attacks require it)
sage -pip install lattice-estimator

# Or clone the repository for the latest version:
git clone https://github.com/malb/lattice-estimator
cd lattice-estimator

Basic usage:

from estimator import LWE, ND, RC

# Define LWE parameters: n=512, q=3329, secret distribution, error distribution
params = LWE.Parameters(
    n = 512,                          # LWE dimension k*n = 2*256 for Kyber-512
    q = 3329,                         # modulus
    Xs = ND.CenteredBinomial(eta=3),  # secret distribution (eta=3 for Kyber-512)
    Xe = ND.CenteredBinomial(eta=2),  # error distribution
    m = 512,                          # number of LWE samples (can be varied)
    tag = "Kyber-512 (unrolled)",
)

# Run all attacks and print results
result = LWE.estimate(params)
# Output: dictionary mapping attack name -> Cost object
# (rop = estimated number of operations, so take log2 for bits)

# Minimum is the security level:
from math import log2
security = min(log2(v.rop) for v in result.values())
print(f"Security estimate: {security:.1f} bits")

The estimator returns a Cost object per attack with fields: rop (estimated number of operations; its base-2 log is the bit cost), beta (BKZ block size), m (number of LWE samples used), and attack-specific fields. The key output is rop.

For Module-LWE (Kyber, Dilithium): the estimator works on a single LWE instance with dimension n⋅kn \cdot k. For ML-KEM-768 (k=3,n=256k=3, n=256), set n = 768 (the total LWE dimension after “unrolling” the module structure). The module structure does not affect the security estimate beyond this dimension scaling.

Concrete Security Estimates

To illustrate the methodology, here are the Core-SVP security estimates for the three ML-KEM parameter sets, as reported with the BKZ-sieving cost model in the Kyber round-3 specification:

ML-KEM Security Estimates (Core-SVP, BKZ+Sieve)

ML-KEM-512 (n=256,k=2,q=3329,η1=3,η2=2n=256, k=2, q=3329, \eta_1=3, \eta_2=2):
Classical: ~118 bits. Quantum: ~107 bits. NIST Level 1.

ML-KEM-768 (n=256,k=3,q=3329,η1=2,η2=2n=256, k=3, q=3329, \eta_1=2, \eta_2=2):
Classical: ~182 bits. Quantum: ~165 bits. NIST Level 3.

ML-KEM-1024 (n=256,k=4,q=3329,η1=2,η2=2n=256, k=4, q=3329, \eta_1=2, \eta_2=2):
Classical: ~256 bits. Quantum: ~232 bits. NIST Level 5.

Note: these are Core-SVP numbers (round-3 Kyber specification), which count only one SVP call and ignore memory, so they are deliberately conservative. They are not compared to 128/192/256 directly: NIST levels 1/3/5 are defined relative to the cost of attacking AES-128/192/256, and fuller gate-count estimates place each parameter set at or above its level. Quantum estimates already include the quantum sieving speedup.

BKZ block size → security bits

Slide the block size β (or pick an ML-KEM preset) and read off what one SVP call in that dimension costs.

0100200300502004006008001000block size βlog₂ cost2^1282^1922^256classical 2^0.292βquantum 2^0.265β
root-Hermite factor δ(β)
1.00398
classical Core-SVP
2^117
quantum Core-SVP
2^106
δ^d at d = 500
7.3×

BKZ-400 has to solve SVP in dimension 400, which costs about 2^117 operations classically and 2^106 with a quantum sieve; the classical cost is below the 2^128 line. In a 500-dimensional lattice its shortest output vector has length about δ^d · det^(1/d) = 7.3 × det^(1/d); a larger β shrinks that factor, which is what lets an attack reach a secret short vector.

What to notice: Lattice security estimates boil down to two questions: which BKZ block size β does the attack need, and what does one SVP call in dimension β cost? Core-SVP answers the second with 20.292β classically and 20.265β quantumly, deliberately ignoring memory and the many SVP calls BKZ really makes. That is why all three ML-KEM presets land a little under the 2128 / 2192 / 2256 lines here, yet meet NIST Levels 1 / 3 / 5 — those levels are defined by the cost of attacking AES, and fuller estimates that count memory and every BKZ call place each parameter set at or above its level.

The Parameter Space Tradeoffs

Four parameters control the fundamental security-efficiency tradeoff for Module-LWE schemes:

Dimension n (ring size)

Larger nn: more security per module element, better NTT efficiency (fewer small NTTs). Constraint: nn must be a power of 2 for NTT, and q≡1(mod2n)q \equiv 1 \pmod{2n} for a complete NTT — or only q≡1(modn)q \equiv 1 \pmod{n} for the incomplete NTT Kyber uses (3329≡1(mod256)3329 \equiv 1 \pmod{256}, not mod 512). Kyber fixes n=256n = 256; all tuning is done via kk.

Module rank k

Larger kk: more security (linearly more module equations). Key sizes scale as O(k)O(k) for both the public key (the k×kk \times k matrix is expanded from a 32-byte seed) and the ciphertext; only computation grows as O(k2)O(k^2). Going from k=2 to k=4 roughly doubles key size for a large security gain. The “correct” kk balances size vs security target.

Modulus q

Larger qq: more room for errors (better correctness at given noise rate) but less security (larger lattice determinant). Kyber uses a small prime q=3329q = 3329, with q≡1(mod256)q \equiv 1 \pmod{256} so an (incomplete) NTT works at n=256n=256, and large enough for correctness at Kyber’s noise level. This keeps key sizes compact.

Error distribution σ

Larger σ\sigma: more security (harder to find the short vector in the primal attack) but worse correctness (more decryption failures). Kyber uses centered binomial with η∈{2,3}\eta \in \{2, 3\}, giving σ≈1\sigma \approx 1. Decryption failure probability: <2−139< 2^{-139} for ML-KEM-512.

The Decryption Failure Analysis

Parameters must also ensure that decryption succeeds with overwhelming probability. A decryption failure in a KEM reveals information about the secret key — if an attacker can trigger failures (e.g., via a CCA attack on a non-FO-transformed scheme), they can extract the secret. The Fujisaki-Okamoto transform prevents this, but failures must still be rare enough for correctness.

Failure Probability Computation

Decryption fails when the total noise etotal=e1+e2+⟨s,e3⟩e_{total} = e_1 + e_2 + \langle s, e_3 \rangle exceeds q/4q/4 in any coefficient. The total noise is a sum of bounded distributions — analyzed via the Rényi divergence or moment-generating functions.

For Kyber: noise terms are products/sums of centered binomial variables. The failure probability is computed as the probability that any of the k⋅n=768k \cdot n = 768 coefficients exceeds the threshold. Using the union bound and tail bounds:

Pr⁡[failure]≤k⋅n⋅Pr⁡[ecoeff>q/4]\Pr[\text{failure}] \leq k \cdot n \cdot \Pr[e_{coeff} > q/4]

Kyber is parameterized to ensure Pr⁡[failure]<2−139\Pr[\text{failure}] < 2^{-139} for ML-KEM-512, well below any practical concern.

Summary: Security Estimation Workflow

Step-by-Step Security Analysis

1. Define scheme: Choose (n,k,q,η,γ1,γ2,… )(n, k, q, \eta, \gamma_1, \gamma_2, \dots) based on your security target and size budget.

2. Run Lattice Estimator: Input parameters; get estimated bit cost of each attack type.

3. Find minimum cost attack: The minimum over all attack types is your classical security level.

4. Adjust for quantum: Apply the quantum SVP cost model; re-run estimator. Take the minimum as quantum security.

5. Check decryption failure: Compute Pr⁡[failure]\Pr[\text{failure}] analytically. Must be <2−100< 2^{-100} at minimum.

6. Iterate: If security is too low, increase nn or kk. If performance is too slow or keys too large, tune downward within security constraints.

Concrete Example — Security of Kyber-512 via BKZ Cost

Let us walk through the primal attack cost estimate for Kyber-512 step by step, to show concretely how the security estimate is computed.

Kyber-512 parameters: n=256,k=2,q=3329n = 256, k = 2, q = 3329, secret distribution B3B_3 (centered binomial, η=3\eta=3), error distribution B2B_2 (η=2\eta=2). The total LWE dimension for the module unrolling is N=kn=512N = kn = 512.

Step 1 — Set up the primal lattice. Given mm LWE samples (A∈Zqm×N,b=As+e)(A \in \mathbb{Z}_q^{m \times N}, b = As + e), construct the (N+m+1)(N + m + 1)-dimensional q-ary lattice:

Λ={x∈ZN+m+1:x≡(s,e,1)(modΛq(A))}\Lambda = \left\{ x \in \mathbb{Z}^{N+m+1} : x \equiv (s, e, 1) \pmod{\Lambda_q(A)} \right\}

The embedded short vector is v=(s,e,1)v = (s, e, 1) with norm approximately:

∥v∥≈N⋅σs2+m⋅σe2+1\|v\| \approx \sqrt{N \cdot \sigma_s^2 + m \cdot \sigma_e^2 + 1}

For Kyber-512: σs2=3/2\sigma_s^2 = 3/2 (variance of B3B_3), σe2=1\sigma_e^2 = 1 (variance of B2B_2). With m=N=512m = N = 512:

∥v∥≈512⋅1.5+512⋅1≈1280≈35.8\|v\| \approx \sqrt{512 \cdot 1.5 + 512 \cdot 1} \approx \sqrt{1280} \approx 35.8

Step 2 — Determine required BKZ block size. BKZ-β\beta finds a vector whose norm satisfies the Hermite factor bound:

λ1(Λ)≤δ0N+m⋅Vol(Λ)1/(N+m)\lambda_1(\Lambda) \leq \delta_0^{N+m} \cdot \mathrm{Vol}(\Lambda)^{1/(N+m)}

where the root Hermite factor is δ0≈(β2πe⋅(πβ)1/β)1/(2β−2)\delta_0 \approx \left(\frac{\beta}{2\pi e} \cdot (\pi\beta)^{1/\beta}\right)^{1/(2\beta-2)}. The primal attack succeeds when BKZ output quality is good enough to isolate vv as the unique shortest vector. Numerically optimizing over mm and β\beta (which the Lattice Estimator does automatically): the optimal block size for Kyber-512 is approximately β∗≈406\beta^* \approx 406.

Step 3 — Apply the BKZ cost formula. Using the BKZ+sieving cost model:

TCore-SVP(β∗)=20.292×406≈2118.6T_\text{Core-SVP}(\beta^*) = 2^{0.292 \times 406} \approx 2^{118.6}

Core-SVP counts a single SVP call in dimension β∗\beta^*. A full BKZ run makes many such calls (fuller models charge roughly 8d8d of them for lattice dimension dd), which adds a polynomial factor that Core-SVP deliberately leaves out. The dominant term is the SVP cost 20.292β∗2^{0.292\beta^*}.

Result: approximately 118 bits of classical security for Kyber-512 under the primal attack with the Core-SVP sieving cost model, matching the Kyber round-3 specification. For quantum security, substitute 0.265β0.265\beta for the SVP cost, giving approximately 107 bits. Neither number is compared to 128 directly: NIST Level 1 is defined by the cost of AES-128 key search, and fuller gate-count estimates place ML-KEM-512 at that level.

Common Mistakes in Parameter Selection

Parameter selection errors in lattice cryptography tend to be subtle and dangerous — a scheme with a 50-bit security level looks identical to a 128-bit scheme to someone not running the estimator. Here are the mistakes that appear most frequently.

Mistake 1 — Assuming a larger modulus q means more security

A common misconception is that a larger modulus qq always means more security. In fact, the opposite is true. Security of LWE depends on the ratio q/σq/\sigma: a larger qq relative to the error σ\sigma makes LWE easier (the error is relatively smaller, making the LWE distinguishing problem easier). However, too small a qq causes decryption failures (the error exceeds the decryption threshold). The correct approach is to choose qq as small as correctness allows (minimizing key sizes) and then tune nn and kk for security. Kyber uses the small NTT-friendly prime q=3329q = 3329 at n=256n = 256. Schemes that inflate qq without justification are paying a security cost they do not need to.

Mistake 2 — Ignoring hybrid attacks

The primal hybrid attack combines lattice reduction with a meet-in-the-middle (MITM) search over part of the secret. For secrets with small support (ternary, sparse binary), this can be significantly cheaper than the pure lattice attack. Many parameter selection analyses only run the primal uSVP and dual attacks, forgetting the hybrid variants. The Lattice Estimator includes primal_hybrid and dual_hybrid — always run all attacks, not just the obvious ones. For sparse or ternary secrets (common in FHE parameter sets) the hybrid attack can be the cheapest, so parameters sized only against the pure primal attack may be weaker than intended.

Mistake 3 — Forgetting to account for quantum speedup

Designing a system with 128-bit classical security is not sufficient for post-quantum security. The quantum Core-SVP model gives a speedup of factor 0.265/0.292≈0.9080.265 / 0.292 \approx 0.908 in the exponent — meaning a system with 128 bits of classical security has approximately 128×0.908≈116128 \times 0.908 \approx 116 bits of quantum security. This gap is non-trivial. NIST Level 1 is not “128 bits of quantum security”: it means at least as hard as key search on AES-128 — about 21432^{143} classical gates, and for quantum attackers a Grover search whose cost depends on the allowed circuit depth (MAXDEPTH). If you design for 128-bit classical security and apply quantum correction, you may fall below your target. Always run the estimator with the quantum cost model explicitly and verify the quantum security level meets your target.

Mistake 4 — Not accounting for decryption failure probability

Security and correctness are competing forces: increasing error size σ\sigma improves security but increases decryption failure probability. A decryption failure in a KEM can be catastrophic: under a chosen-ciphertext attack model, an attacker who can observe whether decryption succeeds can run a “failure boosting” attack to recover the secret key with surprisingly few oracle queries — far fewer than the security level would suggest. Even with the Fujisaki-Okamoto transform (which prevents the attacker from learning whether decryption failed), the failure probability must be below 2−λ2^{-\lambda} to avoid leaking information to a passive attacker over many sessions. The requirement is typically Pfail<2−100P_\text{fail} < 2^{-100} at minimum, and Kyber targets 2−1392^{-139}. Always compute the failure probability analytically (using tail bounds on the noise distribution) and verify it is negligible before finalizing parameters.

Mistake 5 — Using a custom or modified parameter set without re-running the full analysis

The NIST-standardized parameter sets (ML-KEM-512/768/1024, ML-DSA-44/65/87) have been analyzed exhaustively by dozens of research groups worldwide. If you modify any parameter — even a seemingly minor one like changing η\eta from 2 to 3, or adjusting the compression parameters — you must re-run the complete security analysis from scratch. The security of an LWE scheme is highly sensitive to parameter interactions. There is no safe shortcut: use the standardized parameter sets as published in FIPS 203 and FIPS 204 unless you have a specific technical reason to deviate and the expertise to re-validate the security.

Check Your Understanding

  1. Q1. Why is Core-SVP security stated in terms of the BKZ block size β?

  2. Q2. A designer increases the modulus q while keeping the dimension and noise the same. What happens?

  3. Q3. You ran the estimator but only looked at the primal uSVP attack. What is the risk?

  4. Q4. Why must the decryption failure probability be tiny, even though the FO transform is used?

References

Tools and papers for parameter selection

Lattice Estimator (Albrecht et al.) — the standard security estimation tool: github.com/malb/lattice-estimator ↗

Micciancio & Regev, “Lattice-based Cryptography” — mathematical foundations of the security model: PDF ↗

Regev, “On Lattices, Learning with Errors...” — the worst-case reduction that justifies the Core-SVP model: ACM ↗

Systematic Review of Lattice-Based Cryptography (2025): iacis.org ↗