Skip to content

Commit 1fe6f85

Browse files
trishortsclaude
andcommitted
test(rtpred): tolerate float32 batch-vs-single drift in Chronologer
The batched PredictRetentionTimeEquivalents override runs the model at batch size m, while PredictRetentionTimeEquivalent runs it at batch size 1. libtorch selects different conv/matmul kernels for the two paths, so predictions agree only to float32 precision (~1e-7 relative), not bit-exactly. Two assertions used Is.EqualTo with no tolerance and failed on that drift. Add .Within(1e-4) - orders of magnitude above the noise floor yet tight enough to still catch a genuine batch/single mismatch. Also soften the override docstring, which claimed the two paths give identical results. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2 parents 2dcf742 + bdbc247 commit 1fe6f85

41 files changed

Lines changed: 1273 additions & 1475 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

mzLib/Chromatography/RetentionTimePrediction/Chronologer/ChronologerRetentionTimePredictor.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ protected override bool ValidateBasicConstraints(IRetentionPredictable peptide,
8686
/// Batched override: formats/encodes the peptides in parallel (CPU) and runs the Chronologer model in
8787
/// large batched forward passes instead of one locked batch-1 call per peptide. The model is in eval
8888
/// mode (BatchNorm uses running statistics), so each peptide's prediction is independent of the batch —
89-
/// results are identical to <see cref="PredictCore"/>, just far faster for many peptides.
89+
/// results match <see cref="PredictCore"/> to float32 precision (libtorch selects different conv/matmul
90+
/// kernels at batch size m vs 1, so the two paths are not bit-identical), just far faster for many peptides.
9091
/// </summary>
9192
public override IReadOnlyList<(double? PredictedValue, IRetentionPredictable Peptide, RetentionTimeFailureReason? FailureReason)>
9293
PredictRetentionTimeEquivalents(IEnumerable<IRetentionPredictable> peptides, int maxThreads = 1)

mzLib/Development/BenchmarkDotNet.Artifacts/results/Development.MSL.MslBenchmarks-report-github.md

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)