I'm not sure exactly what you mean by "invalid", and in particular why this doesn't apply to the test set (if you're allowed to peek at the topics for training, you should do the same for test).