← Latest papers
💻 computer science

ClozeMaster: Fuzzing Rust Compiler by Harnessing LLMs for Infilling Masked Real Programs

The paper introduces ClozeMaster, a fuzzing tool that leverages large language models to synthesize valid Rust test programs by extracting and infilling masked code snippets from historical bug reports, thereby outperforming existing fuzzers and discovering 27 confirmed compiler bugs.

Original authors: Hongyan Gao, Yibiao Yang, Maolin Sun, Jiangchang Wu, Yuming Zhou, Baowen Xu

Published 2026-05-04
📖 4 min read☕ Coffee break read

Original authors: Hongyan Gao, Yibiao Yang, Maolin Sun, Jiangchang Wu, Yuming Zhou, Baowen Xu

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

Imagine you have a very strict, high-end chef (the Rust compiler) who is famous for making incredibly safe and fast meals. This chef has a very specific set of rules: if you try to put ingredients in the wrong order, use a forbidden spice, or mix textures that don't belong together, the chef doesn't just say "no." Sometimes, the chef gets so confused by your weird request that they drop the whole tray, scream, or freeze up completely. These are the "bugs" the paper talks about.

The problem is that it's very hard to trick this chef. If you just throw random ingredients at them (like a standard "fuzzer" or automated tester), they usually just ignore you or say "invalid order" politely. They rarely get confused enough to crash.

Enter ClozeMaster, the new method proposed by the researchers. Here is how it works, using a simple analogy:

The "Mad Libs" Strategy

Instead of asking the chef to guess what you want from scratch, the researchers decided to look at past mistakes. They went into the chef's complaint log (the "bug reports") and found recipes that had previously made the chef crash or freeze.

They realized these "crash recipes" had a special structure. They were like a game of Mad Libs (a word game where you fill in blanks).

  1. The Masking (The Blank): The researchers took a recipe that once made the chef crash. They looked at the parts inside the parentheses, brackets, and braces (like ( ), { }, [ ]). They covered those specific parts with a "mask" (a blank space), leaving the rest of the recipe intact.

    • Analogy: Imagine a recipe that says: "Mix the flour with the ______ and bake." The bold part is the blank. The rest of the sentence (the structure) is safe and grammatically correct.
  2. The AI Filler (The LLM): They used a smart AI (a Large Language Model) to fill in those blanks. But they didn't just ask the AI to write a random sentence. They first "trained" the AI on all those old, broken recipes so the AI learned the specific "flavor" of code that confuses the Rust chef.

    • Analogy: The AI is like a student who has studied every time the chef got angry. When asked to fill in the blank, the AI doesn't just write "sugar"; it might write something weird like "a live octopus" because it knows the chef gets confused by strange combinations.
  3. The Result: Because the structure of the recipe was perfect (it was based on a real, working recipe), the chef accepted it. But because the filled-in part was weird and complex, the chef got confused and crashed. This revealed a new bug.

Why This Was Needed

The researchers found that Rust is like a language with very complex grammar rules.

  • Old methods were like throwing darts blindfolded at a board. They rarely hit the bullseye (the bug) because the rules are too strict.
  • Direct AI generation was like asking a student to write a recipe from scratch without looking at any examples. The student (the AI) didn't know enough about Rust's strict rules and wrote nonsense that the chef immediately rejected.
  • ClozeMaster was like giving the student a partially written, complex recipe and asking them to finish just one tricky sentence. The student knew the context, so they wrote something that fit the rules but was still weird enough to break the chef.

What They Found

The team built a prototype tool called ClozeMaster and tested it on two versions of the Rust chef (the official one and a community-made one).

  • They found 37 new bugs (crashes or freezes) that no one had seen before.
  • The developers confirmed 27 of them and fixed 10 of them.
  • Their tool was much better at finding these bugs and exploring the chef's "kitchen" (code coverage) than the previous best tools.

The Takeaway

The paper claims that by taking old, broken code, hiding specific parts of it, and using an AI to fill in those parts, they can create new, tricky tests that expose hidden weaknesses in the Rust compiler. It's a way of using history to predict where the future mistakes might hide.

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 →