Skip to content

Sophiex/dev/monitor collapse#1814

Open
sophie-xhonneux wants to merge 10 commits intodevelopfrom
sophiex/dev/monitor-collapse
Open

Sophiex/dev/monitor collapse#1814
sophie-xhonneux wants to merge 10 commits intodevelopfrom
sophiex/dev/monitor-collapse

Conversation

@sophie-xhonneux
Copy link
Contributor

@sophie-xhonneux sophie-xhonneux commented Feb 5, 2026

Description

Introduce monitoring the ranks and singular values of the latents (most code written by Claude, please check carefully at review time)

Issue Number

Closes #1813

Is this PR a draft? Mark it as draft.

Checklist before asking for review

  • I have performed a self-review of my code
  • My changes comply with basic sanity checks:
    • I have fixed formatting issues with ./scripts/actions.sh lint
    • I have run unit tests with ./scripts/actions.sh unit-test
    • I have documented my code and I have updated the docstrings.
    • I have added unit tests, if relevant
  • I have tried my changes with data and code:
    • I have run the integration tests with ./scripts/actions.sh integration-test
    • (bigger changes) I have run a full training and I have written in the comment the run_id(s): launch-slurm.py --time 60
    • (bigger changes and experiments) I have shared a hegdedoc in the github issue with all the configurations and runs for this experiments
  • I have informed and aligned with people impacted by my change:
    • for config changes: the MatterMost channels and/or a design doc
    • for changes of dependencies: the MatterMost software development channel

Copy link
Collaborator

@clessig clessig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some high level comments for the moment, need to make another pass to look at details.

# training_mode: "masking", "student_teacher", "latent_loss"
training_mode: ["masking"]

# Collapse monitoring for detecting representation collapse
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default config is on forecasting so we shouldn't need this in there.

if self.rampup_ratio is not None:
halflife_steps = min(halflife_steps, cur_step / self.rampup_ratio)
beta = 0.5 ** (self.batch_size / max(halflife_steps, 1e-6))
return beta
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we continuously update beta and store it as a class member variable, and just return it in the function.


self.t_start = time.time()

def _compute_collapse_metrics(self, preds, targets_and_auxs) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be a separate class.


# Get EMA beta from target_and_aux_calculators
for _calc_name, calculator in self.target_and_aux_calculators.items():
if isinstance(calculator, EMATeacher):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be best if we could avoid isinstance()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Better monitoring

2 participants