Skip to content

apr finetune merge: a PEFT adapter, a partial match or a missing lora_alpha gives a wrong merge with exit 0 #4674

Closed as not planned

Description

@noahgift

apr finetune merge can write a wrong merged model and still exit 0. verify_merged_runnable (line 454) checks only that the output is valid APR v2, has sound metadata and runs, so it passes each of these cases. The 0.72 look-ahead desk found this by reading the code; it has not been run yet (C277: no runs before 0.70.1 is live).

The code is the same at main 316dee2 and at the 0.70.1 release commit 04332f8 (crates/apr-cli/src/commands/finetune_display_next_validate.rs, line numbers at 04332f8):

  1. A PEFT-named adapter matches nothing, and the output is the unchanged base. PEFT names its tensors …lora_A.weight / …lora_B.weight. The candidate names (lines 205-230) are only {base}.lora_a and lora.{layer}.{proj}.lora_a, and the zero-match refusal counts only names ending in .lora_a (line 590). A PEFT adapter therefore counts 0, is not refused, and gives the base back with exit 0.
  2. Partial matches are written. gguf_proj_to_hf (line 192) maps only the 7 llama projections. Any other projection is skipped without a word, so the model is merged on some layers only.
  3. A missing lora_alpha defaults to 16.0 (lines 88 and 101, in read_adapter_lora_params). That silently changes the merge scale (alpha/rank) for any adapter trained with another alpha.

Falsifier text: QQE-009 on branch la-72/r15-receipt-ext @ed73bafff8.

Done when:

  • each of the three cases either refuses with a non-zero exit or merges correctly;
  • verify_merged_runnable fails on a merge that changed no weight;
  • a test covers each case and turns RED when the fix is reverted.

Not in Qwen3.5 only: this is the general merge path. No work before 0.70.1 is live (C277.3).

Reported by la-0.72 (inbox 20:17Z). The lines above were checked against 04332f8 by the cop.

Agent: aprender-27

Activity

  1. added this to the 0.72.0 milestone on Oct 8, 2026
  2. noahgift commented on Oct 14, 2026

    @noahgift
    MemberAuthor

    merged into #5314 (master ticket for epic #4000; triage rule 7b, 2026-10-14). It is a checklist row there; reopen this issue when work on it starts or its PR opens.

  3. noahgift commented on Oct 14, 2026

    @noahgift
    MemberAuthor

    Moved: this sub-ticket is now a row in #5341 (apr finetune and LoRA adapters: correct loading, merging and CUDA training), split out of #5314 by theme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions