You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(lmdb): support mixed-size batches and lazy label availability (#5962)
## Summary
- support `mix:N` LMDB batches containing frames with different atom
counts, using padded rectangular batches for dense models and a flat
ragged node axis for eligible graph models
- compact phantom atoms before graph-model evaluation and make loss
reductions, validation weighting, and epoch sizing use real atom counts
- resolve label availability lazily after data requirements are
registered, so required, optional, defaulted, and partially available
fields are handled without an eager full-dataset scan
- keep non-mixing and native-spin models on their existing rectangular
public paths; the ragged regression coverage uses upstream DPA1 and
avoids model-specific dependencies
## Behavioral changes
- Masked per-atom loss terms now pool all included labels across the
batch instead of averaging per-frame means. This intentionally retires
the bit-identical reduction guarantee from #5738/#5783 for existing
`mixed_type` NPY datasets whose frames have different real atom counts:
those frames are weighted by their real label counts rather than
equally. Uniform-atom-count batches are unchanged. Hessian pair terms
remain normalized per frame so their quadratic component count does not
make large structures dominate a batch.
- Legacy LMDB files have no exact per-frame label-availability metadata.
To avoid an eager O(N) startup scan, the reader uses a bounded probe and
conservatively reduces per-frame `find_*` flags at collation. A missed
rare signature may discard valid supervision for the affected batch, but
default-filled values are never treated as real labels. Recording exact
availability metadata when generating LMDB datasets is tracked in #5954.
## Testing
- all pre-commit hooks passed for the changed files
- 375 passed, 2 skipped, 1 deselected, and 13 subtests passed in the
main targeted LMDB/PT/PT-expt/model suite
- 15 passed in the isolated loss-reduction and decoder-pool regression
suite
- review fixes: 100 passed, 2 skipped, and 2 subtests passed in the
common loss suite; 60 passed in the PT padding-loss suite; all 25 LMDB
training tests passed; padded/unpadded DPA2 graph and Hessian parity
tests passed
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Added LMDB batching for frames with different atom counts, including
mixed-size and ragged layouts.
- Added ragged-batch inference and training for supported energy and
spin models.
- Added configurable data-source policies for optional labels and
parameters.
- Added safer handling of padded atoms across neighbor graphs and model
outputs.
- **Bug Fixes**
- Improved per-atom loss normalization for uneven and padded batches.
- Prevented padded atoms from affecting neighbor searches, metrics, or
losses.
- Improved handling of missing labels and default-valued data.
- **Documentation**
- Documented mixed-size batching, ragged data, and per-atom
normalization.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Closes#5965
0 commit comments