← Latest papers
💻 computer science

CrypFormBench: Benchmarking Formal Analysis Capability of Large Language Models for Cryptographic Schemes

This paper introduces CrypFormBench, a comprehensive benchmark comprising 700 instances across 677 cryptographic schemes and 7 formal verification languages, to evaluate and reveal the current limitations of large language models in generating and correcting formal security proofs while offering practical strategies to improve their performance.

Original authors: Zhaoxuan Li, Qionglu Zhang, Hengyuan Liu, Xiaoyan Gu, Xianhui Lu, Hongbo Liu, Bingzheng Wang, Haihui Fan, Ziming Zhao, Rui Zhang, Li Zhou

Published 2026-06-25
📖 6 min read🧠 Deep dive

Original authors: Zhaoxuan Li, Qionglu Zhang, Hengyuan Liu, Xiaoyan Gu, Xianhui Lu, Hongbo Liu, Bingzheng Wang, Haihui Fan, Ziming Zhao, Rui Zhang, Li Zhou

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

The Big Picture: The "Translator" Problem

Imagine you are a master architect who designs incredibly secure vaults (cryptographic schemes). You write your blueprints in plain English so anyone can understand the plan. However, to actually build and test these vaults for weaknesses, you need to translate those English blueprints into a very strict, ancient, and complex language that only specific, high-tech security robots (formal verification tools like Scyther or Tamarin) can understand.

This translation is hard. It requires a human expert who knows both the vault design and the robot's strict language. If you miss one tiny comma or use the wrong word, the robot rejects the blueprint, or worse, it builds a vault that looks secure but has a hidden backdoor.

The Question: Can Large Language Models (LLMs)—the AI chatbots we use today—act as these expert translators? Can they take a plain English description of a security protocol and instantly write the perfect, error-free code for the security robots?

The Answer (according to this paper): Not quite yet. They are getting better at reading and fixing, but they still struggle to write from scratch.


The Solution: CrypFormBench (The "Gym" for AI)

To find out exactly how good these AI translators are, the researchers built a massive testing ground called CrypFormBench (or C.F.B).

Think of this as a gym with 700 different workout stations.

  • The Equipment: They gathered 700 real-world security protocols (like the ones used in your phone, banking, or the internet).
  • The Languages: They translated these protocols into 7 different "robot languages" (formal languages like SPDL, HLPSL, EasyCrypt, etc.).
  • The Tests: They didn't just ask the AI to write code. They tested five specific skills:
    1. Interpretation: "Here is a robot code; explain it to me in English." (Reading)
    2. Generation: "Here is an English description; write the robot code." (Writing from scratch)
    3. Completion: "Here is a robot code with holes in it; fill in the blanks." (Fixing partial work)
    4. Transformation: "Here is the code in Language A; rewrite it in Language B." (Translating between robots)
    5. Correction: "This robot code has an error; fix it." (Debugging)

The Results: The AI's Report Card

The researchers tested 9 of the smartest AI models available (including GPT-4o, Claude-3.5, and DeepSeek). Here is what they found:

1. The "Good at Reading" Skill (Interpretation & Completion)

  • Analogy: Imagine a student who is great at reading a textbook and can fill in the missing words in a sentence because the context is already there.
  • Result: The AIs were surprisingly good at this. When given a code snippet with a few missing parts, or asked to explain what a piece of code does, they performed very well. They understood the "grammar" of the security languages.

2. The "Bad at Writing" Skill (Generation & Transformation)

  • Analogy: Now imagine asking that same student to write a whole new textbook from scratch, or translate a book from French to Japanese without a dictionary. They start hallucinating, making up rules, or forgetting the strict grammar.
  • Result: This is where the AIs failed.
    • Generation: When asked to write a full security protocol from a plain English description, most AIs produced code that the robots couldn't even run. It was like writing a sentence with broken syntax.
    • Transformation: When asked to translate code from one robot language to another, the AIs often got confused. They would mix up the rules of the two languages, creating a "frankenstein" code that didn't work in either.
    • The Score: Even the best AI (Claude-3.5) only scored 48.7 out of 100. This means less than half of their attempts were actually usable by the security tools.

3. The "Fixing" Skill (Correction)

  • Analogy: If you give the student a sentence with a clear typo (e.g., "recieve" instead of "receive"), they can fix it easily. But if the sentence is grammatically correct but logically wrong (e.g., "The vault is open to everyone, but it is secure"), they struggle to find the logic error.
  • Result: The AIs were good at fixing simple syntax errors (typos). However, they struggled with "semantic" errors—fixing the logic of the security protocol itself.

Why is this so hard?

The paper explains that these "robot languages" are not like Python or Java. They are extremely strict.

  • The "One Mistake" Rule: In normal coding, if you miss a semicolon, the computer might just complain. In these security languages, one missing word can change the entire meaning of the security proof, making a secure vault look insecure, or vice versa.
  • The "Context" Problem: These protocols often depend on long chains of events (e.g., "If Alice sends a message at step 1, Bob must reply at step 2, but only if he hasn't seen a message from step 0"). AIs often lose track of these long chains.

What Can We Do? (The "Training Wheels")

The paper suggests that while we can't rely on AIs to do the whole job alone yet, we can use them as assistants if we give them the right help:

  • Few-Shot Prompting: Instead of just saying "Write this," show the AI three examples of how to write it first. This acts like a cheat sheet.
  • Pass@K: Ask the AI to try writing the code 5 times, and then pick the best one. This increases the odds of getting a working version.
  • Human-in-the-Loop: Use the AI to draft the code, but have a human expert check it before the security robot runs it.

The Bottom Line

The paper concludes that Large Language Models are currently excellent research assistants for understanding and fixing security code, but they are not yet reliable architects for building new security protocols from scratch.

They can help you read the manual and fix your typos, but you still need a human expert to ensure the vault is actually secure before you hand the keys over. The benchmark (CrypFormBench) is now available for other researchers to test new AI models against these same strict standards.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →