Babai Rounding vs. Nearest Plane: A Worked 2D CVP Counterexample
Step through a Gauss-reduced 2D basis where coordinate rounding, Babai’s nearest plane, and exact CVP return three distinct lattice points.
Prerequisite: Closest Vector Problem
In one dimension, decoding to the nearest multiple of is just rounding. In two or more dimensions, beginners often assume that once a basis is reduced (short and as orthogonal as Gauss reduction allows), Babai's polynomial-time decoding algorithms find the exact closest vector. The verified counterexample in our public math corpus (babai-counterexample) shows all three decoding behaviors diverging on one small grid.
Verify that the basis is already Gauss- and LLL-reduced
Take the 2D lattice generated by column vectors:
Check reduction first: , and the Gram–Schmidt coefficient is , satisfying with equality. No further Gauss or LLL step changes this basis! Its orthogonalized vectors are and .
Run all three methods by hand on
Method 1: Babai Coordinate Rounding — returns
Express directly in the skewed basis by solving :
Round both real coefficients independently: and , giving with squared distance . Why did drop below even though ? Because the fractional tilt stole of horizontal coordinate before rounding threw away!
Method 2: Babai Nearest Plane — returns
Nearest Plane fixes that bug by rounding top-down along orthogonal Gram–Schmidt layers and propagating the rounding decision before solving lower coordinates:
- Project onto : (commits to horizontal lattice layer ).
- Subtract from , leaving , and project onto : .
Output , cutting squared distance to .
Method 3: Exact CVP — returns
Why did Nearest Plane still miss? Because committing greedily to horizontal layer (vertical gap ) ignored layer (vertical gap ), where sits almost dead-center horizontally under (gap )! Its squared distance is :
| Algorithm | Returned point | Offset | Decision region geometry | |
|---|---|---|---|---|
| 1. Coordinate Rounding | (0, 0) | (1.1, 0.9) | 101/50 = 2.02 | Partitions ℝ² into skewed parallelepipeds B·[-½, ½)² |
| 2. Babai Nearest Plane | (2, 0) | (−0.9, 0.9) | 81/50 = 1.62 | Partitions ℝ² into axis-aligned Gram–Schmidt rectangles |
| 3. Exact Closest Vector (CVP) | (1, 2) | (0.1, −1.1) | 61/50 = 1.22 | Partitions ℝ² into true hexagonal Voronoi cells |
Verify exact rational distances and decision regions in Python
from fractions import Fraction
b1 = (Fraction(2), Fraction(0))
b2 = (Fraction(1), Fraction(2))
t = (Fraction(11, 10), Fraction(9, 10))
def dist_sq(p, q):
return (p[0] - q[0]) ** 2 + (p[1] - q[1]) ** 2
# 1. Coordinate rounding: solve [2, 1; 0, 2] * [c1; c2] = t
c2 = t[1] / b2[1]
c1 = (t[0] - b2[0] * c2) / b1[0]
v_round = (round(c1) * b1[0] + round(c2) * b2[0], round(c2) * b2[1])
# 2. Babai Nearest Plane: commit y2 = round(c2) first, then recompute horizontal coordinate
y2 = round(c2)
y1 = round((t[0] - b2[0] * y2) / b1[0])
v_np = (y1 * b1[0] + y2 * b2[0], y2 * b2[1])
# 3. Exhaustive CVP search over nearby integer combinations:
candidates = [(i * b1[0] + j * b2[0], j * b2[1]) for i in range(-2, 4) for j in range(-2, 4)]
v_cvp = min(candidates, key=lambda p: dist_sq(t, p))
for name, v in [("Rounding ", v_round), ("Nearest Plane", v_np), ("Exact CVP ", v_cvp)]:
d2 = dist_sq(t, v)
print(f"{name}: v={tuple(map(int, v))}, ||t - v||^2 = {d2} = {float(d2):.2f}")Notice that Nearest Plane still satisfies Babai's worst-case guarantee: its residual lies inside the orthogonal box of half-diagonal (). To cross the boundary between Neighboring Gram–Schmidt layers and recover , check multi-layer branches via Lattice Enumeration or embed into an SVP basis with Kannan's embedding.