---
name: "peft-parameter-efficient-adapters"
description: "Attach and merge lightweight LoRA, Prefix Tuning, and AdaLoRA adapters with PEFT."
metadata:
  author: "HuggingFace"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "configure peft loraconfig"
  - "attach lora adapter peft"
  - "merge and unload peft model"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# HuggingFace PEFT Parameter-Efficient Adapters

Integrates HuggingFace PEFT: LoraConfig, get_peft_model, task_type=CAUSAL_LM, adapter saving/loading, and merging weights back into base models with merge_and_unload.

## When to Invoke
Invoke this skill whenever you need to:
- configure peft loraconfig
- attach lora adapter peft
- merge and unload peft model

## Execution SOP & Rules
1. Define adapter configuration using LoraConfig(r=16, lora_alpha=32, target_modules=[...]).
2. Wrap base model with model = get_peft_model(base_model, lora_config).
3. Save only adapter weights (typically < 100MB) using model.save_pretrained(adapter_dir).
4. Merge weights permanently for inference deployment using model.merge_and_unload().

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
