This is exactly how it should work. Any code copied from GNU GPL code should legally also be GNU GPL, no ifs, ands or buts.
Oh, your training data set contains GPL code? Guess what, all the output from that model is now GPL. It's your burden to prove that your training data does not contain any GPL code.