Skip to content

feat(adapters): accept probe slots in Granite Switch checkpoints - #1797

Merged
planetf1 merged 5 commits into
generative-computing:mainfrom
planetf1:dev/jonesn/switch-probes
Nov 16, 2026
Merged

planetf1 merged 5 commits into
generative-computing:mainfrom
planetf1:dev/jonesn/switch-probes

Conversation

@planetf1

@planetf1 planetf1 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Pull Request

Issue

Related to #1741

Description

Before: if a Granite Switch checkpoint contained a probe slot, Mellea failed to load any of its adapter functions.

After: probe slots load alongside the LoRA and aLoRA ones, and you can call them directly:

result = call_intrinsic("answerability_probe", context, backend)
# {"token": "yes", "label_logprobs": {"yes": -0.01, "no": -4.4}, "labels": ["no", "yes"], ...}

A probe is a classifier head that answers with a single label token. Existing checkpoints are unaffected.

Details

  • technology: probe in adapter_index.json is accepted and registered as LoRA. Its first_token io.yaml is read by the existing one-token readout.
  • Any other unrecognised technology is skipped with a warning, so the remaining adapters still load.
  • A probe slot must keep its own adapter function name (conventionally <name>_probe); reusing a generative capability's name would apply that capability's output schema to the one-token readout.
  • A Hub index that carries an unsupported slot without an io.yaml still loads; materialisation applies the same technology filter as local discovery.

Implementation

Built on the composed-adapter discovery from #1821 (shim removal):
_embedded_adapter_from_entry maps probe to LoRA, and both
_embedded_adapters_from_model_directory and _embedded_adapters_from_hub
skip an unsupported slot before resolving its io_config.

Not included in this PR

  • The existing helpers (rag.*, guardian.*) don't route to probes; using one still means invoking it by name (e.g. answerability_probe). Whether a helper should prefer a probe over its generative adapter is a follow-on discussion, so this PR leaves helper behaviour unchanged.
  • Probes are registered as LoRA: the composed adapter keeps only identity.adapter_type ("lora"), dropping technology. A follow-on that routes by adapter technology first needs a first-class representation (AdapterType.PROBE, or a retained technology field).
  • A skipped unsupported slot is reported only by the discovery warning: calling it later raises a bare "not found" KeyError, without the reason that _adapter_skip_reasons adds for an invalid decision config. Follow-up: feat(adapters): report unsupported-technology skips in the adapter not-found error #1837.
  • No public checkpoint ships probe slots yet (none of the three granite-switch-4.1-*-preview repos has one in adapter_index.json), so probe behaviour is not exercised end to end against a published model.

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code was added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

Unit tests cover a probe slot, a mixed lora/probe/unknown index, the Hub materialisation path with an unsupported slot that has no io.yaml, a call_intrinsic probe call on a canned response, and a label-order case (labels: ["yes", "no"]) pinning probe polarity to the checkpoint's io.yaml rather than to code. Backend and adapter-function unit suites pass (1542 passed, 47 skipped), and all five published granite-switch-4.1-* checkpoints still register every slot in their adapter_index.json.

Attribution

  • AI coding assistants used

Adding a new component, requirement, sampling strategy, or tool?

If your PR adds or modifies one of the types below, check the matching box. A checklist of type-specific review items will be posted as a comment.

  • Component
  • Requirement
  • Sampling Strategy
  • Tool

NOTE: Please ensure you have an issue that has been acknowledged by a core contributor and routed you to open a pull request against this repository. Otherwise, please open an issue before continuing with this pull request.

@planetf1 planetf1 added the do-not-merge/hold Block merging this PR label Nov 6, 2026
@github-actions github-actions Bot added the enhancement New feature or request label Nov 6, 2026
Discovery only accepted `technology` lora and alora, so one probe entry
in adapter_index.json made it raise and no adapter on the checkpoint
loaded.

Accept `probe` and register it as LoRA; its first_token io.yaml uses
the existing one-token readout. Skip other unknown technologies with a
warning so the remaining adapters still load.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <[email protected]>
@planetf1
planetf1 force-pushed the dev/jonesn/switch-probes branch from 2f78206 to c6735b3 Compare November 6, 2026 19:20
@planetf1 planetf1 removed the do-not-merge/hold Block merging this PR label Nov 6, 2026
@planetf1 planetf1 changed the title feat(adapters): accept probe slots in Granite Switch checkpoints [stacked on #1742] feat(adapters): accept probe slots in Granite Switch checkpoints Nov 6, 2026
A Granite Switch index can carry an unsupported slot (for example
technology "sr") that publishes no io.yaml. Local discovery skipped such
a slot before reading its config, but Hub materialisation resolved every
entry's io_config first, so from_hub failed with a misleading
"adapter_index.json was not found in the downloaded snapshot".

Share one technology filter across both paths, and make it reject a
non-string technology value instead of raising TypeError.

Also document that a probe slot must keep its own adapter function name,
since the output contract is keyed by name, and add a label-order test
pinning probe polarity to the checkpoint's io.yaml rather than to code.

Assisted-by: pi
Signed-off-by: Nigel Jones <[email protected]>
Signed-off-by: Nigel Jones <[email protected]>

# Conflicts:
#	docs/examples/granite-switch/README.md
@planetf1 planetf1 mentioned this pull request Nov 11, 2026
2 of 8 tasks
@planetf1
planetf1 marked this pull request as ready for review November 16, 2026 07:22
@planetf1
planetf1 requested a review from a team as a code owner November 16, 2026 07:22
Upstream removed the deprecated EmbeddedIntrinsicAdapter shim (generative-computing#1821).
Port the probe-slot support and unsupported-technology skipping to
_embedded_adapter_from_entry, _embedded_adapters_from_model_directory
and _embedded_adapters_from_hub, and update the tests to that API.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <[email protected]>
The earlier upstream merge dropped the Granite Switch README's probe
section when generative-computing#1765 restructured it, and the shim removal took
test_probe_technology_registers_as_lora with EmbeddedIntrinsicAdapter.
Restore both against _embedded_adapter_from_entry.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <[email protected]>

@spzala spzala left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@planetf1 nice, lgtm!! The only comment I have is that we should add some of the new term added here (e.g. probe) in the glossary similar to lora and alora. Since, it’s something that can be done separately, unless you want to cover it, I will open an issue and work on it if that sounds good? Thanks!

@planetf1
planetf1 added this pull request to the merge queue Nov 16, 2026
Merged via the queue into generative-computing:main with commit 3b32508 Nov 16, 2026
16 checks passed
@planetf1
planetf1 deleted the dev/jonesn/switch-probes branch November 16, 2026 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants