aa: add runtime min_len knob to gate when AA starts extrapolating#45
Merged
aa: add runtime min_len knob to gate when AA starts extrapolating#45
Conversation
Replace the compile-time FILL_MEMORY_BEFORE_SOLVE switch with a runtime min_len parameter on aa_init. min_len=mem preserves the historical "wait for the memory to fill" behavior (now the default in both the C and Python APIs); min_len=1 lets callers extrapolate from the very first residual pair when mem is large but early acceleration matters. Breaking change: aa_init grows a min_len argument between mem and type1. The Python binding adds min_len as a keyword-only argument defaulting to min(mem, dim), so existing Python callers are unaffected. Validation mirrors mem: min_len < 1 with mem > 0 is rejected; min_len above min(mem, dim) is clamped silently, matching how mem itself is clamped to dim for rank stability. Mem=0 keeps AA disabled and ignores min_len entirely. Coverage: - 7 new C unit tests in tests/c/run_tests.c exercising early extrapolation, safeguard-reject churn under min_len=1 at kappa=1e10, and both validation paths (reject min_len=0, clamp min_len>mem). - 5 new Python tests in tests/python/test_aa.py covering the default, min_len=1 early-apply behavior, validation, and clamping. - Bench iteration counts / final errors match master byte-for-byte on the default min_len path (14 configs spot-checked). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
bodono
added a commit
that referenced
this pull request
Apr 22, 2026
Since 0.0.2: - Pivoted-QR solver hygiene: warn on mem>dim, slim aa_reset (#44) - Runtime min_len knob to gate when AA starts extrapolating (#45) - Dim-independent rank tolerance (len·ε·|R₁₁|) (#46) - Lifetime diagnostics API: aa_get_stats + AaStats struct with split rejection-cause counters (#47) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
FILL_MEMORY_BEFORE_SOLVEswitch with a runtimemin_lenparameter onaa_init.min_len=mempreserves the historical "wait for memory to fill" behavior (the default);min_len=1lets callers extrapolate from the very first residual pair whenmemis large but early acceleration matters.aa_initgrows amin_lenargument betweenmemandtype1. The Python binding addsmin_lenas a keyword-only argument defaulting tomin(mem, dim), so existing Python callers are unaffected.mem:min_len < 1withmem > 0is rejected;min_len > min(mem, dim)is clamped silently, matching howmemis clamped todimfor rank stability.mem=0keeps AA disabled and ignoresmin_len.Test plan
tests/c/run_tests.c(early extrapolation, safeguard-reject churn at κ=1e10 withmin_len=1, validation: rejectmin_len=0, clampmin_len>mem,mem=0ignore path)tests/python/test_aa.py(default,min_len=1early-apply, validation, clamping,mem=0ignore)make LDLIBS="-framework Accelerate" test— all tests pass)min_lenpath (14 configs spot-checked)🤖 Generated with Claude Code