feat: Phase 45 β Test-Time Compute Scaling (v4.0.0-alpha.5) - #52
Merged
Conversation
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
Phase 45 adds a genuinely new inference-time capability, distinct from the
thinking engine (v1 Β§7): instead of controlling how many tokens a single
generation spends reasoning, this phase generates multiple candidate
completions and selects among them β the Best-of-N / self-consistency /
verifier-guided-selection pattern that sits alongside, not inside, the
existing thinking-mode budget system. The two compose freely: each of the N
candidates can itself use any thinking mode.
Bumps the workspace version to
4.0.0-alpha.5and tags the milestonegit tag v4.0.0-alpha.5after merge.What's new
aarambh-studio-inferenceβ 3 new modulesbest_of_n.rsSelectionStrategyenum (Verifier | SelfConsistency | Majority | ProcessReward),CompletionVerifiertrait (local, so the inference crate does not depend on the finetune crate),BestOfNConfig,BestOfNEngine,BestOfNOutput,SelectionRationaleself_consistency.rsextract_final_number(byte-identical re-declaration ofaarambh_studio_finetune::extract_final_number, attributed β no cross-crate dependency),extract_final_answer,majority_vote(first-occurrence tie-breaking),self_consistency_selectprocess_reward.rsProcessRewardScorertrait,HeuristicProcessRewardScorer(transparent structural scorer),ProcessRewardHead(placeholder returningAarambhError::Unsupported, nottodo!()),load_process_reward_headBestOfNEnginewraps anInferenceEngineand reuses the existingprepare_session+fork_with_config+decode_sessionspath so theprompt KV-cache is prefilled once and the N forks are decoded together
in one batched target forward pass. Candidate 0 inherits the input sampler's
seed unchanged (N=1 reproduces single-sample generation byte-for-byte β
the backward-compat floor); candidates 1..N are re-seeded
base_seed + i.The wrapper-struct approach (mirrors
MtpSpeculativeEngine) leavesGenerationConfigand theservecrate untouched β best-of-N is a CLI/evalsurface only, per the roadmap's explicit scope.
aarambh-studio-evalβ eval-harness integrationbest_of_n_generate/sample_generate/BestOfNOptions/BestOfNResult/VerifierFningeneration.rsEvalConfiggainsbest_of_n: Option<usize>,best_of_n_selection: SelectionStrategy,best_of_n_seed: u64gsm8k_subsetandhumaneval_litetasks compute both single-sample and best-of-N accuracy when configured, recordingsingle_sample_accuracy,best_of_n_accuracy, andbest_of_n_deltainTaskScore::detailsβ the scorecard is the source of truth for whether best-of-N actually helped, never asserted in prose.aarambh-studioCLI β new flagsinfer --best-of-n <N> --selection verifier|self-consistency|majority|process-reward [--ground-truth <answer>]eval --best-of-n <N> --best-of-n-selection <strategy> --best-of-n-seed <u64>Best-of-N is text-only in Phase 45: combining
--best-of-nwith--image/--video/--document/--audio/--toolsreturnsAarambhError::Unsupported(mirrorsfork_with_config's existing no-toolsconstraint).
Tests
The 4 roadmap-named acceptance tests + 9 supporting tests, all CPU, no cuda:
best_of_n_with_n_equal_one_matches_single_sample_generation_exactlyself_consistency_majority_vote_selects_the_most_common_final_answerprocess_reward_score_correlates_positively_with_verifier_score_on_labelled_holdoutbest_of_n_accuracy_on_gsm8k_subset_is_measured_not_assumed_to_improvebest_of_n_generates_n_distinct_candidates_with_stochastic_samplerbest_of_n_greedy_candidates_are_identicalverifier_selection_picks_first_fully_correct_candidateextract_final_number_matches_gsm8k_marker/extract_final_answer_prefers_number_then_last_linemajority_vote_breaks_ties_by_first_occurrenceheuristic_scorer_rewards_thinking_block_and_answer_markerselection_strategy_round_trips_through_display/selection_strategy_parses_kebab_and_snake_aliasesrejects_zero_candidates/rejects_verifier_strategy_without_verifierCI status (verified locally before push)
cargo fmt --all --checkcargo check --workspace --all-targets --lockedcargo clippyclean on the 4 modified crates (-D warnings -D clippy::undocumented_unsafe_blocks)RUSTDOCFLAGS="-D warnings -D missing_docs" cargo doc --workspace --no-deps --lockedscripts/phase28_release_audit.sh(exactly 20 packages, single shared version4.0.0-alpha.5, noTODO/FIXME/todo!()/unimplemented!()markers, no tracked*.safetensors/checkpoints/**)find scripts -type f -name '*.sh' | xargs -n1 bash -ncargo build --release -p aarambh-studio --lockedβtarget/release/aarambh-studio --version=aarambh-studio 4.0.0-alpha.5--helpsubcommands pass;infer --helpshows--best-of-n/--selection/--ground-truth;eval --helpshows--best-of-n/--best-of-n-selection/--best-of-n-seedscripts/phase45_smoke.shend-to-end (acceptance tests + tiny train +infer --best-of-n 2 --selection self-consistency+ CLI flag verification βartifacts/phase45_test_time_smoke.json)Files changed
17 modified:
Cargo.toml,Cargo.lock(version bump β4.0.0-alpha.5)ROADMAP_V4.md(Phase 45 tasks flipped[ ]β[x])ARCHITECTURE_V4.md(Β§59### Implementation (Phase 45, v4.0.0-alpha.5)subsection appended)SELF_LEARNING_V4.md(Β§45 status blockquote)CHANGELOG.md(new## [4.0.0-alpha.5] - 2026-08-16entry prepended)README.md(version bump in header prose + bibtex; doc-table row; Current Boundaries note)aarambh-studio/src/cmd/infer.rs(InferArgs+--best-of-n/--selection/--ground-truthflags +run_best_of_n_infer+MathVerifierAdapter)aarambh-studio/src/cmd/eval.rs(EvalArgs+--best-of-n/--best-of-n-selection/--best-of-n-seedflags)aarambh-studio/src/cmd/selflearn.rs,aarambh-studio/src/cmd/train.rs(construct the newEvalConfig/InferArgsfields)crates/aarambh-studio-inference/src/lib.rs(3 new module exports)crates/aarambh-studio-eval/src/lib.rs,generation.rs,harness.rs,tasks/gsm8k_subset.rs,tasks/humaneval_lite.rscrates/aarambh-studio-selflearn/src/forgetting_hook.rs(construct newEvalConfigfields)7 new:
crates/aarambh-studio-inference/src/best_of_n.rscrates/aarambh-studio-inference/src/self_consistency.rscrates/aarambh-studio-inference/src/process_reward.rsdocs/phase45_test_time.md(mirrorsdocs/phase44_multi_node.md's 12-section structure)configs/best_of_n_smoke.toml(CPU smoke training config)scripts/phase45_smoke.sh(smoke script)artifacts/phase45_test_time_smoke.json(committed scorecard)Honesty note on scope
EXPECTED_PACKAGES=20is unchanged; Phase 45 lives entirely insideaarambh-studio-inference+aarambh-studio-eval+ the CLI binary, per the roadmap.ProcessRewardHeadreturnsAarambhError::Unsupporteduntil a checkpoint exists (explicitly future work, not stubbed withtodo!()). The release audit forbids tracked model artifacts.servecrate is unchanged β the wrapper-struct approach keeps the server surface clean;GenerationConfigis not extended.