Plagiarism in Code: Academic Integrity in CS

Computer science classrooms are currently facing a massive shift in how academic integrity is defined and enforced. For decades, students have struggled with the temptation to copy code from peers or online repositories. Today, the rise of GitHub Copilot, ChatGPT, and Stack Overflow has blurred the line between resourceful programming and academic dishonesty.

If you are a computer science student or an educator, understanding the specific mechanisms universities use to catch plagiarism is vital. It is no longer just about spotting identical lines of code; it involves sophisticated algorithms and evolving policies regarding Artificial Intelligence.

The Standard of Detection: How MOSS Works

When a professor suspects code plagiarism, they rarely rely on manual review alone. The industry standard for decades has been a tool called MOSS (Measure of Software Similarity). Developed by Alex Aiken at Stanford University in 1994, this system remains the primary weapon against cheating in CS departments globally.

Understanding MOSS is essential because it is far smarter than simple “find and replace” tactics. Here is how it functions:

  • Structure Over Syntax: MOSS does not care about variable names or comments. If you take a classmate’s code and change int counter = 0 to int myCount = 0, MOSS views these as identical tokens.
  • Whitespace Insensitivity: Changing indentation, adding extra lines of space, or moving brackets to the next line does not fool the algorithm. It strips the code down to its structural logic.
  • ** fingerprinting:** The system breaks code into small chunks called “k-grams” and hashes them. It then compares these hashes across every assignment submitted in the class, as well as previous years’ databases.

Another popular tool is JPlag, developed at the Karlsruhe Institute of Technology. While similar to MOSS, JPlag is often preferred for Java-based courses because it parses the syntax tree of the program rather than just the text. This makes it even more resilient against students who try to reorder independent blocks of code to hide their tracks.

The GitHub and Stack Overflow Factor

Before AI became the headline, the primary challenge was public repositories. Sites like GitHub contain millions of solutions to standard CS 101 problems (like the “Towers of Hanoi” or “Dijkstra’s Algorithm”).

Professors are aware that real-world software engineering involves using open-source libraries. However, in an academic setting, the goal is to prove you understand the logic, not that you can find the answer.

To address this, universities have refined their policies on “boilerplate” versus “logic.”

  • Boilerplate Code: This includes standard import statements or setting up a main method. MOSS and JPlag can be configured to ignore these common segments so they do not trigger false positives.
  • The Citation Rule: Many departments, such as the Computer Science division at UC Berkeley, allow students to use small snippets of code found online provided they explicitly cite the source in the comments. However, copying the core algorithmic logic usually results in an academic infraction even if cited, as it defeats the purpose of the assignment.

The AI Revolution: Copilot and ChatGPT

The introduction of Large Language Models (LLMs) has forced a complete rewrite of syllabi across the country. Tools like GitHub Copilot can autocomplete entire functions, and ChatGPT can write a working Python script from a single prompt.

Detection here is more difficult. Unlike copying from a peer, AI generates unique syntax every time. MOSS is less effective against AI-generated code because there is no “source” document to compare it against.

How Universities Are Responding

Schools are moving away from banning AI entirely and are instead regulating how it is used.

  1. The “Tutor, Not Driver” Model: Harvard University’s famous introductory course, CS50, has introduced its own AI bot (CS50.ai). It is designed to explain concepts and find bugs but is programmed to refuse to write code for the student. This sets the standard: using AI to understand an error message is acceptable; asking AI to solve the problem is not.
  2. Oral Exams: Because AI code is hard to detect via software, professors are returning to oral defenses. Students may be asked to explain specific lines of their code in person. If a student cannot explain a complex loop or a recursive function they “wrote,” it is considered evidence of plagiarism.
  3. In-Class Coding: To ensure integrity, grades are increasingly weighted toward exams taken in a controlled environment (blue book exams or disconnected lab computers) rather than take-home programming assignments.

The "Regret Clause" and Consequences

Computer science departments are known for having some of the strictest honor codes, but they are also pragmatic. They understand that students procrastinate and panic.

To combat this, many courses have adopted a “Regret Clause” or “72-Hour Rule.”

  • How it works: If a student submits plagiarized work but admits to it within 72 hours (or before the grading begins), they receive a zero on the assignment but face no further disciplinary action.
  • The alternative: If they are caught by MOSS or an instructor without admitting it first, the consequences are severe. This often includes an “XF” grade (failure due to academic dishonesty) on their transcript, suspension, or expulsion.

The goal of these policies is to encourage integrity even after a lapse in judgment. It allows a student to fail an assignment safely rather than risking their academic career.

Frequently Asked Questions

Can MOSS detect if I translated code from Python to C++?

Generally, no. MOSS compares code within the same language. However, if a professor suspects cross-language plagiarism, they can manually review the logic structure, which remains identical regardless of the language syntax.

Is it plagiarism to look at a friend’s code to help debug mine?

In most strict CS curriculums, yes. This is often called the “Whiteboard Rule.” You can discuss the logic on a whiteboard or piece of paper, but you should never look at each other’s screens or exchange digital files. If you can see their syntax, you are likely to subconsciously copy it.

Do professors check code against solutions from previous years?

Yes. MOSS databases are cumulative. Professors upload the solutions from the past several years into the system. Finding a GitHub repo from a student who took the class three years ago is the easiest way to get caught.

Can AI detectors like GPTZero catch generated code?

Currently, AI detectors are less reliable for code than they are for English essays. Code follows strict syntax rules, making it “robotic” by nature. This leads to high false-positive rates. Professors rely more on oral questioning and logic verification than on AI detection software for code.