Live data from Hacker News

Try to guess if code is real or GPT2-generated

doesnotexist.codes

21–30 of 108 posts

Re: Try to guess if code is real or GPT2-generated

#22
post #16

Earlier quoted context omitted.

There are likely some "tells" but many fewer of them than I expected. I've seen it occasionally generate something malformed like "#includefrom", and like all GPT2 models it has a tendency to repeat things. Yes, I think people definitely find it challenging. I'm keeping track of the correct and total guesses for each snippet, right now people are at almost exactly 50% accuracy: correct | total | pct ---------+-------…

Are you presenting real samples and GPT2 samples to users with equal probabilities? EDIT another poster guessed GPT2 each time and found the frequency was 80 percent

It should be equal: there are 1000 real and 1000 generated samples in the database, retrieved via:

SELECT id, code, real FROM code ORDER BY random() LIMIT 1

Re: Try to guess if code is real or GPT2-generated

#24
post #19
post #11

Hi, author here! Some details on the model: * Trained 17GB of code from the top 10,000 most popular Debian packages. The source files were deduplicated using a process similar to the OpenWebText preprocessing (basically a locality-sensitive hash to detect near-duplicates). * I used the [Megatron-LM]( https://github.com/NVIDIA/Megatron-LM ) code for training. Training took about 1 month on 4x RTX8000 GPUs. * You can d…

Can you share the dataset too?

Sure, it's here in JSON format: https://moyix.net/~moyix/csrc_dataset_large.json.gz

Re: Try to guess if code is real or GPT2-generated

#25
post #17
post #14

This looks like overfitting to me. Some of the GPT samples were definitely real code, or largely real code. One looked like something from Xorg, another like it was straight from the COLLADA SDK. It’s really hard to define what “truly new code” is, if it’s just the same code copy pasted in different order. Blah blah Ship of Theseus etc.

The generated snippets are prompted with 128 characters from real code (but not code from the training data), so they can often pick up on the name of the project etc.

Apologies if my comment was dismissive. This is an impressive project!

Re: Try to guess if code is real or GPT2-generated

#26
post #16

Earlier quoted context omitted.

There are likely some "tells" but many fewer of them than I expected. I've seen it occasionally generate something malformed like "#includefrom", and like all GPT2 models it has a tendency to repeat things. Yes, I think people definitely find it challenging. I'm keeping track of the correct and total guesses for each snippet, right now people are at almost exactly 50% accuracy: correct | total | pct ---------+-------…

Are you presenting real samples and GPT2 samples to users with equal probabilities? EDIT another poster guessed GPT2 each time and found the frequency was 80 percent

I guessed GPT2 each time, 200 times in a row and only found that GPT2 was correct 89/200 times, so about 45% was GPT2 for me.

Re: Try to guess if code is real or GPT2-generated

#29

The two factors that seemed like dead giveaways were comments that didn't relate to the code, and sequences of repetition with minor or no variations.

If only. Humans leave dead comments all the time and I was wrong when I guessed “gpt” wrote this based on that. Being confusing isn’t reliable either unless it’s a syntax error

Re: Try to guess if code is real or GPT2-generated

#30
This is actually quite impressive. Try reading the comments in the code. The comments often make perfect sense in the local context even if it’s GPT-2 gibberish.

The real examples have worse comments at times.

The only flaw is that it shows fake code most of the time so you can game it that way.

Post reply on HN