Skip to content

[Bug]: long_time_metrics reflect only last batch of data and not the average over all batches #78

Closed

Description

@AnnihilatorChess

The long_time_metrics saved to time_logs inside the Trainer.validation_loop method are overriden for every batch. This means that the metrics use only the last batch

A fix would be something like this:
# FIX: Accumulate time_logs averages instead of overwriting with |=

                    if k in long_time_metrics or "spectral_error" in k:
                        for key, val in new_time_logs.items():
                            if key in time_logs:
                                time_logs[key] += val / denom
                            else:
                                time_logs[key] = val / denom

Activity

  1. Adonyth commented on Jul 12, 2026

    @Adonyth
    Contributor

    We are running an independent quantified-impact study of this issue together with the related benchmark/metric issues (#49, #67, #74, #75, #85): how much do these documented defects move the published baseline numbers, and what general lessons follow for rollout-benchmark metric design. The full study design was frozen today (2026-07-12); tamper-evident commitment: sha256 87c9ea19a266dfe4168fc4e63bc904e124091a97a3f2d2f472848d2bf6434017 (manifest: https://gist.github.com/Adonyth/d11062585e03d37331801a41fe7138b7). We will share quantified results — and upstream PRs where fixes are straightforward — in these threads as they land.

  2. Adonyth commented on Jul 12, 2026

    @Adonyth
    Contributor

    Quantified confirmation + fix (as promised above): time_logs |= new_time_logs in Trainer.validation_loop overwrites long-time-metric keys each batch, so the logged curves reflect only the final batch — a two-batch counterexample with per-batch values 100.0 and 1.0 reports 1.0 instead of the correct 50.5. The loss_dict accumulation just below it already does this correctly; PR #93 mirrors that accumulation (same denom weighting) with a regression test that fails on current master and passes with the fix.

  3. added a commit that references this issue on Oct 12, 2026
    e76f135
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions