ground truth fit is worse than cross validated fit on noisy data?
The main problem in your test is that your X has the same scale as your noise level (0-1), as a result, adding a noise changes your data distribution significantly.
This is your data distribution before and after adding noise.

It is like the noise is 50-200% more than your initial data. That's why you get a better result with CV than the &quot;ground truth weights&quot;. Because the new fitted model by CV is tuned for an X with a new distribution.
However, if you increase your X values scale, for example 100*np.random.rand(ntrials,nneurons), the your data have same distribution before and after adding noise.

Now if you run your code, you will get what you expected.