bytedance / bytedance/LPCD

LISA and Fishr training paths never backpropagate

Open Beginner friendly
#4 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1
Forks
1
PR merge metrics
No merged PRs in 30d

Description

## Summary

Selecting either `--loss lisa` or `--loss fishr` computes a loss but never calls `backward()`. `optimizer.step()` therefore runs with no gradients and model parameters do not update.

This is still present on `main` at `a0b47382f08b108a17a39b343c4e58dbf2852db3`.

## Code path

In `trial_training/train_plugins_v2.py`:

- the LISA branch at lines 75–79 computes `loss` and then only performs a no-grad metrics forward;
- the Fishr branch at lines 90–95 does the same;
- `loss.backward()` exists only in the Mixup and regular-method paths (lines 86–88 and 118–121);
- the shared path subsequently clips gradients and calls `optimizer.step()` (lines 129–132).

## Minimal reproduction

I invoked `train_one_epoch` with a one-parameter dummy classifier, one two-sample CPU batch containing two environments, and SGD with a nonzero learning rate. Metric/printing helpers were stubbed so the test exercises the repository training loop itself. Pair selection was fixed so the LISA penalty was nonzero.

Observed output:

```text
lisa changed= False grad= None
fishr changed= False grad= None
```

Both reported nonzero BCE and penalty values, but the classifier weight remained byte-for-byte unchanged.

## Expected behavior

For both loss choices, the combined loss should be backpropagated exactly once before clipping and `optimizer.step()`, just as it is for the other non-ASGDRO methods.

## Impact

The LISA and Fishr experiments listed in `trial_training/run.sh` can complete while silently performing no training updates. Their checkpoints and reported results therefore do not represent the selected algorithms.

## Suggested fix

Zero gradients and backpropagate the combined loss in the LISA and Fishr branches, with a regression test that asserts a model parameter changes for each option.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in trial_training/train_plugins_v2.py at the LISA and Fishr branches around lines 75–95, then compare them with the Mixup and regular-method paths where backpropagation occurs. Reproduce the issue with the one-parameter dummy classifier described in the report. Done means both loss choices produce gradients and change a model parameter, with regression coverage for each option.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
86/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.