Anti-AIClone

Log date · Fri

Can Java opcode birthmarks prove code plagiarism?

No score alone proves copying. A Java sample compares opcode birthmarks for renaming, a different calculation and an equivalent rewrite.

Can Java opcode birthmarks prove copying?

No single similarity score proves copying. Opcode k-grams can flag code for review, but the same instructions can arise from different calculations. In our sample, both a renamed method and a different calculation scored 1.000 against the original for 3-gram Jaccard; an equivalent rewrite scored only 0.111.

Our sample comparison
QuestionFinding
Renamed3-gram Jaccard 1.000; same outputs for three inputs.
Different calculation3-gram Jaccard 1.000; output differs at input 1.
Equivalent rewrite3-gram Jaccard 0.111; same outputs for three inputs.

On July 3, 2026, at 06:49 UTC, Nikolay Fedorov, Akito Monden and co-authors submitted v1 of “Detection of LLM-assisted Code Plagiarism Using k-gram Software Birthmarks” to arXiv. [1] The authors report that Java opcode birthmarks remained effective against LLM-paraphrased code under their study conditions.

How we made the toy comparison

We compiled four methods we wrote with OpenJDK 17.0.19 and used Python 3.8.20 to extract opcode mnemonics from javap output. The renamed version changes only the parameter name; the different calculation changes the multiplier from 7 to 9; the rewrite uses a shift and subtraction to multiply by seven. We did not call an LLM. This illustrates the underlying idea, not a replication of the paper’s method or results, and does not test real products or obfuscation.

Four methods written for this sample.
static int original(int x) { return x * 7 + 3; }
static int renamed(int value) { return value * 7 + 3; }
static int unrelated(int x) { return x * 9 + 3; }
static int rewritten(int x) { return (x << 3) - x + 3; }

For each method separately, we take consecutive groups of k mnemonics, remove duplicates and divide the intersection size by the union size: the Jaccard coefficient. Looking only at mnemonics discards operands: a JVM instruction can contain an opcode and operands. [3] javap -c displays instructions and -p includes private members. [2] We neither join grams across method boundaries nor count repeated occurrences.

Output from our run.
original: iload_0 bipush imul iconst_3 iadd ireturn
renamed: iload_0 bipush imul iconst_3 iadd ireturn
unrelated: iload_0 bipush imul iconst_3 iadd ireturn
rewritten: iload_0 iconst_3 ishl iload_0 isub iconst_3 iadd ireturn

What the scores actually say

The bipush operands in original and unrelated are 7 and 9 respectively; when we compare mnemonics alone, the sequences are identical. At input 1 their outputs are 10 and 12. Conversely, the rewrite agrees on the three inputs, and its integer expression computes the same result under Java int shift and overflow arithmetic, yet the changed instruction sequence lowers the 3-gram score. Those three inputs alone do not prove equivalence for all inputs.

3-gram intersections, unions and scores, copied verbatim.
original vs renamed k=3: intersection=4 union=4 Jaccard=1.000
original vs unrelated k=3: intersection=4 union=4 Jaccard=1.000
original vs rewritten k=3: intersection=1 union=9 Jaccard=0.111

The paper uses k from 1 to 6 and compares cosine, Dice, Jaccard, Simpson and edit-distance-based similarity. Its inputs were individually compilable files from active BSD-2-Clause Java projects, paraphrased using ChatGPT-5.1-Codex-Mini, DeepSeek-V4-Flash and Claude-Haiku-4.5. The authors report that Codex Mini produced the hardest clones to detect and that coding-oriented models performed better at the task. [1] Those findings belong to the paper’s dataset and conditions; our toy scores are not its accuracy figures.

Common compiler patterns, short methods and shared dependencies can produce high similarity. Evaluate any threshold against normal versions of the same project, known related samples and independent samples, recording false positives and false negatives. Compiler, build options, comparison granularity and k can all change results; fix these conditions before interpreting a trend.

Recommendations for handling a lead

These are engineering recommendations, not detection benefits measured by our experiment. Use a birthmark to locate material for investigation; attribution needs other independent evidence.

Recommendations by situation
QuestionFinding
High-scoring matchInspect matching regions, common libraries and build provenance; preserve reproducible records.
Low score with other concernsCheck granularity and transformations; investigate behavior, design and history.
Building an internal baselineFix tools, versions, method boundaries and k; include independent negative samples.
Preparing a disputePreserve original artifacts, hashes, timeline and development records; seek appropriate professional advice.

Detection happens after comparable material is available and does not prevent copying. Assume logic that must run offline can be inspected; for sensitive rules that can run on a controlled server, weigh migration against latency, availability and authorization requirements.

Check your own Java project

Substitute a class file you are authorized to inspect and identify the target method boundaries and instructions. The comparison script we used in our sample recognizes only this example’s simple method signatures; it is not a general class-file parser. Switches, exception handling, overloads, generated code and different javap formats need specific handling.

Substitute your own class file.
javap -c -p path/to/YourClass.class

For each release, retain the artifact, hash, source commit and build tool versions, together with commit history, design documents and release dates under your team’s retention policy. Establish a baseline from versions representing normal evolution and include independently written negative examples. Record the comparison scope, extraction rules, k, scores and review conclusions. Recalibrate after toolchain upgrades so build changes are not mistaken for evidence of origin.

Your checklist

  • Archive each release artifact, hash and source commit.
  • Fix tool versions, method boundaries and k when establishing a baseline.
  • Include independent negatives and record false positives and false negatives.
  • Review matched regions, common dependencies and the development timeline.
  • Evaluate where sensitive rules run against permissions, latency and offline needs.

Primary sources

All sources and reproduction status ↗