What should a teacher do with information about plagiarism before the final submission As probably we all experience, plagiarism is very common in CS. I know that there are several types of plagiarism ranging from simply submitting a copy of the colleagues’ code to other highly sophisticated mechanisms. In my experience, the most common is indeed the simplest one. The student just grabs the code from another colleague and eventually change the names of the variable, and submits the solution (some students don’t even do that!).

While there are several systems that are easily capable of detecting this type of plagiarism, they do it mainly when the student submits the final version of the code. Some other tools, are capable of detect plagiarism and notify the student about that (as if they didn’t already know that!). 
In most cases the use of an anti-plagiarism tool will act mainly to support punitive measures. 

Although it is not the main focus, as part of my PhD work, I am working in a tool that analyses the source code as it is being written and is able to detect plagiarism in “real-time”. This way, the teacher can be notified about students that are performing plagiarism even before their final solution is submitted, giving the teacher time to act and avoid the punitive measures.

My biggest question is: What should the teacher do with that information? Will this be efficient?
I assume that somewhere you discuss plagiarism and the social good of respecting the IP of others. If not, plagiarism detection is just a "gotcha" that doesn't really benefit the students or your relationship with them. 

The following suggestion is offered tentatively, and might require tuning. It might also require research on the effect. 

If the tool is good enough to tell you in real time that something bad is occurring, it is also good enough to tell the student at that moment. So you could build that feature into the tool. 

However, there is, then, the danger that a student could game the system, modifying things just enough that the warning goes away. So it might be necessary for the warning given the student to also warn that not every "violation" will be reported to the student but will be reported to the instructor. 

Caveat: This was "seat of the pants - in the moment" design. I can't claim it is best practice. It is, however, based on the principle that fairness and communication are positive attributes in education. Help the student grow in many dimensions, not just the technical. 



In your discussions with students about plagiarism, be sure to include the concept of self plagiarism which many don't recognize as a problem since it doesn't violate IP rules. But does make derived research and attribution more difficult. 

And, like any lesson, it needs to be reinforced. Very little that you do just once will actually be learned. Active learninig is reinforcing as lecture is not. Class discussions about plagiarism and its tradeoffs (short term gain - long term  pain) might be useful.