← Latest papers
💻 computer science

Detection of LLM-assisted Code Plagiarism Using k-gram Software Birthmarks

This paper demonstrates that k-gram software birthmarks based on Java opcodes remain effective in detecting LLM-assisted code plagiarism across various models and similarity measures, despite the challenges posed by code paraphrasing.

Original authors: Nikolay Fedorov, Akito Monden, Hiroki Inayoshi, Haruaki Tamada, Masateru Tsunoda

Published 2026-07-07
📖 4 min read☕ Coffee break read

Original authors: Nikolay Fedorov, Akito Monden, Hiroki Inayoshi, Haruaki Tamada, Masateru Tsunoda

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 secret recipe for a delicious cake. In the old days, if someone wanted to steal your recipe, they would have to copy it word-for-word. It was easy to catch them because the handwriting or the typing would look exactly the same.

But now, imagine a super-smart robot chef (an AI) that can look at your recipe, rewrite it entirely, and give you a new version that tastes exactly the same but looks completely different. It changes the font, swaps "sugar" for "sweetener," rearranges the steps, and uses different measuring cups. To a human eye, it looks like a brand-new recipe. This is what the paper calls LLM-assisted code plagiarism.

Here is how the researchers in this paper tackled the problem of catching these "robot-chef" thieves, explained simply:

The Problem: The "Magic" Rewrite

Software developers write code (the instructions for computers). Large Language Models (LLMs) are AI tools that can take existing code and "paraphrase" it. They change the look and structure of the code so much that traditional plagiarism detectors (which look for identical words or lines) get fooled. The program still does the exact same thing, but it looks like it was written by a different person.

The Solution: The "Software Fingerprint"

The researchers didn't try to read the rewritten code like a human. Instead, they used something called Software Birthmarks.

Think of a birthmark like a unique fingerprint. Even if you change your clothes, haircut, or glasses, your fingerprint stays the same.

  • How they made it: They took the computer's "recipe" (the code), translated it into a list of basic machine instructions (called opcodes), and chopped them up into small chunks of 2 to 6 instructions at a time.
  • The Analogy: Imagine you have a sentence: "The cat sat on the mat."
    • A 1-gram (chunk of 1) is just the words: "The", "cat", "sat"... (Too common; many sentences have "the").
    • A 2-gram (chunk of 2) is pairs: "The cat", "cat sat", "sat on"... (More unique).
    • A 3-gram is triples: "The cat sat", "cat sat on"... (Even more unique).

They turned the whole program into a bag of these chunks. Even if the AI rearranged the sentences, the specific types of chunks (the fingerprint) would likely still be there.

The Experiment: Who is the Best Thief?

The researchers tested three different "robot chefs" (AI models):

  1. ChatGPT-5.1-Codex-Mini
  2. DeepSeek-V4-Flash
  3. Claude-Haiku-4.5

They took real, open-source Java programs, asked these AIs to rewrite them, and then tried to catch the AIs using their "fingerprint" method. They also tested different ways to compare the fingerprints (like counting how many chunks match vs. how close the order is).

The Findings: What Worked?

1. The Size of the Chunk Matters (The "Goldilocks" Zone)

  • Too small (1 chunk): It was like trying to identify a person just by the word "the." Too many people use it, so it wasn't a good fingerprint.
  • Too big (6 chunks): It was like trying to match a whole paragraph. If the AI moved just one sentence, the whole paragraph didn't match, and the fingerprint broke.
  • Just right (2 or 3 chunks): This was the sweet spot. These small groups of instructions were unique enough to identify the original code but sturdy enough to survive the AI's rewriting.

2. How You Compare Matters

  • Order doesn't matter: The researchers found that looking at the order of the instructions (like checking if the steps were in the exact same sequence) was a bad idea. The AI scrambled the order so much that this method failed.
  • Counting matters: The best method was simply counting how many unique chunks appeared in both the original and the rewritten code, regardless of order. It's like saying, "Do both recipes contain 'flour' and 'eggs'?" rather than "Did they add the eggs before the flour?"

3. Which AI was the Hardest to Catch?

  • ChatGPT-5.1-Codex-Mini was the sneakiest. It managed to rewrite the code so thoroughly that it was the hardest to detect, yet it still produced code that actually worked (compiled without errors).
  • The other two AIs (DeepSeek and Claude) were easier to catch because their rewrites left more obvious "fingerprints" behind.

The Bottom Line

Even though AI can rewrite code to look completely different, it can't change the fundamental "DNA" of how the computer thinks. By looking at small, unique patterns of machine instructions (birthmarks) and counting how many match, we can still catch the thief, even if they are using a super-smart robot to disguise the crime.

The paper concludes that this method works well against modern AI plagiarism, especially when using small chunks of code (2 or 3 instructions) and focusing on what is in the code rather than where it is.

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 →