# Lenstra–Lenstra–Lovász 格基约化算法

Lenstra–Lenstra–Lovász 格基约化算法，通常称为 LLL 或 L³，是一种多项式时间算法，可将格的任意基变换为具有短且近乎正交向量的“约化”基。该算法由 Arjen Lenstra、Hendrik Lenstra 和 László Lovász 在 1982 年发表于《Mathematische Annalen》第 261 卷、第 515–534 页的论文《Factoring polynomials with rational coefficients》中提出。<sup>[1](https://www.cs.uoregon.edu/Reports/TR-1985-003.pdf)</sup>该论文的既定目标是给出一个多项式时间算法，将有理系数的一元非零多项式分解为 Q(X) 中的不可约因子，而格约化算法正是为此目的而构建的工具。<sup>[2](https://www.researchgate.net/publication/50863306_Factoring_Polynomials_with_Rational_Coefficients)</sup>此后，它已成为计算数论和理论计算机科学中的基础工具。<sup>[3](https://epubs.siam.org/doi/10.1137/070705702)</sup>

| 关键事实 | 详情 |
|---|---|
| 发表 | A. K. Lenstra, H. W. Lenstra, L. Lovász，*Math. Annalen* 261 (1982)，515–534<sup>[1](https://www.cs.uoregon.edu/Reports/TR-1985-003.pdf)</sup> |
| 原始应用 | 在多项式时间内将有理系数的一元多项式分解为不可约因子<sup>[2](https://www.researchgate.net/publication/50863306_Factoring_Polynomials_with_Rational_Coefficients)</sup> |
| 保证 | 在维度 k 中，算法在多项式时间内找到最短向量的 2<sup>k</sup> 近似<sup>[4](https://people.csail.mit.edu/madhu/ST15/scribe/lect11.pdf)</sup> |
| 核心组件 | Gram–Schmidt 正交化加上 Lovász 交换条件；尺寸约化基对所有 j < i 满足 \|μ<sub>ij</sub>\| ≤ 1/2<sup>[5](https://link.springer.com/article/10.1186/1687-6180-2013-137)</sup> |
| 收敛性 | Lenstra、Lenstra 和 Lovász 证明了该过程总是在多项式时间内收敛<sup>[5](https://link.springer.com/article/10.1186/1687-6180-2013-137)</sup> |
| 解释 | Hermite 常数上 Hermite 不等式的一种高效算法版本<sup>[3](https://epubs.siam.org/doi/10.1137/070705702)</sup> |
| 标准软件 | fplll 库实现了浮点 LLL（默认 δ = 0.99，η = 0.51）以及更强的 BKZ 算法<sup>[6](https://github.com/fplll/fplll/blob/master/README.md?plain=1)</sup> |

## 格与约化问题

格是 R<sup>n</sup> 中一组基向量的所有整数线性组合构成的集合；基向量生成格，而同一个格有许多不同的基。例如，平面上由 (0,1) 和 (1,0) 生成的标准整数格，同样也可以由 (999,1) 和 (1000,1) 生成。一个与基无关的量是行列式 d(L)，即任意基的行列式的绝对值，它等于格的基本平行体的体积。<sup>[7](https://www.math.ias.edu/~avi/PUBLICATIONS/CS%2BMath_7_06.pdf)</sup>

有些基远比其他的方便：由短且近乎正交的向量组成的基使格的几何结构在计算上易于处理。基约化就是将任意基变换为这样一组良好基的任务，特别是使其第一个向量较短。最短向量问题（SVP），即寻找最短非零格向量，一般是困难的，而约化算法是近似求解它的实用方法。<sup>[8](https://www.cs.cornell.edu/~speters/preprints/recursive-lattice-reduction.pdf)</sup>

## 算法的工作原理

LLL 作用于基的 Gram–Schmidt 正交化。给定基向量 b₁, b₂, …, b<sub>m</sub>，Gram–Schmidt 过程产生正交向量 b*<sub>i</sub> = b<sub>i</sub> − Σ<sub>j<i</sub> μ<sub>ij</sub> b*<sub>j</sub>，其中系数 μ<sub>ij</sub> = (b<sub>i</sub>, b*<sub>j</sub>)/(b*<sub>j</sub>, b*<sub>j</sub>) 衡量每个向量对其前驱的依赖程度。正交化后的向量一般不在格中，因此算法间接工作：它从后面的向量中减去前面基向量的最近整数倍，这使每个向量保持在格中，同时将每个 |μ<sub>ij</sub>| 压至至多 1/2。对所有 j < i 满足此条件的基称为尺寸约化基。<sup>[5](https://link.springer.com/article/10.1186/1687-6180-2013-137)</sup>

仅靠尺寸约化无法重排基，因此 LLL 加入了 Lovász 条件：δ‖b*<sub>i</sub>‖² ≤ ‖b*<sub>i+1</sub> + μ<sub>(i+1)i</sub> b*<sub>i</sub>‖²。当该不等式对某个 i 不成立时，算法交换 b<sub>i</sub> 和 b<sub>i+1</sub> 并重新进行正交化；交换将较短的向量带到基的前部。参数 δ 控制输出质量与运行时间之间的权衡。在二维情形下，该过程推广了 Gauss 算法——即反复用一个向量约化另一个向量并交换二者角色的算法。<sup>[9](https://people.csail.mit.edu/vinodv/6876-Fall2015/L4.pdf)</sup>

算法会终止，因为每次交换都严格减小一个适当的势函数，而 Lenstra、Lenstra 和 Lovász 证明了整个过程在输入规模的多项式时间内收敛。<sup>[5](https://link.springer.com/article/10.1186/1687-6180-2013-137)</sup>终止时输出的是一个 LLL 约化基，这种基的第一个向量在维度 k 中以 2^((k−1)/2)<sup>k</sup> 的因子近似格的最短向量。<sup>[4](https://people.csail.mit.edu/madhu/ST15/scribe/lect11.pdf)</sup><sup> • </sup><sup>[18](https://pmc.ncbi.nlm.nih.gov/articles/PMC7413592/)</sup>更一般地，给定基 B，算法返回格中的一个向量 v，满足 ‖v‖ ≤ 2^((n−1)/2)·λ₁(B)，其中 λ₁ 是真正的最短非零向量长度，时间为维度和输入比特长度的多项式时间。<sup>[9](https://people.csail.mit.edu/vinodv/6876-Fall2015/L4.pdf)</sup><sup> • </sup><sup>[18](https://pmc.ncbi.nlm.nih.gov/articles/PMC7413592/)</sup>

## 输出的质量

维度上的指数级近似因子听起来很弱，而在最坏情况下解的质量确实相对较差。<sup>[10](https://link.springer.com/book/10.1007/978-1-4615-0897-7)</sup>然而该因子足够小，足以起决定性作用：许多原本只有指数时间算法的问题，一旦能够计算 2<sup>O(n)</sup> 近似最短向量，就变成了多项式时间可解的。<sup>[9](https://people.csail.mit.edu/vinodv/6876-Fall2015/L4.pdf)</sup>该算法可以视为 Hermite 常数上 Hermite 不等式的一种高效算法版本，后者是将最短向量长度与格行列式联系起来的经典界。<sup>[3](https://epubs.siam.org/doi/10.1137/070705702)</sup>

在实践中，LLL 的表现远好于其最坏情况界所暗示的，这也是它仍然是格密码分析主力工具的原因之一。为了获得更强的约化质量，块 Korkine–Zolotarev（BKZ）算法通过精确求解小型困难子问题来指导整个基的约化，从而弥合 LLL 留下的差距；其块大小参数以运行时间换取更短的向量。<sup>[11](https://fieldguide.lamarrlabs.com/Lattice-Reduction-%28LLL-and-BKZ%29)</sup>

## 应用

LLL 的原始应用是多项式分解。1982 年的论文给出了一个多项式时间算法，用于将有理系数多项式分解为 Q(X) 中的不可约因子，而格方法可推广到代数数域上的多元多项式分解。<sup>[2](https://www.researchgate.net/publication/50863306_Factoring_Polynomials_with_Rational_Coefficients)</sup><sup> • </sup><sup>[12](https://epubs.siam.org/doi/pdf/10.1137/0216040)</sup>

除分解之外，该算法还使一系列经典问题获得了多项式时间解法：求解固定变量数的整数规划、有理数上的多项式分解、破解基于背包的密码系统，以及各种丢番图逼近和密码分析问题。<sup>[10](https://link.springer.com/book/10.1007/978-1-4615-0897-7)</sup>在密码学中，它是 Coppersmith 1996 年寻找一元模多项式和二元整数多项式的小根的方法的基础，这些方法是许多针对 RSA 的部分密钥暴露攻击的基础，并且它驱动了对背包密码和使用有偏随机数的 ECDSA 的攻击。<sup>[13](https://doi.org/10.1016/J.TCS.2020.07.004)</sup><sup> • </sup><sup>[14](https://www.lattices.io/algorithms/lll)</sup>

另一类应用是整数关系检测：给定实数或复数 x₁, …, x<sub>n</sub>，寻找不全为零的整数 a<sub>i</sub>，使得 a₁x₁ + ⋯ + a<sub>n</sub>x<sub>n</sub> = 0。LLL 可用于此目的，尽管 Helaman Ferguson 专门设计的 PSLQ 算法使用更为广泛；一项详细比较发现 PSLQ 在数值上更稳定，能够在接近最小精度水平处可靠地找到关系，而 LLL 有时在某一精度水平成功，但在稍高一些的精度水平却失败。<sup>[15](https://www.davidhbailey.com/dhbpapers/pslq-comp-alg.pdf)</sup>

## 实现与后续发展

参考实现是 fplll 库，其名称反映了 LLL 是代码的核心，且实现依赖于浮点正交化。它包含提供不同速度与保证比率的浮点 LLL 变体、一个选择最佳变体序列以保证经过认证的约化输出的包装器，以及 BKZ、HKZ、SVP 和 CVP 求解器的实现。在默认参数 δ = 0.99 和 η = 0.51 下，包装器或已证明版本保证输出基是 (0.98, 0.52)-LLL 约化的。<sup>[6](https://github.com/fplll/fplll/blob/master/README.md?plain=1)</sup>fplll 包含在 SageMath 中，并具有 Python 接口 fpylll。<sup>[6](https://github.com/fplll/fplll/blob/master/README.md?plain=1)</sup>

浮点变体——即用浮点算术替代 Gram–Schmidt 正交化所需的精确有理算术——现在是已知最快的算法形式。<sup>[16](https://www.aimsciences.org/article/doi/10.3934/amc.2020011)</sup>由于舍入可能悄然破坏约化保证，后续工作发展了经过认证的版本：一种方法使用固定精度算术，精心选择 η ≥ n + log₂B 比特的精度，以在不使用符号计算的情况下重新建立精确性保证；Espitau 和 Joux 在自适应精度的广义 LLL 中用区间算术替代浮点算术，以认证算法的行为，并应用于数域中理想格的约化。<sup>[14](https://www.lattices.io/algorithms/lll)</sup><sup> • </sup><sup>[16](https://www.aimsciences.org/article/doi/10.3934/amc.2020011)</sup>

算法改进也着眼于速度。Nguyen 和 Stehlé 的二次复杂度 LLL 变体延续了在保持保证的同时使算法更快的一系列工作；而数域上格的 LLL 和 BKZ 模格变体——建立在 ASIACRYPT 2019 和 CRYPTO 2020 的工作中——扩展了基于格的密码分析所使用的框架。<sup>[3](https://epubs.siam.org/doi/10.1137/070705702)</sup><sup> • </sup><sup>[17](https://arxiv.org/abs/2510.10540)</sup>

## References

1. [A. K. Lenstra, H. W. Lenstra, L. Lovász, *Factoring polynomials with rational coefficients*, Math. Ann. 261 (1982), 515–534 (citation in Univ. of Oregon technical report)](https://www.cs.uoregon.edu/Reports/TR-1985-003.pdf)
2. [Factoring Polynomials with Rational Coefficients, ResearchGate record of the 1982 paper](https://www.researchgate.net/publication/50863306_Factoring_Polynomials_with_Rational_Coefficients)
3. [An LLL Algorithm with Quadratic Complexity, SIAM Journal on Computing](https://epubs.siam.org/doi/10.1137/070705702)
4. [6.S897 Algebra and Computation, Lecture 11: LLL (MIT course notes)](https://people.csail.mit.edu/madhu/ST15/scribe/lect11.pdf)
5. [Experimental quality evaluation of lattice basis reduction methods, EURASIP Journal on Advances in Signal Processing](https://link.springer.com/article/10.1186/1687-6180-2013-137)
6. [fplll README, GitHub](https://github.com/fplll/fplll/blob/master/README.md?plain=1)
7. [Lattices, LLL and applications (Avi Wigderson, IAS, CS+Math)](https://www.math.ias.edu/~avi/PUBLICATIONS/CS%2BMath_7_06.pdf)
8. [Basis reduction algorithms (Cornell preprint on recursive lattice reduction)](https://www.cs.cornell.edu/~speters/preprints/recursive-lattice-reduction.pdf)
9. [6.876 Advanced Topics in Cryptography: Lattices, MIT lecture notes](https://people.csail.mit.edu/vinodv/6876-Fall2015/L4.pdf)
10. [Complexity of Lattice Problems: A Cryptographic Perspective, Springer (Micciancio & Goldwasser)](https://link.springer.com/book/10.1007/978-1-4615-0897-7)
11. [Lattice Reduction (LLL and BKZ), Lamarr Labs Field Guide](https://fieldguide.lamarrlabs.com/Lattice-Reduction-%28LLL-and-BKZ%29)
12. [Factoring Multivariate Polynomials over Algebraic Number Fields, SIAM Journal on Computing](https://epubs.siam.org/doi/pdf/10.1137/0216040)
13. [Extended partial key exposure attacks on RSA, Theoretical Computer Science](https://doi.org/10.1016/J.TCS.2020.07.004)
14. [LLL Algorithm: How It Works, with Python Code, Lattices.io](https://www.lattices.io/algorithms/lll)
15. [PSLQ: An Algorithm to Discover Integer Relations (D. H. Bailey and J. M. Borwein)](https://www.davidhbailey.com/dhbpapers/pslq-comp-alg.pdf)
16. [Certified lattice reduction (Espitau & Joux, Advances in Mathematics of Communications, 2020)](https://www.aimsciences.org/article/doi/10.3934/amc.2020011)
17. [Predicting Module-Lattice Reduction, arXiv](https://arxiv.org/abs/2510.10540)
18. [pmc.ncbi.nlm.nih.gov](https://pmc.ncbi.nlm.nih.gov/articles/PMC7413592/)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 17, 2026; Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 数与代数 › Number theory › Computational and probabilistic number theory › Integer-relation and lattice algorithms

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/lenstra-lenstra-lovasz-lattice-basis-reduction-algorithm

English original: https://www.edgepedia.org/lenstra-lenstra-lovasz-lattice-basis-reduction-algorithm
