Skip to content

[Studio Bug] CPT overrides LFM2 all-linear defaults with incompatible Llama target names #9866

Closed

Description

@Imagineer99

Environment

Where are you using Unsloth?

  • Studio desktop application
  • Studio web UI (unsloth studio)
  • Unsloth CLI
  • Python package or notebook
  • Colab or Kaggle

Operating system and version: Windows (the reproduction is config-only and platform-independent)

GPU model(s) and accelerator backend: Not applicable; reproduced on CPU without loading model weights

Versions:

  • Unsloth 2026.8.21
  • Transformers 5.5.0
  • PEFT 0.18.1
  • PyTorch 2.10.0+cu130

What happened?

Studio CPT replaces the selected model's LoRA target defaults with the hard-coded Llama-style list:

q_proj k_proj v_proj o_proj gate_proj up_proj down_proj

This is incomplete for LiquidAI/LFM2-1.2B. LFM2 uses out_proj rather than o_proj, w1/w2/w3 rather than gate_proj/up_proj/down_proj, and its convolution blocks also have in_proj/out_proj linear modules.

The LFM2 Studio model defaults already specify all-linear, but switching to CPT overwrites that with CPT_TARGET_MODULES. The CPT advanced settings UI then exposes only the hard-coded names, so the missing LFM2 targets cannot be selected there.

Steps to reproduce:

  1. Load the published LiquidAI/LFM2-1.2B config with Transformers. Model weights are not required.
  2. Instantiate the model under accelerate.init_empty_weights().
  3. Apply PEFT using Studio's CPT target list and enumerate modules containing lora_A.
  4. Repeat using the model-specific all-linear target.

Minimal core reproduction:

from accelerate import init_empty_weights
from peft import LoraConfig, get_peft_model
from transformers import AutoConfig, AutoModelForCausalLM

model_id = "LiquidAI/LFM2-1.2B"
studio_targets = [
    "q_proj", "k_proj", "v_proj", "o_proj",
    "gate_proj", "up_proj", "down_proj",
]
config = AutoConfig.from_pretrained(model_id)

for targets in (studio_targets, "all-linear"):
    with init_empty_weights():
        model = AutoModelForCausalLM.from_config(config)
        model = get_peft_model(
            model,
            LoraConfig(
                r=16,
                lora_alpha=32,
                target_modules=targets,
                task_type="CAUSAL_LM",
            ),
        )
    wrapped = {
        name.rsplit(".lora_A", 1)[0]
        for name, _ in model.named_modules()
        if ".lora_A" in name
    }
    trainable = sum(p.numel() for p in model.parameters() if p.requires_grad)
    print(targets, len(wrapped), trainable)

Result:

Studio CPT defaults: 18 wrapped modules,    884,736 trainable LoRA parameters
all-linear:          92 wrapped modules, 11,108,352 trainable LoRA parameters

The 18 Studio matches are only q_proj, k_proj, and v_proj across the six attention layers. It misses 74 eligible linear modules:

in_proj   10
out_proj  16
w1        16
w2        16
w3        16

These counts exclude lm_head; CPT's separate embed_tokens/lm_head modules_to_save behavior is not the problem being reported here.

Expected behavior:

CPT should preserve or resolve architecture-specific LoRA targets. For LFM2, the existing model-specific all-linear default should not be replaced with incompatible Llama names. CPT can then add embed_tokens and lm_head through its existing modules_to_save path.

Actual behavior:

CPT silently creates a valid adapter on only q/k/v projections. Training starts, so the incomplete coverage is not surfaced as an error or warning.

Model and operation involved:

  • Model: LiquidAI/LFM2-1.2B / unsloth/LFM2-1.2B
  • Operation: Continued Pretraining in Studio

Diagnostics and logs

No runtime error or traceback is produced. This is a deterministic target-resolution issue and reproduces without model weights or a training run.

Additional context

Relevant code:

This confirms incomplete adapter targeting. It does not by itself establish that this causes any particular downstream loss, hallucination, or merged-export symptom.

Activity

  1. added a commit that references this issue on Aug 27, 2026
    c226fd7
  2. added a commit that references this issue on Aug 28, 2026
    d89c43d
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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions