Skip to content

bug(adapters): published requirement-check aLoRA never activates, and scores worse than the LoRA #1679

Closed

Description

@planetf1

Raising here first so we can agree the diagnosis, then take it to the granitelib authors. Both findings
are in the published adapter artefacts rather than in Mellea.

What happens today

You write a requirement, run it against a Granite 4.1 model, and ask Mellea to check it. Two things are
wrong, and they are independent of each other.

The adapter never switches on. Mellea downloads the requirement-check aLoRA, loads it, and reports
it as active. Its declared activation point cannot appear in the prompt, so it contributes nothing.
Nothing in the output or the logs tells you.

Its verdicts are worse than the LoRA's. On ten requirements with obvious answers, the aLoRA got 8
right and the LoRA got all 10. Both aLoRA misses went the same way: it scored above 0.99 for
requirements the response plainly fails. In Mellea that means Requirement.validate() returns True,
so a sampling strategy keeps a candidate it should have rejected or repaired.

Fixing the first problem does not fix the second. I checked, and the numbers barely move.

Why that is a problem

Requirement checking is the most used adapter capability in Mellea. It sits behind
Requirement.validate(), which drives rejection sampling and repair loops. A checker that fails open
is the expensive kind of wrong: the caller sees a pass, the loop stops trying, and nothing downstream
records that the verdict came from a different mechanism than it used to.

Mellea currently selects the LoRA on the automatic path, so users are not exposed today. #1654 changes
resolution to prefer whichever rung is published, and aLoRA is published for Granite 4.1, so this
becomes live the moment the activation problem is fixed.

How it should behave

The aLoRA should activate, as its own configuration intends. Once it does, its verdicts on
straightforward requirements should be at least as good as the LoRA's, since we would rather prefer
aLoRA everywhere: it shares the base model's KV cache and swaps dynamically, which makes it
considerably cheaper to serve.

What we are asking for

  1. A decision on which side of the activation mismatch should change, and a fix in the published
    artefacts.
  2. Any evaluation numbers you already have for requirement-check aLoRA against LoRA. If parity was
    measured at training time, our ten probes turn into a narrow question about where our results differ
    from yours, which is much less work than building a new evaluation.
  3. If no such numbers exist, agreement on what readiness looks like. Our suggestion: a labelled
    requirement set spanning content, factual, length, format, style and language constraints, run on both
    rungs over identical items and every published model slot, reporting accuracy and false-pass rate
    separately, compared with a paired test over discordant pairs rather than two accuracy figures put
    side by side.

Environment for everything below: ibm-granite/granite-4.1-3b, granitelib-core-r1.0 at the revision
Mellea's catalogue pins, transformers 5.10.2, peft 0.19.1, temperature 0.0. Values reproduced
identically across separate processes.

Detail: problem 1, the activation sequence cannot occur in the prompt

adapter_config.json declares:

alora_invocation_tokens: [27, 71226, 29]      # decodes to: <requirements>

The same slot's io.yaml instruction starts <requirements>:. The Granite tokeniser merges > with the
following : into one token, so the declared sequence cannot appear:

'<requirements>: X'   -> [27, 71226, 27916, 1630]   ['<', 'requirements', '>:', ' X']   no match
'<requirements> X'    -> [27, 71226, 29, 1630]      ['<', 'requirements', '>', ' X']    matches

