Skip to content

Release 3.0.0 with corrected anchor-batched precision - #774

Merged
KevinMusgrave merged 5 commits into
masterfrom
fix/anchor-batching-original-dtype
Oct 31, 2026
Merged

KevinMusgrave merged 5 commits into
masterfrom
fix/anchor-batching-original-dtype

Conversation

@KevinMusgrave

Copy link
Copy Markdown
Owner

Release stable 3.0.0 with corrected anchor-batched precision semantics. The earlier chunk implementation could change low-precision normalization and Euclidean-distance kernel choices, mis-normalize mixed-dtype reference tensors, and overflow its running loss under autocast.

Each widened tensor now retains its own source-dtype behavior. Anchor batching disables autocast for its entire computation and backward, and restores plain tensors at its public return and gradient hooks. Tests cover nearby/tiny rows, mixed query/reference dtypes, swap triplets, learned parameters, and ambient float16/bfloat16 autocast. The public contract documents the resulting autocast dtype behavior and the measured runtime/memory costs.

The stable promotion also updates package/lock metadata, citation metadata, installation instructions, tagged documentation links, and consolidated release notes. Dependency versions are unchanged.

Validation:

  • Full CPU suite on 9793227: 1,229 tests passed, zero failures.
  • Four full CUDA runs on clean 9793227: 1,231 tests and 2,471 subtests per run; zero failures, errors, or skips, with four device-specific deselections.
  • Hardware: two NVIDIA A40 GPUs, driver 595.91.07, Python 3.12.13, PyTorch 2.14.0+cu130, NCCL 2.30.7. Three runs used NCCL_P2P_DISABLE=1; one used default NCCL transport. The GPUs share a NUMA node; this does not establish default-transport behavior on the earlier SYS-topology hosts.
  • af38dc9 adds only seven design-document lines after the tested source commit. Source, tests, dependencies, packaging and workflows are unchanged.
  • Retained packaging/isolated-wheel smoke, lint, formatting, type checks, strict docs and policy checks passed. Refreshed online dependency review and supply-chain checks passed on this candidate with the existing exact assessments.
  • Previous P1 findings are resolved, and the final release-readiness review has no major or severe findings. CI owns the final merge gate; publication requires successful push CI on the exact final master commit.

Low-precision anchor batching retains its documented tradeoff: at 2,048 rows and 128 dimensions, float16 triplet peak memory is about 55 MiB versus 2,118 MiB for full backward; float16 NT-Xent batching costs about one-third more time after preserving dtype behavior. The optimization remains optional.

Float32 working copies lost the original dtype, so low-precision rows
got the matrix-product cdist kernel and float32's normalization eps,
changing losses and gradients from the full loss. Chunks now stay in
float32 and tell those two sites the input dtype. Verified: reproduction
matches, four mutations caught, check and changed tests pass.
Set the version, citation, and lock metadata, add consolidated release
notes, and point installation commands and source links at 3.0.0.
Replace unmeasured memory claims with the GPU benchmark results.
A dtype context covered the whole chunk, so float32 references took a
float16 query's normalization eps, changing the loss and adding reference
gradients. Widened tensors now record their source dtype in a Tensor
subclass, which follows them through slicing, indexing, and normalization
and replaces the context. Verified: reproductions match, seven mutations
caught, CPU tests and checks pass. CUDA evidence is pending.
Under ambient autocast, float16 loss terms overflowed the running total
to inf, and backward formulas narrowed float32 gradients. Forward and
backward passes now run without autocast, so chunks stay in float32.
Verified: reproduction matches, ten mutations caught, CPU tests and
checks pass. CUDA evidence is pending.
@KevinMusgrave
KevinMusgrave merged commit e9a1fc0 into master Oct 31, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant