lora

lora is a skill for Claude Code from itsmostafa/llm-engineering-skills. It costs 50 tokens per session (3,416 once invoked), scanned A, original, MIT.

A method for adapting a large language model to a specific task by training a small set of added parameters while leaving the original model unchanged. LoRA means Low-Rank Adaptation; QLoRA is a lower-memory version that also uses a compressed model.

In plain words
What is it for?
Use it to fine-tune language models, create and load small adapters, train multiple specialized versions from one base model, use QLoRA, or combine an adapter with its base model.
Why use it?
It reduces the amount of model data that must be trained and stored compared with changing the whole model. This is useful when GPU memory is limited or when several task-specific versions should share one base model.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the llm-engineering-skills plugin — 9 skills shipped together

Good fit Use it to fine-tune language models, create and load small adapters, train multiple specialized versions from one base model, use QLoRA, or combine an adapter with its base model.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/itsmostafa/llm-engineering-skills/lora
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add itsmostafa/llm-engineering-skills --skill lora
Clone the repo
git clone --depth 1 https://github.com/itsmostafa/llm-engineering-skills

Made for: Claude Code.

Or install llm-engineering-skills, the plugin that ships this one along with the rest of its 9 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for lora

README.md
[![agentmods](https://agentmods.dev/badge/skills/itsmostafa/llm-engineering-skills/lora.svg)](https://agentmods.dev/skills/itsmostafa/llm-engineering-skills/lora)
Your own site
<a href="https://agentmods.dev/skills/itsmostafa/llm-engineering-skills/lora"><img src="https://agentmods.dev/badge/skills/itsmostafa/llm-engineering-skills/lora.svg" alt="Measured on agentmods" height="20"></a>
Per session 50 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,416 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00050 $0.03416
Opus 5 $0.00025 $0.01708
Sonnet 5 $0.00010 $0.00683
Haiku 4.5 $0.00005 $0.00342

Measured 7d ago against content hash 21bb3227baa7, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

lora scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/lora/SKILL.md · 455 lines

How it starts

The opening of the file, as written. The whole thing — 455 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Using LoRA for Fine-tuning

LoRA (Low-Rank Adaptation) enables efficient fine-tuning by freezing pretrained weights and injecting small trainable matrices into transformer layers. This reduces trainable parameters to ~0.1% of the original model while maintaining performance.

Table of Contents

Core Concepts

How LoRA Works

Instead of updating all weights during fine-tuning, LoRA decomposes weight updates into low-rank matrices:

W' = W + BA

Where:

  • W is the frozen pretrained weight matrix (d × k)
  • B is a trainable matrix (d × r)
  • A is a trainable matrix (r × k)
  • r is the rank, much smaller than d and k

The key insight: weight updates during fine-tuning have low intrinsic rank, so we can represent them efficiently with smaller matrices.

Why Use LoRA

Aspect Full Fine-tuning LoRA
Trainable params 100% ~0.1-1%
Memory usage High Low
Adapter size Full model ~3-100 MB
Training speed Slower Faster
Multiple tasks Separate models Swap adapters

Basic Setup

Installation

pip install peft transformers accelerate

Minimal Example

from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import LoraConfig, get_peft_model, TaskType
import torch

# Load base model
model_name = "meta-llama/Llama-3.2-1B"
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    dtype=torch.bfloat16,
    device_map="auto",
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
tokenizer.pad_token = tokenizer.eos_token

# Configure LoRA
lora_config = LoraConfig(
    r=16,
    lora_alpha=32,
    target_modules=["q_proj", "k_proj", "v_proj", "o_proj"],
    lora_dropout=0.05,
    bias="none",
    task_type=TaskType.CAUSAL_LM,
)

# Apply LoRA
model = get_peft_model(model, lora_config)
model.print_trainable_parameters()
# trainable params: 3,407,872 || all params: 1,238,300,672 || trainable%: 0.28%

Read the full file on GitHub · 455 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 455 lines · 50 tokens per session scan A 21bb3227baa7

Subscribe to this mod's changes

lora is a skill published in the GitHub repository itsmostafa/llm-engineering-skills (23 stars, last pushed 4mo ago), licensed MIT. It adds 50 tokens to every session and 3,416 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

better-prompt

A prompt editor that turns rough instructions for AI systems into clearer, more complete prompts. It follows published OpenAI and Anthropic guidance.

huangwb8/skills · 107 tokens

ai-engineer-expert

Expert-level AI implementation, deployment, LLM integration, and production AI systems. Use when the user mentions AI engineering, LLM, deployment, production AI, or integration, or when the task involves LLM Patterns, LLM Integration, or Production Systems.

personamanagmentlayer/pcl · 58 tokens

bio-prefect-dask-nextflow

Design reproducible bioinformatics pipelines with Prefect plus Dask or Nextflow. Use when scaffolding local, distributed, or scheduler-backed workflows.

fmschulz/omics-skills · 37 tokens

gauntlet

Empirically test whether a skill actually improves model output — before trusting it. Runs a controlled experiment: planted-flaw fixture, no-skill control arm, skill arm(s), optional cross-model arms via installed CLIs, blind judging with shuffled labels, and a pressure test for verdict stability. Produces…

CassioRoos/godfly-skills · 131 tokens

image-prompt

Use when the user wants to turn a short idea into a rich, production-grade image-generation prompt — posters, landing-page or UI mockups, ads, editorial layouts, photoreal scenes, game screenshots, logos, or illustrations. Builds ONE structured, copy-paste-ready prompt optimized for gpt-image-2 by default, following…

veryCoolTimo/imagegen-skills · 148 tokens

toolshed

Toolshed — durable, model-agnostic working state for ONE coding task (feature, fix, investigation) as docs/work/SLUG/ under docs/, DELETED at close. NOT the Workbench product/MCP (Slack highlights app). Seeds STATE + decisions/questions/evidence with grades and reproduction commands. Use for "start a toolshed", "seed…

CassioRoos/godfly-skills · 165 tokens