LLM4PQC - Accurate and Efficient Synthesis of PQC Cores by Feedback-Driven LLMs

LLM4PQC is a feedback-driven, agentic framework that leverages large language models to automate the refactoring of complex post-quantum cryptography reference codes into synthesizable HLS specifications and RTL, significantly reducing manual effort and accelerating design-space exploration through a hierarchical verification process.

Buddhi Perera, Zeng Wang, Weihua Xiao, Mohammed Nabeel, Ozgur Sinanoglu, Johann Knechtel, Ramesh Karri

Published 2026-03-10
📖 5 min read🧠 Deep dive

Imagine you are a master architect trying to build a super-fast, quantum-proof bank vault (this is Post-Quantum Cryptography, or PQC). You have the blueprints, but they are written in a language meant for a human reader, not for a robot builder.

The paper you're asking about, LLM4PQC, is essentially a "Smart Translator and Construction Manager" that helps turn those human-readable blueprints into instructions a robot factory can actually build.

Here is the story of how it works, broken down into simple concepts:

1. The Problem: The "Human vs. Robot" Language Gap

Currently, when cryptographers design these new security algorithms, they write code in C (a programming language). This code is great for computers to run as software, but it's terrible for building hardware (like chips).

Think of it like this:

  • The C Code is a recipe written for a chef who has a full kitchen, a fridge, and a pantry. It says things like, "Go grab a bag of flour from the pantry," or "Mix this while the oven heats up."
  • The Hardware (HLS) is a robot arm on an assembly line. It doesn't have a pantry, and it can't "go grab" things. It needs everything pre-measured, sitting right in front of it, in a specific order.

If you try to feed the chef's recipe directly to the robot, the robot crashes. It doesn't know how to handle "dynamic memory" (grabbing things on the fly) or "math functions" (like calculating square roots on the spot).

2. The Solution: LLM4PQC (The Smart Translator)

The authors created a system called LLM4PQC. It uses a Large Language Model (LLM)—basically a super-smart AI that knows how to write code—to act as the translator.

But here's the catch: If you just ask the AI, "Translate this recipe," it often makes mistakes because it doesn't know the robot's limitations. So, the authors built a Feedback Loop.

The Four-Step Assembly Line:

Step 1: The Scavenger Hunt (Extraction)
The PQC algorithms are huge, like a 1,000-page novel. But the robot only needs to build the "engine" (the parts that do the heavy math), not the whole book.

  • Analogy: The AI reads the novel, finds the specific chapter about the engine, and copies just that page. It also sets up a "test drive" to make sure the engine still works before we start building.

Step 2: The Kitchen Renovation (Preprocessing)
The AI looks at the copied page and sees things the robot can't handle, like "Go to the pantry" (dynamic memory) or "Calculate the square root of 5" (floating-point math).

  • Analogy: The AI rewrites the recipe. Instead of "Go to the pantry," it says, "Here is a cup of flour sitting on the counter." Instead of "Calculate the square root," it says, "Here is the answer: 2.23." It turns a messy, flexible kitchen into a rigid, pre-stocked assembly line.

Step 3: The Translation & Trial Run (HLS Generation)
Now the AI translates this cleaned-up recipe into HLS-C (High-Level Synthesis). This is a language that hardware tools understand.

  • The Magic: The system doesn't just translate once. It tries to build the robot arm. If the robot arm breaks (the code fails), the system reads the error message, feeds it back to the AI, and says, "Hey, you told the robot to grab a cup that doesn't exist. Fix it."
  • The AI rewrites the code, tries again, and keeps doing this until the robot arm works perfectly.

Step 4: The Final Build (Synthesis & Verification)
Once the code passes all the tests, the system turns it into the final hardware design (RTL). It checks to make sure the new robot arm does exactly what the original chef's recipe said it should do.

3. Why is this a Big Deal?

Building hardware for these new security systems is usually slow, expensive, and requires a team of experts who speak "Robot" (hardware engineers).

  • Before LLM4PQC: It was like trying to build a car by hand, hammering every single bolt. It took months.
  • With LLM4PQC: It's like having a 3D printer that can read a sketch and print the car, fixing its own mistakes as it goes.

4. The Results: Fast, but maybe a bit "Compact"

The paper tested this on real-world security algorithms (Kyber, Dilithium, Falcon).

  • Success: The AI successfully built hardware for very complex parts, like the "Falcon Sampler" (which is notoriously difficult, like trying to build a Swiss watch out of LEGOs).
  • The Trade-off: The hardware built by the AI was incredibly small and efficient (it used fewer materials than human experts usually do). However, because the AI tended to be very careful and sequential, it was sometimes a little slower (higher latency) than a human expert who might have built a bigger, faster, but more expensive machine.

The Bottom Line

LLM4PQC is a new way to automate the creation of secure hardware. It uses an AI that learns from its own mistakes to turn messy, human-friendly code into clean, robot-friendly hardware instructions.

It's not perfect yet (it's still a bit slow compared to the best human designs), but it proves that we can use AI to build the "quantum-proof" hardware of the future, saving us years of manual labor. It's the difference between hand-crafting a watch and having a smart factory print one.