Efficient NewtonCG Implementation
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- python
- Domain
- machine-learning
Research direction
Start with the minimize function mentioned in the issue and trace how it reports the value, auxiliary values, and gradients. Determine the API and implementation changes needed to expose an HVP for a Newton-CG step without the extra graph passes described; the work is done when that usage is clearly supported and documented or tested.
Written by the indexing model from the issue text.
Description
Hi all, thanks for the phenomenal library. We're already using it in several statistical genetics methods in my group!
I've been porting over some older code of mine to use optimistix, rather than hand-rolled inference procedures and could use some advice. Currently, I am performing some variational inference using a mix of closed-form updates for variational parameters, as well as gradient-based updates for some hyperparameters. It -roughly- works like,
while True:
eval_f = jax.value_and_grad(_infer, has_aux=True)
((value, var_params), gradient) = eval_f(hyper_param, var_params, data)
hyper_param = hyper_param + learning_rate * gradient
if converged:
break
I'd -like- to retool the above to not only report the current value, aux values (i.e. updated variational parameters), and gradient wrt hyper param, but return a -hvp- function that could be used in a Newton CG like step in Optimistix. I know of the new minimize function, but what isn't clear is how to set up the scenario to not only report gradients, but also return a hvp function internally without having to take two additional passes over the graph (i.e. once for value and grad, another two for hvp => forward + backward).
Is this doable? Apologies if this is somewhat nebulous--I'm happy to clarify.
- Dominant language
- Python
- Stars
- 623
- Forks
- 54
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from patrick-kidger/optimistix
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
patrick-kidger/optimistix#236 · 1 comment ·
-
question
Difficulty 4/5 3-5 days Newbie friendliness 48/100
patrick-kidger/optimistix#231 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
patrick-kidger/optimistix#229 · 3 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
patrick-kidger/optimistix#223 · 1 comment ·
-
question
Difficulty 5/5 Over a week Newbie friendliness 25/100
patrick-kidger/optimistix#222 · 5 comments ·
All issues in patrick-kidger/optimistix
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100