Skip to content

census: review Granite-Switch, the class engine#619 still alerted on (#619) - #634

Merged
bong-water-water-bong merged 1 commit into
mainfrom
prs/20261029-census
Oct 29, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
prs/20261029-census

Conversation

@bong-water-water-bong

@bong-water-water-bong bong-water-water-bong commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

The 2026-10-27 census run (issue #619) filed four UNCOVERED classes. Three were dispositioned on
main by e9c6868 (#626). The fourth, GraniteSwitchForCausalLM, was only recorded as "gated and
unverifiable"
in docs/arch-gaps.md, so the daily watcher kept printing

  !! UNCOVERED GraniteSwitchForCausalLM (new class): 1 model(s), e.g. cestaristudio/granite-switch-4.1-3b-preview
     -> map it in registry/architectures.json (a pinned backend's code must accept the architecture)

and kept exiting 1. That disposition was wrong on the facts, which is what this PR fixes: the gated
repo the run happened to sample is cestaristudio's mirror of a class IBM publishes openly
(ibm-granite/granite-switch-4.1-{3b,8b,30b}, plus an official GGUF), and registry/census.json
counts 17 models of the class. The class was reviewable; nobody had read it.

What changed

A review record - not a mapping, and nothing here claims a model was run. No class in that
batch can be mapped today: git grep over the pin main carries (40c4ccb7) finds no
GraniteSwitchForCausalLM/granite_switch (and none of the other three), conversion/granite.py
has no such registration, src/llama-arch.cpp has granite/granitemoe/granitehybrid but no
graniteswitch, and registry/architectures.json is generated from that tree anyway. The
checked numbers in the registry are untouched.

  • registry/significant.json: GraniteSwitchForCausalLM / granite_switch, "reviewed not an
    alias", "watch": "report" - the same shape glm5_next uses, with the same instruction
    attached: remove the field and record mapped_ok when the pin gains graniteswitch.
  • docs/arch-gaps.md: the granite_switch review under the engine#619 batch - shape, the
    per-token LoRA adapter stack / zero slot / weightless switch layers / router gain it adds over
    granitemoe/granitehybrid/granite (why an alias would silently drop adapters), the pin
    evidence above, and the fact that upstream ggml-org/llama.cpp 157b81fe (#25107, 2026-08-10)
    does implement it, so a fork sync is what brings it. The Unverifiable: gated configs note is
    corrected: the cestaristudio mirror stays unverifiable, the class no longer is. The batch's
    REMOTE-CODE families are recorded under If a family is a variant instead of being silent
    gaps: LNewqForConditionalGeneration / Newq1ForConditionalGeneration /
    NewqForConditionalGeneration are one rename each of the Qwen3.5-VL wrapper the pin already
    converts under the name Qwen3_5ForConditionalGeneration (conversion/qwen3vl.py:16 ->
    qwen35), and KeuralMoECausalLM is custom auto_map code with its own KeuralConfig. Both
    stay out of significant.json, so a native (no auto_map) upload still alerts.
  • tests/census_watch_test.py: new section 24 drives all eight classes from the committed
    registry and significant list - the four reviewed ones classify as reviewed_report and exit 0,
    the four variants are reported as remote_code and still exit 1 when uploaded without
    auto_map, and the counts quoted in the docs are read back from registry/census.json.

Before / after, offline against the committed registry

Replaying the issue's lines through census_watch.classify() + report() with the real
registry/architectures.json + registry/significant.json (tools/census_watch.py, no network):

before (5c2aee2): exit 1

  !! UNCOVERED GraniteSwitchForCausalLM (new class): 1 model(s), e.g. ibm-granite/granite-switch-4.1-8b

after (this branch): exit 0

  . REVIEWED GraniteSwitchForCausalLM: 1 model(s), e.g. ibm-granite/granite-switch-4.1-8b
     -> reviewed, not an alias, report only (registry/significant.json, docs/arch-gaps.md)

Test command and output

$ python3 tests/census_watch_test.py        # ctest census_watch; plain script, no pytest needed
ok   LiveMemForCausalLM is reviewed report-only and documented
ok   LiveMemForCausalLM report-only -> exit 0, no alert
ok   CDMMoELMPoincare is reviewed report-only and documented
ok   CDMMoELMPoincare report-only -> exit 0, no alert
ok   Senryu2ForCausalLM is reviewed report-only and documented
ok   Senryu2ForCausalLM report-only -> exit 0, no alert
ok   GraniteSwitchForCausalLM is reviewed report-only and documented
ok   GraniteSwitchForCausalLM report-only -> exit 0, no alert
ok   granite switch is printed as REVIEWED, not UNCOVERED
ok   LNewqForConditionalGeneration is documented and not silenced in significant.json
ok   LNewqForConditionalGeneration custom-code upload -> reported, exit 0
ok   LNewqForConditionalGeneration without auto_map still alerts
ok   Newq1ForConditionalGeneration is documented and not silenced in significant.json
ok   Newq1ForConditionalGeneration custom-code upload -> reported, exit 0
ok   Newq1ForConditionalGeneration without auto_map still alerts
ok   NewqForConditionalGeneration is documented and not silenced in significant.json
ok   NewqForConditionalGeneration custom-code upload -> reported, exit 0
ok   NewqForConditionalGeneration without auto_map still alerts
ok   KeuralMoECausalLM is documented and not silenced in significant.json
ok   KeuralMoECausalLM custom-code upload -> reported, exit 0
ok   KeuralMoECausalLM without auto_map still alerts
ok   census.json records every engine#619 class
ok   census.json shows granite switch is not a one-off

all checks passed
$ python3 tools/registry_build.py --check-gaps
none of the 28 reviewed significant classes is mapped without a reason

$ python3 tools/registry_build.py --check-pins
/home/bcloud/wt/prs-w-census/registry/architectures.json records the committed pins

$ python3 tests/registry_gaps_test.py
PASS

$ python3 tests/check_pins_test.py
Ran 3 tests in 0.000s
OK

$ python3 tools/copyright.py --check
(no output, rc 0)

What remains unverified

  • Nothing was run. No graniteswitch model was loaded, converted or benchmarked, and no
    checked count moved: the review says the pin's code does not accept the architecture, which is
    why it is not mapped (CONTRIBUTING rule 3).
  • graniteswitch support is upstream, not here. 157b81fe is in ggml-org/llama.cpp; the pin
    resolves it only at the next fork sync. When that lands, --check-gaps fails until someone
    confirms the adapters really switch and records mapped_ok.
  • NewqForConditionalGeneration (crussella0129/Newq, 1 model in the census) is now gated, so
    its config could not be read on 2026-10-29; it is recorded as the same name pattern as its two
    public siblings, unverified.
  • The FastFlowLM half of the alert (FastFlowLM/MiniCPM-V-4.7-1B-NPU2, smolvla, Whisper-V3)
    is untouched by this PR: report_flm()'s unmapped list is not suppressible by
    registry/significant.json, and tests/census_watch_test.py explicitly pins that an unmapped FLM
    architecture is "unmapped, not a guess". That part of census: new HF model class uncovered by the registry #619 still needs an owner decision.
  • Refs census: new HF model class uncovered by the registry #619, which stays open. The gated cestaristudio mirror still needs an HF token in the
    watcher (the separate half in progress elsewhere), and the FLM org walk above still alerts.

No engine behaviour changes, so no RFC; no kernel or systemd files touched.

… on (#619)

The 2026-10-27 census run filed four UNCOVERED classes. Three were dispositioned
in e9c6868 (#626); the fourth, GraniteSwitchForCausalLM, was recorded only as
"gated and unverifiable" and kept the daily watcher exiting 1. That was wrong on
the facts: the gated repo the run sampled (cestaristudio's mirror) is one of
twenty, and IBM publishes granite-switch-4.1-{3b,8b,30b} openly - 17 models of
the class in registry/census.json - so the class was reviewable all along.

This is a review record, not a mapping. None of the classes in the batch can be
mapped: git grep over the pin main carries (40c4ccb7) finds no
GraniteSwitchForCausalLM/granite_switch (nor LiveMem, CDM-Poincare, Senryu2),
conversion/granite.py has no such registration and src/llama-arch.cpp has no
graniteswitch, so registry/architectures.json has nothing to map and nothing
here claims a model was run or checked. Upstream ggml-org/llama.cpp 157b81fe
(#25107, 2026-08-10) does implement it, which is a fork sync away.

- registry/significant.json: GraniteSwitchForCausalLM, reviewed not-an-alias,
  "watch": "report" (remove it and record mapped_ok when the pin gains it).
- docs/arch-gaps.md: the granite_switch review (shape, the per-token LoRA
  adapter stack it adds, why granitehybrid/granitemoe/granite are not aliases,
  pin evidence, where upstream implements it); the "Unverifiable: gated configs"
  note corrected to say the mirror stays unverifiable but the class does not;
  and the batch's REMOTE-CODE families (LNewq/Newq1/Newq renames of the
  Qwen3.5-VL wrapper, KeuralMoECausalLM custom code) recorded as variants -
  documented, deliberately absent from significant.json, so a native upload of
  one still alerts.
- tests/census_watch_test.py: section 24 exercises all eight classes against the
  committed registry, including that the four reviewed ones report without
  alerting and the four variants alert when uploaded without auto_map, and that
  the counts quoted come from the committed census.
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

619 - Partially compliant

Compliant requirements:

  • The GraniteSwitchForCausalLM class is now recorded as reviewed and documented in docs/arch-gaps.md
  • The class is added to registry/significant.json with "watch": "report" to prevent alerts
  • The census watcher no longer exits with non-zero status for this class

Non-compliant requirements:

  • The class is not yet mapped in registry/architectures.json as the pinned backend does not accept the architecture

Requires further human verification:

  • Confirmation that the pinned backend will support the GraniteSwitchForCausalLM architecture in the future

626 - Partially compliant

Compliant requirements:

  • All three non-gated classes (LiveMemForCausalLM, CDMMoELMPoincare, Senryu2ForCausalLM) are now recorded as reviewed and documented in docs/arch-gaps.md
  • These classes are added to registry/significant.json with "watch": "report"
  • The census watcher no longer alerts on these classes

Non-compliant requirements:

  • None

Requires further human verification:

  • None
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Missing Documentation for GraniteSwitchForCausalLM

The entry for GraniteSwitchForCausalLM in registry/significant.json lacks a detailed explanation of why it is not an alias, which is required for consistency with other entries in the same file. This information should be included to maintain clarity and completeness.

"GraniteSwitchForCausalLM": {
 "model_type": "granite_switch",
 "family": "Granite Switch 4.1 (dense all-attention Granite with N embedded per-token LoRA adapters, a zero adapter slot and weightless switch layers; upstream llama.cpp 157b81fe, not in the pin)",
 "watch": "report"
}
Incomplete Documentation for GraniteSwitchForCausalLM

The documentation for GraniteSwitchForCausalLM in docs/arch-gaps.md is missing a clear statement of why the class is not an alias, which is required for consistency with other entries in the same document. This information should be included to maintain clarity and completeness.

### `granite_switch` - `ibm-granite/granite-switch-4.1-3b-preview` (also -8b, -30b)

Architecture class `GraniteSwitchForCausalLM`, `model_type: granite_switch`, no `auto_map`,
`library_name: transformers`. `registry/census.json` (2026-10-29) counts **17** models of this
class, so it is not a one-off: `ibm-granite/granite-switch-4.1-{3b,8b,30b}` are public and the
family already ships GGUFs (`ibm-granite/granite-switch-4.1-8b-GGUF`, whose
`general.architecture` is `graniteswitch`).

* **Shape**: 42 layers (30b: 66), hidden 2560 (8b/30b: 4096), 40 heads / 8 kv (8b/30b: 32/8),
  vocab 100365 (8b/30b: 100355), every entry of `layer_types` `full_attention`,
  `num_local_experts: 0` with a leftover `num_experts_per_tok: 2` - i.e. dense, all-attention
  Granite.
* **What it adds**: the model is a *stack of LoRA adapters switched per token*, not one set of
  weights. The config carries `num_adapters`, `adapter_names`, `adapter_ranks`,
  `max_lora_rank`, `lora_target_modules`, `switch_head_dim`, `control_token_gain`,
  `dual_stream`, `cross_stream_rank`, `ms_code_*`/`ms_memory_gain`, `asr_*` and
  `adapter_token_ids`/`adapter_substitute_token_ids`. Upstream's converter puts that in one
  sentence (`conversion/granite.py`: "Dense, all-attention Granite with N per-token embedded
  LoRA adapters, stacked over the adapter dim with a zero adapter at slot 0 (N = num_adapters +
  1)") and additionally writes `adapter_count`, `adapter_lora_rank`, `adapter_token_ids_*`,
  `adapter_router_gain` and, for `ibm-granite`'s `decision` adapter, a `granite_switch` decision
  type; `num_hidden_layers` also counts *weightless switch layers* that carry no tensors, and
  the converter has to derive the real block count from the tensor names.
* **Why an alias is wrong**: the nearest supported families are `granitehybrid`
  (`GraniteMoeHybridForCausalLM`), `granitemoe` and `granite`, and none of their loaders has an
  adapter stack, a router gain or a switch layer: loading a checkpoint through them would keep
  one adapter's weights and silently drop the rest, which is the silent-substitution failure
  this page exists to prevent. Renaming it to `granitehybrid` would also lose the ASR path.
* **Why it is not mapped**: the pinned backend has nothing to map to. At `40c4ccb7`
  `conversion/granite.py:17-379` makes six `@ModelBase.register` calls covering eight class
  names (`GraniteForCausalLM`, `GraniteMoeForCausalLM`, `GraniteMoeSharedForCausalLM`,
  `GraniteMoeHybridForCausalLM`/`BambaForCausalLM`,
  `GraniteSpeechForConditionalGeneration`, `GraniteSpeechPlusForConditionalGeneration`,
  `Granite4VisionForConditionalGeneration`), `src/llama-arch.cpp` has `granite`, `granitemoe`
  and `granitehybrid` but no `graniteswitch` (nor `granite_swa`), `src/models/` has
  `granite.cpp`, `granite-moe.cpp` and `granite-hybrid.cpp` and no `granite-switch.cpp`, and
  `gguf-py` has no `GRANITE_SWITCH` at all - as expected, since `registry/architectures.json`
  is generated from that tree.
* **Where the support is**: upstream `ggml-org/llama.cpp` `157b81fe` ("model : Granite-Switch
  Architecture", #25107, 2026-08-10) registers the class, adds `LLM_ARCH_GRANITE_SWITCH` /
  `"graniteswitch"` and the mapping case. That is *older* than the pin's tip (2026-10-25), so a
  fork sync is what brings it, and `tools/registry_build.py --check-gaps` then fails until this
  entry records why (`mapped_ok`) and someone confirms the loaded adapters really switch before
  the class counts as supported. Reviewed 2026-10-29: **not an alias**. Its
  `registry/significant.json` entry carries `"watch": "report"`, so the census watcher lists new
  uploads as `. REVIEWED` instead of filing an issue; remove that field (and record `mapped_ok`)
  when the pin gains `graniteswitch`.

@bong-water-water-bong
bong-water-water-bong merged commit 95201da into main Oct 29, 2026
8 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the prs/20261029-census branch October 29, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant