Measuring Verification Gaps in LLM-Generated Post-Quantum Hardware
Introduction
As post-quantum cryptography (PQC) moves from standardization to silicon, hardware design teams are increasingly turning to large language models (LLMs) to generate RTL for PQC accelerators, polynomial multipliers, and NTT/INTT datapaths. While LLMs can dramatically accelerate design iteration, they also introduce subtle correctness and security gaps that conventional verification flows may miss. This article examines how to measure those gaps systematically, using the Lucid and EYL methodologies as a framework.
Why Post-Quantum Hardware Is Especially Vulnerable to LLM-Generated Errors
PQC algorithms such as ML-KEM (FIPS 203), ML-DSA (FIPS 204), and SLH-DSA (FIPS 205) rely on arithmetic structures that are unfamiliar to most verification engineers: negacyclic polynomial multiplication, modular reduction under non-power-of-two moduli, and constant-time sampling. LLMs trained largely on mainstream RTL tend to:
- Produce functionally plausible but non-constant-time implementations (timing side channels)
- Emit modular reduction logic that is correct for test vectors but wrong at edge cases
- Omit overflow and masking corner cases in butterfly units
- Reuse generic multipliers where resource-shared NTT structures are required
By 2026, with PQC migration mandates taking effect across government and financial infrastructure, these gaps carry regulatory as well as security consequences.
The Lucid–EYL Framework
Lucid focuses on observability: instrumenting LLM-generated RTL so that internal state—polynomial coefficients, reduction intermediates, and random mask values—can be sampled and compared against a golden behavioral model. EYL (Evaluate-Your-Logic) focuses on equivalence and leakage: proving that generated modules are functionally equivalent to a trusted reference and that their power/timing signatures do not reveal secret-dependent behavior.
Together, they provide two complementary measurements:
- Functional gap — the fraction of input space where LLM output diverges from the specification.
- Side-channel gap — the statistical distinguishability between generated and reference implementations under leakage assessment (e.g., TVLA).
- Coefficient-domain coverage: every coefficient position exercised at boundary values (0, q−1, q, 2q)
- Reduction-path coverage: all branches of Barrett and Montgomery reduction
- Mask-transition coverage: every mask refresh and re-sharing event
- Error-injection coverage: fault models at each pipeline stage
- Specification ambiguity (LLM chose a valid but different interpretation)
- Arithmetic error (incorrect reduction, carry handling)
- Structural omission (missing pipeline register, wrong latency)
- TVLA (Test Vector Leakage Assessment) with fixed-vs-random and specific t-tests
- Instruction/data-timing analysis at RTL and gate level
- Masking verification to confirm that first-order and, where required, second-order leakage is below threshold
- Treat LLM output as untrusted RTL. Route it through the same security review as third-party IP.
- Automate gap measurement in CI. Regenerate, re-verify, and re-measure functional and side-channel gaps on every prompt or model change.
- Version and pin models. LLM behavior drifts across model updates; record model version alongside RTL in the repository.
- Combine Lucid instrumentation with EYL proofs. Observability without equivalence is anecdotal; equivalence without leakage assessment is incomplete.
- Align with emerging standards. Track NIST and industry guidance on AI-assisted cryptographic hardware, including verification evidence requirements for certification.
Measuring the Functional Verification Gap
1. Build a Golden Reference
Use a formally verified PQC library (e.g., a proven-correct NTT or a high-level reference model in Python/C) as the specification anchor. LLM-generated RTL should never be its own oracle.
2. Define Coverage Metrics That Matter
Rather than raw line or toggle coverage, define PQC-specific metrics:
3. Constrained Random and Formal Co-Verification
Drive the LLM-generated design and the golden model with identical constrained-random stimuli, then run formal equivalence checking on bounded submodules. Where equivalence fails, classify the failure as:
Track the ratio of each class over successive LLM iterations to quantify convergence.
Measuring the Side-Channel Verification Gap
LLM-generated code frequently fails constant-time properties. EYL-style leakage assessment should include:
Report the gap as the number of standard deviations by which the generated design exceeds the reference leakage profile. A design that passes functional tests but shows |t| > 4.5 on secret-dependent intermediates should be flagged as failing verification.
Practical Guidance for 2026 Design Flows
Conclusion
LLMs are becoming a practical front-end for PQC hardware design, but their outputs require rigorous, measurement-driven verification. The Lucid–EYL framework gives teams a reproducible way to quantify both functional and side-channel gaps, turning vague concerns about AI-generated RTL into concrete metrics that can be tracked, bounded, and signed off—an essential capability as post-quantum silicon enters production in 2026 and beyond.
