What MOSS misses
MOSS tells you which students in a class turned in code that looks a lot alike, and CS departments have leaned on it for decades. What it cannot tell you is whether a submission is original. Code copied from Stack Overflow or GitHub, code ChatGPT wrote, and a classmate's code with the loops reworked can all come back with a low score or no match at all, so a low MOSS score is not a clean bill of health. Below is one example of each, along with what the MOSS page and the research say.
Checks every file against classmates, the web and AI, in 65+ languages.
stats.pystats.pyThe loop and the comparison were rewritten (highlighted). MOSS fingerprints runs of tokens, and almost every run in this function changed.
How MOSS works
You upload a batch of files to MOSS. It strips each one down to tokens, so variable names, comments and spacing stop mattering. Then it fingerprints short runs of those tokens (the method is called winnowing) and lists the pairs of files that share the most.
That is why renaming variables will not get anyone past it. It also explains where it falls short:
It only sees what you upload
MOSS compares the files you send it with each other. As far as it knows, Stack Overflow, GitHub, tutorial sites and last year's submissions do not exist unless you upload them too.
AI-written code
Ask ChatGPT the same question twice and you get two different programs. AI-written submissions usually do not match each other, so MOSS has nothing to flag.
Reworked statements
Change enough of the token runs and the fingerprints change with them, even if the program still does exactly the same thing.
Results that expire
The MOSS page says results are typically deleted after 14 days. If a case might go to a hearing, save the report yourself.
What the research says
Alex Aiken, who wrote MOSS, says as much on the MOSS page, and several research groups have tested these gaps directly. Here is what they found, quoted from the source:
-
“while Moss automatically detects program similarity, it has no way of knowing why codes are similar.”
Alex Aiken, Stanford UniversityMOSS documentationRead itThe same page adds that "it is a misuse of Moss to rely solely on the similarity scores."
-
“Mossad is effective at defeating four plagiarism detectors, including Moss and JPlag.”
Breanna Devore-McDonald and Emery D. Berger, UMass AmherstOOPSLA 2020Read itTheir tool rewrites a copied program automatically, in minutes, into variants that are "classified as no more suspicious than legitimate assignments."
-
“they are vulnerable to advanced obfuscation based on structural modification of program code that preserves the original program behavior.”
Timur Sağlam and Larissa Schmid, Karlsruhe Institute of Technology2025Read itThe authors maintain JPlag. The paper covers detectors in general, including rewrites done with AI.
-
“a student using GPT-J ... can complete introductory level programming assignments without triggering suspicion from MOSS”
Stella Biderman and Edward Raff2022Read itThey also found the generated code "diverse in structure", so there is no single pattern for a similarity tool to look for.
-
“Existing detection methods, such as MOSS and JPlag (based on similarity metrics) and GPTzero (AI detection), have mixed success in identifying AI solutions.”
Kevin Wang, Seth Akins, Abdallah Mohammed and Ramon LawrenceIEEE CSCI 2023Read itThey tested this in three courses: CS1, CS2 and databases.
-
“ChatGPT generates code non-deterministically, and thus, traditional similarity detectors might not suffice to detect AI-created code.”
Muntasir Hoq, Thomas Price, Bita Akram and colleagues, NC State UniversitySIGCSE 2024Read itModels trained for the purpose did catch it. They report "accuracy above 90%" on CS1 submissions.
Rewritten copies
The example at the top makes three small changes. None of them changes what the program does:
- The
forloop becomes awhileloop with its own counter,index = index + 1. - The comparison is flipped and negated:
n > maximumbecomesnot (value <= maximum). - The current element gets its own variable,
value = numbers[index].
A student does not have to be clever to do this, and these days they do not have to do it by hand either. Devore-McDonald and Berger's Mossad does it automatically in minutes, and Sağlam and Schmid found that detectors in general struggle with this kind of change, including when AI does the rewriting. Put the two files side by side, though, and any TA can tell it is the same function.
What catches it: comparing the structure of the program rather than runs of tokens, and someone actually reading the top pairs. Codequiry's Zeus engine was built for restructured code like this.
What Codequiry catches that MOSS cannot
A Codequiry check does the same class-wide comparison MOSS does. It also checks every file against GitHub, Stack Overflow, Gist, Software Heritage and the open web, and runs two AI detection models on it. Here are the three cases MOSS cannot help you with.
Copied from Stack Overflow
A student finds an answer, renames everything and hands it in. Nobody else in the class used that answer, so there is no second file for MOSS to match it to.
brackets.pyanswerEvery name changed (highlighted). Renaming alone would not fool MOSS. The trouble is that MOSS only compares this file with the others you uploaded, and nobody else in the class used this answer.
Copied from GitHub
Students post their homework to GitHub after the course ends, and the next class finds it. Some instructors go as far as filing takedown requests to get those repos removed. Unless you upload every one of them with the batch, MOSS never sees them.
Account.javaBankAccount.javaOnly the names changed (highlighted). Two students do not independently come up with the same error messages and the same W: log entries. Details like that lead straight back to the repo.
Written by AI
There is nothing to match. The code did not exist anywhere until the student asked for it, so the only thing that can say anything about it is a check built for AI-written code.
words.py- Peer comparison (MOSS)No match
- Web checkNo match
- AI detection: Classification ModelLikely AI-written
- AI detection: Pattern & Style RecognizerConsistent with AI-written code
Both comparisons come back clean because there is nothing to compare against. Codequiry's Classification Model is trained on 100,000 AI-written and 100,000 human-written samples and updated as new models come out. As with any AI check, treat a flag as a reason to talk to the student, not as proof.
Two recent flags
submission.py
82%
submission.c
100%
Real flags from Codequiry. Student names, comments and strings are removed before anything is shown here.
Check what MOSS cannot see
Run the same batch against classmates, past terms, GitHub, Stack Overflow, the web and AI.
What to do about it
Keep using MOSS if it works for you. Just do not treat its report as the final word, which is what the MOSS page says too. In practice that looks like this:
- Keep running the peer comparison, and upload the starter code as a base file so it does not show up as matches.
- Add a web check against GitHub, Stack Overflow and the wider web, and include past terms.
- Add an AI check. Use a flag as a reason to talk to the student, not as proof.
- Read the top pairs yourself. Shared bugs, strange variable names, identical error messages and leftover dead code tend to survive a rewrite.
- Save the reports before they expire.
Codequiry does steps 1 to 3 in one check and keeps every report. Weighing the free options? See MOSS vs Dolos vs JPlag, or our full guide to detecting code plagiarism.
Frequently asked questions
What is MOSS?
MOSS (Measure of Software Similarity) is a free service from Stanford that compares a batch of programs against each other. Alex Aiken wrote it in 1994. It is free for academic use, and a lot of CS departments have relied on it for years.
How does MOSS detect plagiarism?
Strictly speaking, it detects similarity. It reduces each file to tokens, fingerprints short runs of those tokens with a method called winnowing, and lists the pairs of files that share the most fingerprints. Names, comments and spacing do not count. Whether a similar pair is actually plagiarism is up to you.
What does MOSS miss?
Anything that is not in the batch you upload. That covers code from Stack Overflow, GitHub or other sites that no classmate also used, past terms you did not include, and code written by AI. It can also score low on a copy whose statements were reworked into equivalent forms.
Can MOSS detect ChatGPT or other AI-written code?
Not reliably. MOSS compares students with each other, and AI output usually differs from student to student. Biderman and Raff (2022) found AI-written solutions to introductory assignments did not trigger MOSS, and Hoq et al. (SIGCSE 2024) note that similarity detectors might not suffice for AI-created code.
Does a low MOSS score mean a submission is original?
No. It only means the file shares few token runs with the other files you uploaded. It could still be copied from the web, reworked from a classmate's code, or written by AI.
Should I stop using MOSS?
No need. It is a solid peer comparison. Just do not treat it as the whole check. Add a web check and an AI check, and read the top pairs yourself, which the MOSS page recommends anyway.
Sources
- Aiken, A. Moss: A System for Detecting Software Similarity. Stanford University. theory.stanford.edu/~aiken/moss
- Schleimer, S., Wilkerson, D. S. and Aiken, A. Winnowing: Local Algorithms for Document Fingerprinting. SIGMOD 2003. PDF
- Devore-McDonald, B. and Berger, E. D. Mossad: Defeating Software Plagiarism Detection. Proc. ACM Program. Lang. 4 (OOPSLA), 2020. doi:10.1145/3428206
- Biderman, S. and Raff, E. Fooling MOSS Detection with Pretrained Language Models. 2022. arXiv:2201.07406
- Wang, K., Akins, S., Mohammed, A. and Lawrence, R. Student Mastery or AI Deception? Analyzing ChatGPT's Assessment Proficiency and Evaluating Detection Strategies. IEEE CSCI 2023. arXiv:2311.16292
- Hoq, M., Shi, Y., Leinonen, J., Babalola, D., Lynch, C., Price, T. and Akram, B. Detecting ChatGPT-Generated Code Submissions in a CS1 Course Using Machine Learning Models. SIGCSE 2024. doi:10.1145/3626252.3630826
- Sağlam, T. and Schmid, L. Evaluating Software Plagiarism Detection in the Age of AI: Automated Obfuscation and Lessons for Academic Integrity. 2025. arXiv:2505.20158
See what your last MOSS batch missed
Upload the same files and check them against classmates, past terms, GitHub, Stack Overflow, the web and AI.
Get started Every plan includes Deep Scans.