Skip to content

[Bug]: Zero turnover limit liquidates, CAE reports convergence without training, SAE BatchNorm crash on one-row batch, attention NaN/wrap edge cases #55

Closed

Description

@quantum-like

Affected library

models

Affected package version

0.1.4 (main at 786ca1b6)

Environment

Linux, source checkout of main at 786ca1b6 with the repo's dev environment (uv sync); offline test suite.

Observed behavior

  1. turnover_limit=0 liquidates the previous book.
  2. CAE with hidden units returns converged=True when every minibatch has one row and no step runs.
  3. SAE crashes in BatchNorm when the last minibatch has one row.
  4. Graph attention returns NaN outputs/gradients for a node with no neighbors.
  5. Cross-sectional attention wraps the slice when lag > window.

Expected behavior

  1. Zero holds the previous weights; negative/non-finite limits raise. 2. The fit raises. 3. Training completes. 4. Outputs stay finite. 5. Keys are all-pad.

Minimal reproduction

Each case has a focused unit test on quantum-like/models branch review/fixes (one commit per fix, on top of 786ca1b6). Every test fails on main and passes with its fix:

  • tests/test_financial_correctness.py::test_zero_turnover_limit_holds_the_previous_book, ::test_negative_turnover_limit_is_rejected
  • tests/test_cae.py::test_cae_rejects_fits_that_never_update_parameters
  • tests/test_sae.py::test_sae_trains_when_the_last_minibatch_would_be_a_single_row, ::test_sae_rejects_a_single_training_row
  • tests/test_financial_correctness.py::test_graph_attention_stays_finite_when_a_node_has_no_neighbors, ::test_graph_attention_ignores_a_masked_only_neighbor
  • tests/test_financial_correctness.py::test_cross_attention_lag_longer_than_the_window_does_not_wrap

Compatibility impact

Public behavior or results

Acceptance criteria

Each case has a unit test that fails on main and passes with the fix.

I have a PR ready with these fixes and will link it here.

Amir

Activity

  1. added
    type: bugConfirmed or reported incorrect behavior
    compatibility: affectedHas Python, platform, dependency, or cross-library compatibility impact
    on Oct 7, 2026
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

    compatibility: affectedHas Python, platform, dependency, or cross-library compatibility impactpriority: normalNormal planned workstatus: needs-triageAwaiting maintainer classificationtype: bugConfirmed or reported incorrect behavior

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions