Skip to content

fix(search): full-depth default layers and NaN-safe candidates#2

Open
smanaton wants to merge 3 commits into
Apothic-AI:masterfrom
smanaton:search-full-depth-defaults
Open

fix(search): full-depth default layers and NaN-safe candidates#2
smanaton wants to merge 3 commits into
Apothic-AI:masterfrom
smanaton:search-full-depth-defaults

Conversation

@smanaton

@smanaton smanaton commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Search defaults and robustness for multi-scale models (especially 64-layer 27B-class GGUFs).

Default layers

  • Replace the fixed 8B-era default --layers [1,2,3,4,34] with an even full-depth spread from layer_count (up to 12 points).
  • SearchConfig::default() leaves search_layers empty; run_search resolves them from the live backend so library callers are not stuck on a hardcoded 36-layer default.
  • CLI: omit --layers to use the computed default; help text updated.

NaN handling

  • measure_probes is strict (eval-safe baselines/reports).
  • Search candidates use measure_probes_allowing_non_finite so a non-finite gap rejects that flip and continues, instead of aborting the whole search or poisoning eval transitions.

Tests

  • Unit tests for default layer geometry and resolve_search_layers.
  • Integration tests: non-finite baseline aborts; non-finite candidate is rejected/reverted.

Motivation

On a 64-layer model the old absolute default never sampled past layer 34 (~8% of depth), which made search look effect-size limited when it was a coverage bug. With full-depth layers we fixed structured-output probes end-to-end (Bonsai 8B/27B lab runs).

Test plan

  • cargo test --lib search / cargo test --test search_engine (Windows, CUDA + mainline llama.cpp).
  • Live Bonsai-27B search without explicit --layers: checkpoint recorded full-depth layers (max 63).
  • Live 8B so_json_false_literal search + promote.

Notes

Fork staging: smanaton#2
Related: Windows builds typically need the wwama MSVC/CUDA PR.

…dates

Replace the fixed 8B-era default --layers [1,2,3,4,34] with an even spread
derived from architecture layer_count (up to 12 points). Without this, larger
models (e.g. 64-layer 27B) only search ~8% of depth and appear unpatchable.

Also: hard-fail non-finite baselines; treat non-finite candidate gaps as
rejected flips instead of aborting the whole search; measure_probes returns
NaN gaps as data for callers to handle.
Copilot AI review requested due to automatic review settings July 19, 2026 09:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The job was not started because the account is locked due to a billing issue.

smanaton added 2 commits July 19, 2026 10:59
Fake backends prove NaN baseline hard-fails before search iterates, while
NaN-after-flip candidates are rejected and reverted without aborting the run.
…ates

- SearchConfig default leaves search_layers empty; run_search fills them via
  default_search_layers(backend.layer_count()) so library users are not stuck
  on an 8B-sized (36-layer) default.
- measure_probes is strict again (eval-safe). Search candidates use
  measure_probes_allowing_non_finite so a NaN flip is rejected, not fatal.
- Doc comment documents small-model inclusion of layer 0; unit test for
  resolve_search_layers.
@smanaton smanaton changed the title fix(search): default layers span full model depth; tolerate NaN candi… fix(search): full-depth default layers and NaN-safe candidates Jul 19, 2026
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.

2 participants