Disabling line search

Is there a way to disable line search in cmdstan?

I’m working with a gnarly posterior that line search has an extremely difficult time with. MCMC and the eval at then initialization point are basically completely unproblematic, in that I can initialize and the gradient is defined. NUTS has no issue either.

Line search typically fails immediately because the model is very sensitive to perturbations. We’ve tried many different parameterizations and do not think the model can be reduced substantially. I’m aware of previous posts on the topic of line search. I understand that there may be changes that can be made to the model to make it behave smoothly, but we’re struggling to find any additional changes we can make after nearly two years of development.

I know that numeric tools such as dense preconditioning could also help. In our case, the number of parameters, speed of forward and backward passes, and memory limit the ability to fit dense matrices.

A common experience for me is struggling to find initialization points that force line search to pass.

Instead, I’d rather just disable line search and permit the optimizer to begin from the exact initialization point I specified. I know this may cause additional issues with convergence rates etc or force us into unreasonable local optima, but at this point I would really prefer to just be able to control when line search is applied even for simple debugging purposes.

Any tips?

1 Like

Context note: my issue is typically non-finite gradients, not non-finite objective values. I’m not sure if that implies that the gradient is null/na or if there are inf/-inf values in the gradient. Not sure how to debug that, though.

1 Like

Another thing I’d be interested in is preconditioners for optimization routines, in the event that it makes problems like these more well-behaved.

The non-finite gradient issue has been popping up several times in the last couple months. I assume the current line search doesn’t check whether the gradient at evaluation points is finite (floating point finite), and I have suggested (after summer vacation I just can’t remember where I wrote that) the line search should check that and then the line search would not jump too far. Tagging @Bob_Carpenter and @stevebronder. I created a new issue Modify the opitimization lines earch to not return a point with non-finite gradient · Issue #3306 · stan-dev/stan · GitHub

3 Likes