Repository navigation
Description
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:
- Load the published
LiquidAI/LFM2-1.2Bconfig with Transformers. Model weights are not required. - Instantiate the model under
accelerate.init_empty_weights(). - Apply PEFT using Studio's CPT target list and enumerate modules containing
lora_A. - Repeat using the model-specific
all-lineartarget.
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:
- CPT target list: https://github.com/unslothai/unsloth/blob/main/studio/frontend/src/config/training.ts
- CPT transition overwriting model defaults: https://github.com/unslothai/unsloth/blob/main/studio/frontend/src/features/training/stores/training-method-transition.ts
- LFM2 model default using
all-linear: https://github.com/unslothai/unsloth/blob/main/studio/backend/assets/configs/model_defaults/other/unsloth_LFM2-1.2B.yaml - LFM2 module definitions: https://github.com/huggingface/transformers/blob/main/src/transformers/models/lfm2/modeling_lfm2.py
This confirms incomplete adapter targeting. It does not by itself establish that this causes any particular downstream loss, hallucination, or merged-export symptom.
Activity
Fix Studio CPT overwriting LFM2 all-linear LoRA targets
Fix Studio CPT overwriting LFM2 all-linear LoRA targets (#9870)