apex: clean apex-profile weighting (bench-validated, perf-optimized)#68
Open
jspaezp wants to merge 11 commits into
Open
apex: clean apex-profile weighting (bench-validated, perf-optimized)#68jspaezp wants to merge 11 commits into
jspaezp wants to merge 11 commits into
Conversation
…blur pass, joint-snap 1) Bench-validated: SUM 267.9 -> 326.2 (+58.3) on apex_sim canonical suite. Rounded exponents (0.5/0.75/1.75) match or beat the Optuna values.
Per-cycle expected-intensity-weighted mean pairwise correlation of center-normalized fragment XIC windows. Runtime cost (18->44 us/run) addressed in a later perf pass.
…, +63.6) Robust per-row matched-filter soft votes summed across fragments; saturating votes make a genuine multi-fragment apex win over tall single-row interferents. Runtime cost (44->91 us/run) addressed in perf pass.
MS1 precursor undetected, fragments intact. Guards against over-reliance on precursor signal in the apex profile.
Replaces 3 full sorts/row with partial selection. Result-identical (same order statistic); SUM 491.3 unchanged on canonical suite.
… 59->51 us/run)
Weighted mean pairwise correlation of unit window vectors has a closed
form (sum_{a<b} w_a w_b <u_a,u_b> = (||W||^2 - sum w_a^2)/2), collapsing
the per-cycle O(rows^2) inner loop to O(rows). Zero-profile cycles skip
the window work entirely. Result-identical: SUM 491.3 unchanged.
…date alloc) Moves cn/active/wacc and support/r/m/tmp into an ApexScratch owned by TraceScorer, cleared+resized per call. Matches the TraceScorerBuffers idiom; removes allocator churn across rayon workers at scale. Result-identical: SUM 491.3 unchanged.
Moves coelution + vote into scoring/apex/{coelution,vote}.rs as pure
kernels over (profile, rows, cfg, scratch), decoupled from the Extraction
data model. ApexConfig/ApexScratch live in apex/mod.rs; apex_finding calls
a single weight_profile orchestrator. Adds 4 unit tests (co-elution vs
scattered, concurrent votes vs tall interferent, disabled no-ops).
Bench parity: SUM 491.3, 51 us/run unchanged.
…, s 0.4) Rounded from raw Optuna values; SUM 491.3 -> 491.6, no regression.
Apex-finder bench
Sensitivity + timing across canonical scenarioscommit 3130a97 |
…_loop) Result-identical; SUM 491.6 unchanged.
This was referenced Jul 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clean re-implementation of the apex-profile weighting experiments from the
apex-autoresearch branch, rebuilt off main as maintainable, tested, and
runtime-optimized code. Every term was bench-validated on the apex_sim
canonical suite; only terms that clear the agreed keep-bar ship.
What changed
Base apex profile retuned and two per-cycle weighting passes added, applied to
apex_profile before peak-picking:
snap window 1 (was cos^3 * I, floor 0.5, no blur, snap 3).
correlation of center-normalized fragment XIC windows. Rewards genuine
co-elution, independent of absolute fragment ratios.
fragments; saturating votes let a real multi-fragment apex win over tall
single-row interferents.
All knobs live in one ApexConfig (bench-tuned Default, no env-var globals). The
passes are pure kernels in scoring/apex/{coelution,vote}.rs over
(profile, rows, cfg, scratch), decoupled from the extraction data model and
unit-tested.
Ablation (keep-bar: SUM gain > 2.0 on the 6-scenario suite; noise = 0)
term decision SUM
base retune KEEP 267.9 -> 326.2 (+58.3)
gaussblur (1 pass) KEEP included above
joint-snap 1 KEEP +1.5 (free: existing constant, no new code)
coelution weight KEEP 326.2 -> 341.5 (+15.3)
MS1 isotope-coherence DROP +1.3 (< 2.0; regressed mismatched, and
dropping it keeps the stack
precursor-independent)
vote weight KEEP 341.5 -> 405.1 (+63.6)
Rounded exponents/strengths (0.5 / 0.75 / 1.75; coel_k 1.0, vote_k 14, tau 1.3,
s 0.4) match or beat the raw Optuna values, so no over-precise magic constants
ship. Also added an absent_precursor bench scenario as a permanent guard
against over-reliance on precursor signal.
Runtime
The passes run per-candidate on rayon workers. Cost recovered from 91 to 51
us/run, result-identical (SUM unchanged at each step):
vs apex-autoresearch branch
branch (isotope on, unoptimized): SUM 494.7 @ 91.8 us/run
this PR (isotope dropped, opt): SUM 491.6 @ 51.2 us/run
-0.7% SUM for +44% throughput, a simpler precursor-independent stack, 3 fewer
knobs, and unit tests. The 3.4-point delta is entirely the dropped isotope term.
Validation