PEFT looks for the sequence in input_ids and, when it is absent, sets the activation offset to None
with no warning (peft/tuners/lora/variants.py, calculate_alora_offsets,
else: # Invocation sequence not found in input). The adapter stays listed as active.

Instrumenting the real call: the assembled prompt is 96 tokens, the declared sequence is absent, and
[27, 71226, 27916, 578] = '<requirements>: The' sits where it would have been. The loaded PEFT config
does carry alora_invocation_tokens, so the config is read correctly and the prompt simply cannot satisfy
it. Patching the instruction prefix to <requirements> makes the sequence appear at token 28, which
confirms the cause.

All three published slots declare the same sequence against the same instruction text, so all three are
affected: requirement-check/granite-4.1-3b/alora, .../granite-4.1-8b/alora,
.../granite-4.1-30b/alora.

Other aLoRA capabilities checked on granite-4.1-3b are fine. uncertainty declares <certainty>,
which its instruction contains. answerability, query_rewrite and query_clarification declare
<|start_of_role|>assistant<|end_of_role|>, which the chat template supplies.

Either side can move. The instruction prefix could become <requirements> , which tokenises to the
declared sequence. Or alora_invocation_tokens could be changed to what the current instruction
produces, including the merged >: token. Which one is right depends on what the adapter was trained
against, which is why this needs you rather than a patch on our side.

Detail: problem 2, the verdict comparison

A smoke test rather than an evaluation. Ten requirements with unambiguous answers against one fixed
response, threshold 0.5, one adapter loaded per process.

Context: user asks "Write one sentence about Cardiff."; assistant answers "Cardiff is the capital city
of Wales."

Requirement Truth aLoRA LoRA
The response mentions Wales. pass 1.0000 0.9241
The response is written in French. fail 0.9975 0.0293
The response contains at least 50 words. fail 0.0032 0.0097
The response is a single sentence. pass 1.0000 0.9047
The response names a city. pass 1.0000 0.9241
The response includes a numeric statistic. fail 0.0000 0.0059
The response mentions Scotland. fail 0.0000 0.0059
The response is fewer than 20 words. pass 1.0000 0.9325
The response uses bullet points. fail 0.9997 0.0052
The response identifies a capital city. pass 1.0000 0.9466

aLoRA 8/10, LoRA 10/10. The injected prompt was byte-identical in both arms, so the requirement text
reaches the adapter either way and the only difference is which weights load.

Ten probes and one context characterise neither adapter. What they do establish is that the two rungs are
not interchangeable, and that where they diverge the aLoRA fails open.

Detail: hypotheses already ruled out, and what is still open

Ruled out:

  • Missing activation. Patching the prefix so activation fires at token 28 left the French requirement
    at 0.9988, against 0.9975 before.
  • Wrong prompt shape from Mellea. The assembled prompt is the conversation, then a user turn carrying
    <requirements> <requirement> plus the verification instruction, then the assistant generation prompt.
    With activation working, the adapter applies to the last 68 of 96 tokens, from the marker onwards. The
    base model computes the conversation prefix and the adapter covers the instruction and the generation,
    which is the arrangement an aLoRA expects.
  • Requirement text not reaching the adapter. It is present and correctly interpolated in both arms.

Still open: two of the ten probes are requirements about the response itself ("written in French", "uses
bullet points") rather than about its content, so they may be outside the adapter's training
distribution. That does not make a fail-open verdict acceptable, and the LoRA handled both, but it does
shape what an evaluation should cover.

The harness behind the table is ten lines around Mellea's core.requirement_check with the rung forced.
Happy to share it, or to run an agreed probe set on our side.

Follow-through

Related

Found while reviewing #1654, which makes the aLoRA rung selectable on the local Hugging Face path for the
first time. Mellea-side detection, and the gate that keeps the LoRA selected until this is resolved, is
#1678.

Activity

  1. self-assigned this
    on Sep 25, 2026
  2. added
    bug
    area/alora
    area/adapter-functions
    on Sep 25, 2026
  3. planetf1 commented on Sep 25, 2026

    @planetf1
    ContributorAuthor

    currently investigating

  4. planetf1 commented on Sep 25, 2026

    @planetf1
    ContributorAuthor

    working on this

  5. planetf1 commented on Sep 25, 2026

    @planetf1
    ContributorAuthor

    Update: diagnostic evaluation in progress

    Running a larger paired probe set against requirement-check (granitelib-core-r1.0)
    across LoRA, aLoRA, and an activation-patched aLoRA, on all three published Granite
    4.1 sizes (3b/8b/30b), to move past the original 10-item smoke test.

    Early signal, not yet a conclusion — still verifying before writing this up properly:

    • The activation problem (problem 1) reproduces consistently.
    • Whether fixing it changes the verdicts looks like a separate question from
      whether the verdicts are accurate — those two things don't seem to move together
      so far.
    • The size and shape of the accuracy gap looks like it may vary across the three
      model sizes rather than being uniform.

    Will follow up with the full methodology, numbers, and confidence levels once
    verified. Flagging now so this doesn't look stalled.

  6. planetf1 commented on Sep 25, 2026

    @planetf1
    ContributorAuthor

    Update: there is a third root cause, and it is on Mellea's side. The "aLoRA is dead on these models" conclusion in the linked discussion does not hold.

    Running the diagnostic with instrumentation one level deeper than the analysis in this issue, plus a controlled re-eval, turned up two further findings:

    1. The aLoRA was never activated in Mellea, in any intrinsic (Mellea-side bug).
    Mellea loads intrinsic adapters via model.load_adapter() (transformers' PeftAdapterMixin), which injects LoRA layers into the bare model. PEFT computes and injects the aLoRA rank offsets only from inside its PeftModel wrapper's generate()/forward() overrides, so on the LocalHFBackend path the aLoRA variant layers never receive offsets and mask the adapter off for every token. Instrumented count of PEFT's aLoRA hook calls during a full requirement-check invocation: zero. The check_hook_fires.py probe in this issue's tree confirmed: 0 hook calls, score 0.9999 (base-model answer) with the aLoRA "active".

    This re-interprets two findings in the issue:

    • "Missing activation ruled out" was verified at the text level only (invocation sequence present in the prompt). It is not present at the mechanism level: without the wrapper, the sequence in the prompt is not enough.
    • "aLoRA scores worse than LoRA" (27 vs 30 on the 30b) was measured on the unactivated, i.e. base-model, path. With true activation on the 3b, both items the linked discussion listed as aLoRA failures under activation (French, bullets) flip to correct: control 0.9999 to activated 0.0474 on the bullets case, and the full 140-item eval moves from 110-112 (all control arms) to 121/140 (McNemar p approximately 0.027). At 8b/30b the activated arms are flat against base, which is consistent with the base model already saturating those items there, not with the adapter being harmful.

    2. The uncertainty aLoRA works as-published once #1 is fixed (no io.yaml mismatch in its file), measured on/off gap 0.67-0.87 at 3b. So the "aLoRA weights are untrained" hypothesis does not hold up either.

    The issue's two published-artefact findings remain valid and are independent blockers for requirement-check specifically: the io.yaml alora_invocation_tokens vs instruction text tokenization mismatch, and the README/adapter_config inconsistency. As the issue says, the direction of that fix (colon in the instruction vs tokens in the config) is for the granitelib team to decide based on what the weights were trained against. I will file it there.

    PR #1685 contains:

    • the activation fix in LocalHFBackend's generate path (the actual Mellea bug), with unit tests that fail on the pre-fix code and two e2e differential tests that prove activation through the real backend on both affected capabilities;
    • a verification-driven, self-terminating repair of the published requirement-check io.yaml mismatch, so the capability works end to end with just that PR. It is intentionally removable (the PR body lists exactly what to delete) if we prefer Mellea not to touch published prompt text and wait for the granitelib republish.

    Consequently the request-changes verdict on PR #1654, which rests on the "aLoRA is broken at the weights level" reading of this analysis, should be re-evaluated against the activated results.

    Diagnostic tree and full before/after numbers: scratchpad/alora-activation-1678/eval_1679/STATUS.md in the worktree for this issue.

  7. added
    p2
    on Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/adapter-functionsarea/alorabugp2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions