Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify the opitimization lines earch to not return a point with non-finite gradient #3306

Open
avehtari opened this issue Jul 31, 2024 · 1 comment
Assignees

Comments

@avehtari
Copy link
Collaborator

There are some reports (e.g. https://discourse.mc-stan.org/t/disabling-line-search/36062) optimization returning a point that has finite log density but infinite gradient. The current line search does not check that the gradient is finite. The line search could modified so that when the gradient is non-finite the corresponding log density value is considered to be -Inf and then line search would more likely keep out of problematic areas (I did this in GPstuff software many years ago)

@Garren-H
Copy link

Garren-H commented Aug 1, 2024

To add to this I have also been experiencing problems where if I start at a point close to the a mode, bfgs and lbfgs results in an error (newton is not feasible due to the dimensionality of the problem). I am using a cluster to perform inference and sometimes my take weeks to run. The cluster has a max walltime of about 5 days (which can not be changed due to capacity reasons). I hence resort to running a fixed number of iterations, saving the final iteration and starting a new job from the previous point which frequently results an error "line search could not make progress". I have been using cmdstan 2.34, have not updated to the latest version.

cpfiffer added a commit to cpfiffer/stan that referenced this issue Aug 5, 2024
Related to stan-dev#3306

Modify the `WolfeLineSearch` function in `src/stan/optimization/bfgs_linesearch.hpp` to handle non-finite gradients.

* Check if the function value `func_val` is finite.
* Check if the gradient `gradx1` is finite.
* If either the function value or the gradient is non-finite, restart the line search with a smaller step size.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/stan-dev/stan/issues/3306?shareId=XXXX-XXXX-XXXX-XXXX).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants