3.4 Lattice Estimator & Parameter Selection
How to rigorously estimate the security of an LWE-based scheme — the Core-SVP methodology and the Lattice Estimator.
Choosing the parameters of an LWE-based cryptosystem is not guesswork. There is a rigorous methodology — the Core-SVP model — that takes LWE parameters 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.
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 needed for the attack to succeed determines the security — because the cost of BKZ- is exponential in .
Definition 34 — Core-SVP Security
The Core-SVP security of an LWE instance is:
where the minimum is over all known attacks (primal, dual, combinatorial), and for each attack, is the optimal block size that minimizes the total attack cost, and is the cost of running BKZ-.
SVP cost models: classical (using sieving); quantum (quantum sieving with QRAM).
In practice the model is a formula that goes directly from a BKZ block size to a bit security level . It is the standard model used by NIST and in essentially all PQC standardization discussions.
Classical Core-SVP:
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 in time . The constant is the exponent of the sieve’s time complexity (its memory is about vectors); the term and polynomial factors are dropped for security estimation.
Quantum Core-SVP:
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:
- For each attack (primal, dual, hybrid, ...), find the optimal BKZ block size that minimizes total attack cost.
- Compute (classical) or (quantum).
- The security level is .
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 stored vectors). Some security analyses add a “BKZ overhead” term for the number of SVP calls — for example about 8 tours of roughly calls each in dimension :
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 LWE samples , construct the -dimensional lattice containing the short vector . BKZ must find this vector, whose length is .
Primal Attack Cost
The primal attack succeeds when the embedded vector becomes the unique shortest vector — i.e., when BKZ- output root Hermite factor satisfies:
Solving for the optimal number of samples and minimum block size gives the primal attack cost . The Lattice Estimator automates this optimization numerically.
Attack 2: The Dual Attack
The dual attack finds a short vector in the dual lattice . Such a vector distinguishes LWE samples from random: the inner product has small second term (since is short and is small), making it distinguishable from uniform.
Dual Attack Cost
Find a short dual vector with (BKZ output norm in the dual lattice). This distinguishes LWE from random when the advantage satisfies:
To amplify advantage to a constant, repeat distinguishing with trials. Total cost: . 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: , or ternary: ), 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 : values in with or 3 for Kyber ( 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 , quantum sieving at , 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-estimatorBasic 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 . For ML-KEM-768 (), 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 ():
Classical: ~118 bits. Quantum: ~107 bits. NIST Level 1.
ML-KEM-768 ():
Classical: ~182 bits. Quantum: ~165 bits. NIST Level 3.
ML-KEM-1024 ():
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.
The Parameter Space Tradeoffs
Four parameters control the fundamental security-efficiency tradeoff for Module-LWE schemes:
Dimension n (ring size)
Larger : more security per module element, better NTT efficiency (fewer small NTTs). Constraint: must be a power of 2 for NTT, and for a complete NTT — or only for the incomplete NTT Kyber uses (, not mod 512). Kyber fixes ; all tuning is done via .
Module rank k
Larger : more security (linearly more module equations). Key sizes scale as for both the public key (the matrix is expanded from a 32-byte seed) and the ciphertext; only computation grows as . Going from k=2 to k=4 roughly doubles key size for a large security gain. The “correct” balances size vs security target.
Modulus q
Larger : more room for errors (better correctness at given noise rate) but less security (larger lattice determinant). Kyber uses a small prime , with so an (incomplete) NTT works at , and large enough for correctness at Kyber’s noise level. This keeps key sizes compact.
Error distribution σ
Larger : more security (harder to find the short vector in the primal attack) but worse correctness (more decryption failures). Kyber uses centered binomial with , giving . Decryption failure probability: 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 exceeds 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 coefficients exceeds the threshold. Using the union bound and tail bounds:
Kyber is parameterized to ensure for ML-KEM-512, well below any practical concern.
Summary: Security Estimation Workflow
Step-by-Step Security Analysis
1. Define scheme: Choose 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 analytically. Must be at minimum.
6. Iterate: If security is too low, increase or . 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: , secret distribution (centered binomial, ), error distribution (). The total LWE dimension for the module unrolling is .
Step 1 — Set up the primal lattice. Given LWE samples , construct the -dimensional q-ary lattice:
The embedded short vector is with norm approximately:
For Kyber-512: (variance of ), (variance of ). With :
Step 2 — Determine required BKZ block size. BKZ- finds a vector whose norm satisfies the Hermite factor bound:
where the root Hermite factor is . The primal attack succeeds when BKZ output quality is good enough to isolate as the unique shortest vector. Numerically optimizing over and (which the Lattice Estimator does automatically): the optimal block size for Kyber-512 is approximately .
Step 3 — Apply the BKZ cost formula. Using the BKZ+sieving cost model:
Core-SVP counts a single SVP call in dimension . A full BKZ run makes many such calls (fuller models charge roughly of them for lattice dimension ), which adds a polynomial factor that Core-SVP deliberately leaves out. The dominant term is the SVP cost .
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 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 always means more security. In fact, the opposite is true. Security of LWE depends on the ratio : a larger relative to the error makes LWE easier (the error is relatively smaller, making the LWE distinguishing problem easier). However, too small a causes decryption failures (the error exceeds the decryption threshold). The correct approach is to choose as small as correctness allows (minimizing key sizes) and then tune and for security. Kyber uses the small NTT-friendly prime at . Schemes that inflate 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 in the exponent — meaning a system with 128 bits of classical security has approximately 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 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 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 to avoid leaking information to a passive attacker over many sessions. The requirement is typically at minimum, and Kyber targets . 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 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
Q1. Why is Core-SVP security stated in terms of the BKZ block size β?
Q2. A designer increases the modulus q while keeping the dimension and noise the same. What happens?
Q3. You ran the estimator but only looked at the primal uSVP attack. What is the risk?
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 ↗