What MOSS misses
MOSS finds pairs of students whose code shares long runs of tokens, and it does that well. But a low MOSS score does not mean a submission is original. MOSS cannot see code copied from Stack Overflow or GitHub, code written by AI, or a copy that was rewritten, and its own documentation and published research by computer science faculty say so. This brief shows each one on a fixed example, with the papers behind it.
2-day free trial. Checks every file against classmates, the web and AI, in 65+ languages.
stats.pystats.pyThe loop and the comparison were rewritten into equivalent forms (highlighted). A fingerprint comparison looks at runs of tokens, and almost every run changed.
How MOSS works
MOSS reads each file as a stream of tokens, so names, comments and whitespace drop out. It hashes short runs of those tokens into fingerprints using winnowing, then reports the pairs of files that share the most fingerprints.
That is why renaming variables does nothing against MOSS. It is also why MOSS has these blind spots:
Anything outside the batch
MOSS only compares the files you send. Stack Overflow, GitHub, tutorial sites and last year's class are invisible unless you add them yourself.
AI-written code
Generated code is usually different for every student, so it matches nothing in the batch.
Rewritten statements
If the token runs change, the fingerprints change, even when the program does exactly the same thing.
Results that expire
The MOSS page says results are typically deleted after 14 days, so the evidence has to be saved by hand.
What the research says
None of this is our claim alone. MOSS's author says it plainly, and computer science researchers have measured each blind spot. In their own words:
-
“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 itWritten by the team behind JPlag, about plagiarism detectors in general, including AI-generated rewrites.
-
“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 itMeasured across 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 job did detect it: they report "accuracy above 90%" on CS1 submissions.
Rewritten copies
The example at the top uses four ordinary rewrites, each of which leaves the program's behavior unchanged:
- A counted
forloop becomes an equivalentwhileloop. - A compound assignment like
total += nis expanded intototal = total + n. - A comparison is inverted and negated:
n > mbecomesnot (value <= m). - An indexed value is pulled into its own named variable.
None of these is sophisticated, and they no longer have to be done by hand. Devore-McDonald and Berger's Mossad does it automatically in minutes, and Sağlam and Schmid found detectors vulnerable to exactly this kind of behavior-preserving change, including rewrites done by AI. A person reading the two files side by side sees the same function immediately.
What catches it: comparing structure at a higher level than token runs, and reading the top pairs yourself. Codequiry's Zeus engine is built for restructured code like this.
What Codequiry catches that MOSS cannot
A Codequiry check runs the same peer comparison MOSS does. Then it checks every file against GitHub, Stack Overflow, Gist, Software Heritage and the open web, and runs two AI detection models on it. These are the three cases a MOSS batch has nothing to say about.
Copied from Stack Overflow
A student finds an answer, renames everything, and submits it. Nobody else in the class used that answer, so MOSS has nothing to pair it with.
brackets.pyanswerEvery name was changed (highlighted). Renaming does not fool a token comparison, but MOSS can only compare this file with the other files you sent, and nobody else in the class used this answer.
Copied from GitHub
Past students publish their homework, and the next class finds it. Unless you add every public repository to the batch yourself, MOSS never sees it.
Account.javaBankAccount.javaOnly the names changed (highlighted). The exact error messages and the W: log entries are the kind of detail two people do not invent independently, and they point straight at the repository.
Written by AI
There is nothing to match: the code was never anywhere before the student asked for it. Only a check built for AI-written code has anything to say about it.
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 kept current with new models. Like any AI check, treat its result as a question for the student, not a verdict.
Two recent flags
submission.cpp
80%
submission.py
97%
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.
2-day free trial
What to do about it
You do not need to stop using MOSS. You need to stop treating its report as the whole answer, which is what the MOSS page itself says:
- Keep the peer comparison, with the starter code passed as a base file.
- Add a web check against GitHub, Stack Overflow and the web, and include earlier terms.
- Add an AI check, and treat its result as a question for the student, not a verdict.
- Read the top pairs yourself. Look for shared bugs, odd names, identical messages and dead code, which survive any rewrite.
- Save the evidence before it expires.
Codequiry does steps 1 to 3 in one check and keeps every report. Comparing the free options instead? See MOSS vs Dolos vs JPlag, or read the full guide to detecting code plagiarism.
Frequently asked questions
What is MOSS?
MOSS (Measure of Software Similarity) is a free service from Stanford, written by Alex Aiken in 1994, that compares a batch of programs with each other. It is free for academic use and widely used in programming courses.
How does MOSS detect plagiarism?
It turns each file into a stream of tokens, hashes short runs of tokens into fingerprints with an algorithm called winnowing, and reports pairs of files that share many fingerprints. Names, comments and whitespace do not affect it.
What does MOSS miss?
Code copied from Stack Overflow, GitHub or another website that no classmate also used, code written by AI, copies whose statements were rewritten into equivalent forms, and anything from earlier terms you did not add to the batch yourself.
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 means the file shares few token runs with the other files in the batch. The code can still be copied from the web, rewritten from a classmate's work, or written by AI.
Should I stop using MOSS?
Not necessarily. It is a good 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, as the MOSS page itself advises.
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.
Start free trial2-day free trial
Just one assignment? Run a deep scan