Optimization and generated parameters

I just noticed today that the generated parameters block is used during optimization – perhaps I’m missing something, but this seems a) more costly (relatively) than in the HMC case with many steps per single generated parameters computation, b) not at all useful.

It’s probably something that could be optional once the output handling is more flexible. Do you know what would have to change?

I’m not so familiar with the inner workings of Stan, but naively, I would have expected that during optimization, only the gradient and lp are needed (neither of which should compute generated quantities), then the quantities can be generated once, at convergence.

That’s the goal for when we get all of our I/O in order. Right now, I think it’s too much of a challenge dealing with non-rectangular data structures that result from missing generated quantities in warmup iterations.