4 ms·
> A simple comment explaining that the code is a booby trap would be enough for any human reading the code to know how to avoid it. The AI on the other hand has
by rented_mule 5y ago
> A simple comment explaining that the code is a booby trap would be enough for any human reading the code to know how to avoid it. The AI on the other hand has no capacity to understand that comment and to know not to put the code into its dataset.
Copilot users can be leveraged to train the algorithm to emit less such comments/traps. Copilot inserts snippets by having an extension running in the editor, watching what is typed and responding. That's an opportunity to gather more training labels. For example, which lines of Copilot emitted code are frequently deleted soon after being inserted? Gather enough such training labels and the algorithm can start to recognize many of those comments (and/or the traps the comments call out) and stop emitting those specific lines.
At that point, warning comments help the algorithm better distinguish desirable lines of code from traps. And you'll be less likely to have traps leak into your code by using Copilot rather than copy/pasting snippets from the web (both are subject to human review, but Copilot will already have filtered some traps). So it's possible that widespread deployment of traps would drive adoption of Copilot by people who frequently copy/paste code from the web.