Lightning-AI / Lightning-AI/lightning-thunder

"requires_grad" attribute on intermediate TensorProxies is unused and misleading

Open
#1,570 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

autograd developer efficiency
Dominant language
Python
Stars
1.5k
Forks
121
PR merge metrics
No merged PRs in 30d

Description

_Originally posted by @IvanYashchuk in https://github.com/Lightning-AI/lightning-thunder/pull/1563#discussion_r1890146557_

`requires_grad` of intermediate TensorProxies is ignored in our automatic differentiation code because we haven't done the work of properly threading this property through all computations.
We should remove the ability to query `.requires_grad` from intermediate TensorProxies completely to avoid similar bugs in the future. This can be achieved by introducing a separate "InputTensorProxy" which has this attribute and removing it from the regular TensorProxy.

cc @borda @mruberry @apaz-cli

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing TensorProxy usages through the automatic differentiation code and identify where intermediate proxies expose requires_grad. Review the proposed InputTensorProxy separation and its effects on existing proxy consumers; the work is done when only input proxies expose the attribute and intermediate proxies no longer do.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
compilers, machine-learning
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.