question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does tutorial 2 use the Theseus derivatives through the NLLS? (Or just through the objective?)

See original GitHub issue

This tutorial parameterizes a quadratic ax^2+b with a optimized by PyTorch autograd and b optimized with the Theseus NLLS for a given a. The key piece that enables a to be learned is that we pass it back into the same cost function the NLLS optimizer uses except we take a gradient step of the cost function w.r.t. a, which doesn’t use the derivative information of how b was computed through the NLLS optimizer: image

Thus if I understand correctly, this tutorial isn’t using the derivatives through the NLLS optimization process. To try to understand this better, I added a torch.no_grad call around the NLLS optimizer to block the gradients through it and it didn’t change the output and it was still able to fit the quadratics: image image

\cc @vshobha @mhmukadam @luisenp

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
mhmukadamcommented, Dec 17, 2021

Thanks for flagging @bamos and everyone for the discussion. Let’s follow @vshobha’s proposal, we’ll merge the edits to T2 that clarify the language, and add new tutorials to demonstrate the ideas above before closing this issue. Later we can see if it makes sense to consolidate any if they flow well together.

0reactions
vshobhacommented, Dec 12, 2021

The goal of Tutorial 2 is to show the user how you can differentiate through the TheseusLayer abstraction. Since this example does not differentiate through the optimization itself, I’d suggest we just change the intro/title to simplify. As it is, it makes the point that we can create a TheseusLayer and differentiate through it. What actually gets ends up getting differentiated is under the hood from the user’s perspective – in this case, it turns out that differentiation through the optimization is not needed.

As for showcasing how to differentiate through the optimization, maybe we could do the following:

  • A new tutorial showing what @bamos and @luisenp have in mind (it is still difficult to understand the details of why Theseus is necessary for this example through the comments)
  • A separate new tutorial showing how a computation with multiple optimizations use the NLLS.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Theseus: A Library for Differentiable Nonlinear Optimization
We present Theseus, an efficient application-agnostic open source library for differ- entiable nonlinear least squares (DNLS) optimization built on PyTorch, ...
Read more >
Tutorial · NLPModels.jl - JuliaHub
The main interface for user defined problems is ADNLPModel, which defines a model easily, using automatic differentiation.
Read more >
Non-linear Least Squares - Ceres Solver
In this chapter we will learn how to solve (1) using Ceres Solver. ... able to evaluate the value and the derivatives of...
Read more >
Theseus Pharmaceuticals, Inc. Common Stock (THRX) Real ...
Theseus Pharmaceuticals, Inc. Common Stock (THRX) Real-time Stock Quotes - Nasdaq offers real-time quotes & market activity data for US and global markets....
Read more >
Time Domain Astronomy with the THESEUS Satellite
INAF, Astrophysics and Space Science Observatory, via P. ... in the following sec- tions we will use as a reference exposure times of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found