agentleFS
NVIDIAKnown publisherNVIDIA/physicsnemo/.cursor/rules/mod-008b-model-missing-non-regression-test-with-reference-data.mdc

physicsnemo / rules

Cursor rule3.3k starsChanged 12 months agoApache-2.0View on GitHub

Every model must have non-regression tests comparing outputs against reference data saved in .pth files, using realistic tensor shapes and pytest parameterization.

Trending

Quiet since September.about the whole repository

Dec 2025: 0 mentionsJan 2026: 3 mentionsFeb 2026: 1 mentionMar 2026: 1 mentionApr 2026: 0 mentionsMay 2026: 1 mentionJun 2026: 3 mentionsJul 2026: 3 mentionsAug 2026: 0 mentionsSep 2026: 2 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the NVIDIA/physicsnemo repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about NVIDIA/physicsnemo

The biggest 5 of 15 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 15

Talked about on GitHub (15 times).

On GitHub · 15

10 more on GitHub

The file

We split this mod-008b-model-missing-non-regression-test-with-reference-data.mdc into the rules it gives an agent

7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When creating tests for models, rule MOD-008b must be followed.

    line 6
  2. Distinctive:

    Every model must have non-regression tests that:

    line 12
  3. Distinctive:

    Run forward pass with test data

    line 14
  4. Very specific:

    Use pytest parameterization to test multiple configurations

    line 18
  5. Distinctive:

    Test tensors must have realistic shapes (no singleton dimensions except batch)

    line 19
  6. Distinctive:

    Test data should be meaningful and representative of actual use cases

    line 20
  7. Distinctive:

    All public methods (not just forward) need similar non-regression tests

    line 22

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
mod-008b-model-missing-non-regression-test-with-reference-data.mdc
---
description: Every model must have non-regression tests comparing outputs against reference data saved in .pth files, using realistic tensor shapes and pytest parameterization.
alwaysApply: false
---

When creating tests for models, rule MOD-008b must be followed. Explicitly reference "Following rule MOD-008b, which requires non-regression tests with reference data..." when implementing test cases.

## MOD-008b: Model missing non-regression test with reference data

**Description:**

Every model must have non-regression tests that:
1. Instantiate the model with reproducible random parameters
2. Run forward pass with test data
3. Compare outputs against reference data saved in a `.pth` file

Requirements:
- Use `pytest` parameterization to test multiple configurations
- Test tensors must have realistic shapes (no singleton dimensions except batch)
- Test data should be meaningful and representative of actual use cases
- Compare actual tensor values, not just shapes
- All public methods (not just forward) need similar non-regression tests

**Critical:** Per MOD-002a, models cannot move out of experimental without these
tests.

**Rationale:**

Non-regression tests with reference data catch subtle numerical changes that
could break reproducibility. Simply checking output shapes is insufficient to
detect algorithmic changes or numerical instabilities. Comparing against
saved reference values ensures the model produces consistent results across code
changes.

**Example:**

```python
@pytest.mark.parametrize("device", ["cuda:0", "cpu"])
@pytest.mark.parametrize("config", ["default", "custom"])
def test_my_model_non_regression(device, config):
    """Test model forward pass against reference output."""
    if config == "default":
        model = _instantiate_model(MyModel, input_dim=64, output_dim=32)
    else:
        model = _instantiate_model(
            MyModel,
            input_dim=64,
            output_dim=32,
            hidden_dim=256
        )

    model = model.to(device)

    # Load reference data (meaningful shapes, no singletons)
    data = torch.load(f"test/models/data/my_model_{config}_v1.0.pth")
    x = data["x"].to(device)  # Shape: (4, 64), not (1, 64)
    out_ref = data["out"].to(device)

    # Run forward and compare values
    out = model(x)
    assert torch.allclose(out, out_ref, atol=1e-5, rtol=1e-5)
```

**Anti-pattern:**

```python
# WRONG: Only testing output shapes
def test_my_model_bad(device):
    model = MyModel(input_dim=64, output_dim=32).to(device)
    x = torch.randn(4, 64).to(device)
    out = model(x)
    assert out.shape == (4, 32)  # NOT SUFFICIENT!

# WRONG: Using singleton dimensions
def test_my_model_bad(device):
    x = torch.randn(1, 1, 64)  # WRONG: Trivial shapes

# WRONG: No parameterization
def test_my_model_bad():
    model = MyModel(input_dim=64, output_dim=32)  # Only tests defaults
```

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.