{"slug": "fine-tuning-open-source-llms-with-lora-and-qlora-a-developer-s-field-guide", "title": "Fine-Tuning Open-Source LLMs with LoRA and QLoRA: A Developer's Field Guide", "summary": "A developer published a field guide to fine-tuning open-source LLMs with LoRA and QLoRA, arguing that QLoRA's 4-bit NF4 quantization cuts VRAM roughly 4x, letting a 7B model train in about 6-8GB on a consumer RTX 3060. The guide recommends QLoRA for models under 13B parameters, LoRA in fp16 when quality matters most, and warns that fine-tuning teaches behavior and format rather than new facts, for which RAG is the better tool.", "body_md": "The first time you fine-tune a 7B model on your own dataset, you realize something interesting. You don't need a $20,000 GPU anymore. You don't even need a $2,000 GPU if you're willing to let it train overnight. QLoRA quietly rewrote the economics of model customization more than any paper I've read in the last three years, and yet most teams I talk to still default to prompt engineering or pay-per-call fine-tuning APIs without even trying it on their own hardware.\n\nThis is the guide I wish I'd had when I bricked my first Llama 2 checkpoint by saving it wrong. We're going to go from a messy JSONL file to a merged, deployable model. I'll show you every pothole along the way, because most of them don't show up in the HuggingFace docs.\n\nLet's get the obvious out of the way. If your problem is \"I want GPT-4 quality answers,\" fine-tuning a 7B model won't get you there. Fine-tuning is not magic. What it is, is a way to teach a model your domain's vocabulary, your output format, your style, and your specific reasoning patterns-without paying per token forever.\n\nThe four scenarios where fine-tuning actually wins:\n\nWhere fine-tuning fails: injecting new factual knowledge. If you want the model to know your docs, use RAG. Fine-tuning teaches behavior, not facts. I've seen teams spend weeks fine-tuning a model on their wiki, only to discover it confidently hallucinates policy numbers. Use the right tool.\n\nQuick refresher for anyone who's been ignoring the PEFT literature.\n\n**LoRA (Low-Rank Adaptation)** freezes the original model weights and trains a small set of \"adapter\" weights-low-rank decompositions of the weight deltas. Train 0.5-2% of the parameters, get 95%+ of the fine-tune quality. The base model stays untouched, the adapter is a few hundred MB instead of 14GB, and you can hot-swap adapters at inference time.\n\n**QLoRA** is LoRA with one extra trick: the base model is loaded in 4-bit precision (using `bitsandbytes`'s NF4 quantization) before the LoRA adapters are trained on top in full precision. This drops VRAM requirements by roughly 4x. A Llama-2-7B that needs ~28GB in fp16 for full fine-tuning, or ~14GB for LoRA, trains in about 6-8GB with QLoRA. That's a 7B model fitting on a consumer RTX 3060.\n\n| Approach | Trainable Params | VRAM (7B model) | Adapter Size | Quality (vs full FT) | Use When | \n|---|---|---|---|---|---|\n| Full fine-tuning | 100% | 80GB+ | 14GB (full model) | 100% baseline | You have A100s and a real budget | \n| LoRA (fp16) | 0.5-2% | 14-20GB | 50-500MB | 92-98% | You have a 16GB+ GPU | \n| QLoRA (4-bit) | 0.5-2% | 6-10GB | 50-500MB | 90-96% | Consumer GPU or free Colab | \n| Prompt tuning | 0.01% | 4-8GB | <1MB | 70-85% | Quick experiments, weak results | \n\nMy default: QLoRA for everything under 13B parameters, LoRA in fp16 if I have an A100 and care about every last percent of quality. Full fine-tuning only when I'm training a foundation model for release.\n\nYou'll need:\n\n`bitsandbytes` is still rough as of late 2024.)\nIf you're on a free Colab T4, you can train a 7B with QLoRA. I've done it. It's slow but it works.\n\nCreate a fresh venv. Don't pollute your system Python-`bitsandbytes` and `accelerate` versions are picky and you'll thank yourself later.\n\n```\nBashCopy\n```\n\npython -m venv .venv\n\nsource .venv/bin/activate\n\npip install --upgrade pip\n\npip install \"torch==2.4.0\" --index-url [https://download.pytorch.org/whl/cu121](https://download.pytorch.org/whl/cu121)\n\npip install \"transformers==4.44.2\" \"datasets==2.21.0\" \"peft==0.12.0\" \"trl==0.9.6\" \"accelerate==0.34.2\" \"bitsandbytes==0.43.3\"\n\npip install \"wandb\" \"evaluate\" \"sentencepiece\" \"protobuf\"\n\nPin your versions. I cannot stress this enough. The HuggingFace stack moves fast and breaks things. I once lost two days because `trl` 0.10 silently renamed `SFTTrainer` arguments between patch versions. Pin everything, commit your `requirements.txt`.\n\n```\ntxtCopy\n```\n\nplaintext\n\ntorch==2.4.0\n\ntransformers==4.44.2\n\ndatasets==2.21.0\n\npeft==0.12.0\n\ntrl==0.9.6\n\naccelerate==0.34.2\n\nbitsandbytes==0.43.3\n\nwandb==0.17.9\n\nsentencepiece==0.2.0\n\nprotobuf==5.28.2\n\nVerify `bitsandbytes` sees CUDA:\n\n```\nBashCopy\n```\n\npython\n\npython -c \"import bitsandbytes as bnb; import torch; print(bnb.**version**); print(torch.cuda.is_available())\"\n\nmarkdown\n\nIf you get `False` on CUDA availability or a `RuntimeError: CUDA Setup failed`, your CUDA toolkit version doesn't match the PyTorch wheel. Go back and match them. This is the single most common install failure I see.\n\nModels are easy. Data is hard. I've reviewed dozens of fine-tuning projects and the failure mode is almost always the same: someone scraped 50,000 examples, didn't look at them, trained for 3 epochs, and shipped a model that \"feels smarter\" but actually regressed on key tasks.\n\nFor supervised fine-tuning (SFT), use a chat-formatted JSONL. Each line is one conversation:\n\n```\nJSONCopy\n```\n\njson\n\n{\"messages\": [{\"role\": \"system\", \"content\": \"You are a concise technical writer.\"}, {\"role\": \"user\", \"content\": \"Explain what a mutex is.\"}, {\"role\": \"assistant\", \"content\": \"A mutex is a synchronization primitive...\"}]}\n\nIf your model uses a specific chat template (Llama 3, ChatML, Mistral), match it. We'll handle the templating during tokenization-don't pre-format strings by hand, it's a recipe for subtle bugs.\n\nHere's a real dataset prep script I use. It deduplicates, filters by length, and shuffles:\n\n```\nPythonCopy\n```\n\npython\n\nimport json\n\nimport random\n\nfrom pathlib import Path\n\nINPUT_PATH = Path(\"data/raw_conversations.jsonl\")\n\nOUTPUT_PATH = Path(\"data/train.jsonl\")\n\nVALIDATION_PATH = Path(\"data/val.jsonl\")\n\nVAL_FRACTION = 0.05\n\nMIN_ASSISTANT_TOKENS = 20\n\nMAX_ASSISTANT_TOKENS = 2048\n\ndef load_examples(path):\n\n examples = []\n\n with path.open() as f:\n\n for i, line in enumerate(f):\n\n line = line.strip()\n\n if not line:\n\n continue\n\n try:\n\n ex = json.loads(line)\n\n except json.JSONDecodeError:\n\n print(f\"Skipping malformed line {i}\")\n\n continue\n\n if not _is_valid(ex):\n\n continue\n\n examples.append(ex)\n\n return examples\n\ndef _is_valid(ex):\n\n if \"messages\" not in ex or len(ex[\"messages\"]) < 2:\n\n return False\n\n roles = [m[\"role\"] for m in ex[\"messages\"]]\n\n if roles[-1] != \"assistant\":\n\n return False\n\n assistant_text = ex[\"messages\"][-1][\"content\"]\n\n token_estimate = len(assistant_text) // 4 # rough: 4 chars/token\n\n if not (MIN_ASSISTANT_TOKENS <= token_estimate <= MAX_ASSISTANT_TOKENS):\n\n return False\n\n if any(not m.get(\"content\", \"\").strip() for m in ex[\"messages\"]):\n\n return False\n\n return True\n\ndef dedupe(examples):\n\n seen = set()\n\n out = []\n\n for ex in examples:\n\n key = json.dumps(ex, sort_keys=True)\n\n if key in seen:\n\n continue\n\n seen.add(key)\n\n out.append(ex)\n\n return out\n\ndef main():\n\n examples = load_examples(INPUT_PATH)\n\n print(f\"Loaded {len(examples)} examples\")\n\n examples = dedupe(examples)\n\n print(f\"After dedupe: {len(examples)}\")\n\n random.seed(42)\n\n random.shuffle(examples)\n\n n_val = max(1, int(len(examples) * VAL_FRACTION))\n\n val = examples[:n_val]\n\n train = examples[n_val:]\n\n OUTPUT_PATH.parent.mkdir(parents=True, exist_ok=True)\n\n with OUTPUT_PATH.open(\"w\") as f:\n\n for ex in train:\n\n f.write(json.dumps(ex, ensure_ascii=False) + \"\\n\")\n\n with VALIDATION_PATH.open(\"w\") as f:\n\n for ex in val:\n\n f.write(json.dumps(ex, ensure_ascii=False) + \"\\n\")\n\n print(f\"Wrote {len(train)} train, {len(val)} val\")\n\nif **name** == \"**main**\":\n\n main()\n\nLook at your data. I mean it. Sample 20 examples, read them aloud, ask \"would I want the model to imitate this?\" If the answer is no, your fine-tune will faithfully reproduce the bad behavior. Garbage in, garbage out, but with extra confidence.\n\nNow the actual code. We'll load a Llama-3.1-8B-Instruct in 4-bit and attach a LoRA adapter.\n\n```\nPythonCopy\n```\n\nimport torch\n\nfrom transformers import (\n\n AutoModelForCausalLM,\n\n AutoTokenizer,\n\n BitsAndBytesConfig,\n\n)\n\nfrom peft import LoraConfig, get_peft_model, prepare_model_for_kbit_training\n\nfrom datasets import load_dataset\n\nfrom trl import SFTTrainer, SFTConfig\n\nMODEL_ID = \"meta-llama/Llama-3.1-8B-Instruct\"\n\nTRAIN_FILE = \"data/train.jsonl\"\n\nVAL_FILE = \"data/val.jsonl\"\n\nOUTPUT_DIR = \"outputs/llama31-8b-sft\"\n\nADAPTER_DIR = \"outputs/llama31-8b-sft/adapter\"\n\ndef build_bnb_config():\n\n return BitsAndBytesConfig(\n\n load_in_4bit=True,\n\n bnb_4bit_quant_type=\"nf4\",\n\n bnb_4bit_compute_dtype=torch.bfloat16,\n\n bnb_4bit_use_double_quant=True,\n\n )\n\ndef load_model_and_tokenizer():\n\n bnb_config = build_bnb_config()\n\n tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)\n\n if tokenizer.pad_token is None:\n\n tokenizer.pad_token = tokenizer.eos_token\n\n model = AutoModelForCausalLM.from_pretrained(\n\n MODEL_ID,\n\n quantization_config=bnb_config,\n\n device_map=\"auto\",\n\n trust_remote_code=True,\n\n torch_dtype=torch.bfloat16,\n\n )\n\n model = prepare_model_for_kbit_training(model)\n\n return model, tokenizer\n\nif **name** == \"**main**\":\n\n model, tokenizer = load_model_and_tokenizer()\n\n print(f\"Model loaded. VRAM: {torch.cuda.memory_allocated() / 1e9:.2f} GB\")\n\nA few non-obvious choices:\n\n`nf4` over `fp4`.` bnb_4bit_use_double_quant=True`.` bnb_4bit_compute_dtype=torch.bfloat16`.` prepare_model_for_kbit_training`.\nThe LoRA config is where you make the quality vs. speed trade-off. Higher rank = more capacity = more VRAM.\n\n```\nPythonCopy\n```\n\ndef build_lora_config():\n\n return LoraConfig(\n\n r=16,\n\n lora_alpha=32,\n\n lora_dropout=0.05,\n\n bias=\"none\",\n\n task_type=\"CAUSAL_LM\",\n\n target_modules=[\n\n \"q_proj\", \"k_proj\", \"v_proj\", \"o_proj\",\n\n \"gate_proj\", \"up_proj\", \"down_proj\",\n\n ],\n\n )\n\ndef train():\n\n model, tokenizer = load_model_and_tokenizer()\n\n lora_config = build_lora_config()\n\n model = get_peft_model(model, lora_config)\n\n model.print_trainable_parameters()\n\n # Expect: trainable params: ~40M / 8B (0.5%)\n\ndataset = load_dataset(\n\n \"json\",\n\n data_files={\"train\": TRAIN_FILE, \"validation\": VAL_FILE},\n\n )\n\nsft_config = SFTConfig(\n\n output_dir=OUTPUT_DIR,\n\n num_train_epochs=3,\n\n per_device_train_batch_size=2,\n\n gradient_accumulation_steps=8, # effective batch = 16\n\n gradient_checkpointing=True,\n\n gradient_checkpointing_kwargs={\"use_reentrant\": False},\n\n optim=\"adamw_torch\",\n\n learning_rate=2e-4,\n\n lr_scheduler_type=\"cosine\",\n\n warmup_ratio=0.03,\n\n weight_decay=0.0,\n\n max_grad_norm=0.3,\n\n logging_steps=10,\n\n save_strategy=\"epoch\",\n\n eval_strategy=\"epoch\",\n\n save_total_limit=3,\n\n bf16=True,\n\n report_to=\"wandb\",\n\n run_name=\"llama31-8b-sft-v1\",\n\n max_seq_length=2048,\n\n packing=True,\n\n )\n\ntrainer = SFTTrainer(\n\n model=model,\n\n args=sft_config,\n\n train_dataset=dataset[\"train\"],\n\n eval_dataset=dataset[\"validation\"],\n\n tokenizer=tokenizer,\n\n )\n\ntrainer.train()\n\n trainer.save_model(ADAPTER_DIR)\n\n tokenizer.save_pretrained(ADAPTER_DIR)\n\n print(f\"Adapter saved to {ADAPTER_DIR}\")\n\nif **name** == \"**main**\":\n\n train()\n\nKey knobs and why they matter:\n\n`r=16, lora_alpha=32`.` target_modules` includes all linear layers.`learning_rate=2e-4`.` packing=True`.` max_seq_length=2048`.\nAdapters are great for swapping, but for deployment you usually want one merged model.\n\n```\nPythonCopy\n```\n\nimport torch\n\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\nfrom peft import PeftModel\n\nBASE_MODEL = \"meta-llama/Llama-3.1-8B-Instruct\"\n\nADAPTER_PATH = \"outputs/llama31-8b-sft/adapter\"\n\nMERGED_PATH = \"outputs/llama31-8b-sft/merged\"\n\ndef merge():\n\n base = AutoModelForCausalLM.from_pretrained(\n\n BASE_MODEL,\n\n torch_dtype=torch.bfloat16,\n\n device_map=\"cpu\", # merge on CPU to avoid VRAM issues\n\n )\n\n tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL)\n\n model = PeftModel.from_pretrained(base, ADAPTER_PATH)\n\n model = model.merge_and_unload()\n\n model.save_pretrained(MERGED_PATH, safe_serialization=True, max_shard_size=\"4GB\")\n\n tokenizer.save_pretrained(MERGED_PATH)\n\n print(f\"Merged model saved to {MERGED_PATH}\")\n\nif **name** == \"**main**\":\n\n merge()\n\nMerge on CPU. The merged model is full fp16/bf16 size, so you need enough system RAM (16GB+ for a 7B). Merging on GPU is a recipe for OOM.\n\nAfter this, you have a standalone model directory you can quantize to [GGUF](https://mangodeveloper.com/articles/how-to-upgrade-llama-cpp-v1-0-0-run-gguf-models-windows-ml), serve with vLLM, or push to the Hub.\n\n```\nPythonCopy\n```\n\nMODEL_PATH = \"outputs/llama31-8b-sft/merged\"\n\ndef main():\n\n tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH)\n\n model = AutoModelForCausalLM.from_pretrained(\n\n MODEL_PATH,\n\n torch_dtype=torch.bfloat16,\n\n device_map=\"auto\",\n\n )\n\n messages = [\n\n {\"role\": \"system\", \"content\": \"You are a concise technical writer.\"},\n\n {\"role\": \"user\", \"content\": \"Explain what a mutex is in two sentences.\"},\n\n ]\n\n prompt = tokenizer.apply_chat_template(\n\n messages, tokenize=False, add_generation_prompt=True\n\n )\n\n inputs = tokenizer(prompt, return_tensors=\"pt\").to(model.device)\n\n with torch.no_grad():\n\n out = model.generate(\n\n **inputs,\n\n max_new_tokens=256,\n\n do_sample=True,\n\n temperature=0.7,\n\n top_p=0.9,\n\n repetition_penalty=1.05,\n\n )\n\n response = tokenizer.decode(\n\n out[0][inputs[\"input_ids\"].shape[1]:],\n\n skip_special_tokens=True,\n\n )\n\n print(response)\n\nRun this before you even think about deploying. If the output looks wrong here, it'll look wrong in production-but worse, because prod has no humans watching.\n\n**Deployment.** Don't serve fine-tuned models with raw `transformers`. Use vLLM (10-20x throughput) or, for CPU/edge, llama.cpp with a GGUF conversion. I deploy with vLLM in Docker on a single L4 or A10, and that comfortably serves 50-100 RPS for an 8B model.\n\n**Quantization for serving.** After merging, quantize to 8-bit (AWQ or GPTQ) for ~2x throughput at minimal quality loss. GGUF Q8_0 is fine for CPU. I avoid 4-bit for serving unless I'm seriously VRAM-constrained-the quality drop on fine-tuned models can be more noticeable than on base models.\n\n**Versioning.** Every adapter gets a version tag and a git commit with the training data hash. When a model regresses in prod, you need to know what data and config produced it. Use DVC or just commit data diffs to a separate repo.\n\n**Evaluation.** Build a held-out eval set of 50-200 prompts with reference answers. Run it after every fine-tune. Measure pass@1 for code tasks, BLEU/ROUGE for generation (with a grain of salt), and-most importantly-human review on a sample. I use `lm-evaluation-harness` for standardized benchmarks.\n\n**Caching.** At inference time, cache by `(model_version, prompt_hash)` in Redis. Fine-tuned models are deterministic at temperature=0. Don't recompute identical prompts.\n\n**Monitoring.** Log every prompt and response (with PII scrubbing). Watch for: response length drift (model degrading), repetition (a classic overfit symptom), and out-of-domain queries (your fine-tune might break on inputs it never saw).\n\n**Multi-adapter serving.** If you have multiple fine-tunes for different customers, vLLM and LoRAX support hot-swapping LoRA adapters at inference time. Don't spin up separate model servers per customer-that's 14GB of VRAM per tenant.\n\n**Mistake: Catastrophic forgetting.** Model gets great at the new task but loses general capability. *Cause:* too many epochs, too high a learning rate, or training data too narrow. *Detect:* run a general benchmark (MMLU, MT-Bench) before and after. *Fix:* fewer epochs (2-3 max), lower LR, mix in 10-20% general instruction data.\n\n**Mistake: Training on the system prompt.** If your dataset includes the system message in every example and you compute loss on it, the model learns to *produce* system messages. *Cause:* not masking the prompt tokens. *Detect:* model outputs `<|system|>` tokens unprompted. *Fix:* use `SFTTrainer` with the `messages` format-it masks correctly. If you're tokenizing manually, set labels to -100 for non-assistant tokens.\n\n**Mistake: Tokenizer mismatch.** You trained with one chat template, serve with another. *Cause:* `apply_chat_template` defaults differ across model versions. *Detect:* model output is gibberish or starts with stray tokens. *Fix:* pin the tokenizer version, save it with the adapter, and verify the template matches at inference.\n\n**Mistake: Forgetting `pad_token`.** Llama tokenizers don't have a default pad token. *Cause:* legacy. *Detect:* `AttributeError` or silent wrong batching. *Fix:* set `tokenizer.pad_token = tokenizer.eos_token` and `model.config.pad_token_id = tokenizer.eos_token_id`.\n\n**Mistake: OOM at save time.** Training is fine, saving crashes. *Cause:* `save_pretrained` tries to materialize fp32 weights. *Fix:* use `safe_serialization=True` and `torch_dtype` explicitly. Or save on CPU.\n\n**Mistake: Training on truncated examples.** Your `max_seq_length=2048` but examples are 3000 tokens. The end gets cut off, including the assistant response. *Cause:* not filtering by length in data prep. *Detect:* model generates incomplete answers. *Fix:* filter pre-training, or increase `max_seq_length` (with the VRAM cost).\n\n**`RuntimeError: CUDA out of memory` during backward pass.** VRAM spikes during backward. Lower `per_device_train_batch_size` to 1, increase `gradient_accumulation_steps`. Enable `gradient_checkpointing=True`. If still OOM, lower `max_seq_length`. Last resort: lower LoRA `r`.\n\n**Loss is NaN after a few steps.** Almost always fp16 overflow. Switch to `bf16=True` (Ampere+ GPUs) or use `fp16=True` with `max_grad_norm=0.3` and a lower LR. If you're on an older GPU without bf16 support, you're in for a bad time-consider QLoRA with `bnb_4bit_compute_dtype=torch.float16` and aggressive gradient clipping.\n\n**Validation loss decreases then sharply increases.** Classic overfitting. You're training too long. Cut epochs to 2, add `lora_dropout=0.1`, mix in general data.\n\n**Model produces repetitive output.** Either overfit (see above) or repetition penalty too low at inference. Try `repetition_penalty=1.1-1.3`. If it persists, your training data probably has repetition-dedupe harder.\n\n**Training is painfully slow.** Check: `gradient_checkpointing=True` (slows ~20%, saves VRAM-worth it). `packing=True` for short examples. `dataloader_num_workers=4`. Use `flash_attention_2` if installed (`pip install flash-attn --no-build-isolation`).\n\n**`AttributeError: 'NoneType' object has no attribute '...'` in TRL.** Version mismatch. `trl` 0.9 vs 0.10 have breaking API changes. Pin to one version, read that version's docs.\n\nRough numbers as of late 2024, for fine-tuning a 7B model with QLoRA on 5,000 examples, 3 epochs:\n\nThe economics flip at scale. Once you have the GPU and the pipeline, fine-tuning your own 7B is nearly free per iteration. API fine-tuning charges you every time.\n\n| Option | One-time cost | Per-iteration cost | You own the model? | Quality ceiling | \n|---|---|---|---|---|\n| QLoRA on rented A10 | $0 (script) | ~$5 | Yes | 7B/13B model quality | \n| Full FT on A100 80GB | $0 (script) | ~$20-50 | Yes | Higher, especially for 70B | \n| OpenAI GPT-4o-mini FT | $0 | ~$7 per 5K ex | No | GPT-4o-mini class | \n| Anthropic fine-tuning | $0 | Varies | No | Claude class | \n\n`{category, urgency, suggested_owner}`. 92% accuracy vs 78% zero-shot.\nFine-tuning [open-source](https://mangodeveloper.com/category/dev) LLMs with QLoRA is one of the highest-leverage skills in modern ML engineering. The barrier to entry has collapsed-what used to require a cluster now runs on a consumer GPU overnight. The actual ML is maybe 20% of the work. The other 80% is data prep, eval, and deployment. Get those right and the model part mostly takes care of itself.\n\nIf you take one thing from this guide: **build your eval set before you train.** Not after. Before. If you don't have a way to measure whether your fine-tune is better, you're just vibes-tuning.\n\nOriginally published on [Mango Developer](https://mangodeveloper.com/articles/fine-tune-llm-lora-qlora).", "url": "https://wpnews.pro/news/fine-tuning-open-source-llms-with-lora-and-qlora-a-developer-s-field-guide", "canonical_source": "https://dev.to/mango7777/fine-tuning-open-source-llms-with-lora-and-qlora-a-developers-field-guide-b2a", "published_at": "2026-11-27 19:30:00+00:00", "updated_at": "2026-11-27 19:44:54.880540+00:00", "lang": "en", "topics": ["large-language-models", "ai-tools", "machine-learning", "ai-infrastructure"], "entities": ["Hugging Face", "Llama 2", "bitsandbytes", "PEFT", "TRL", "Google Colab", "NVIDIA"], "also_reported_by": [], "takeaway": "QLoRA loads the base model in 4-bit NF4 and trains full-precision LoRA adapters, cutting a 7B model's training VRAM from ~14GB to 6-8GB at 90-96% of full fine-tune quality.", "recommendation": {"advice": "Use QLoRA for fine-tuning models under 13B on consumer GPUs, and pin your transformers, peft, trl and bitsandbytes versions to avoid silent API breaks.", "playbook": "training-data", "playbook_url": "https://wpnews.pro/playbooks/training-data"}, "alternates": {"html": "https://wpnews.pro/news/fine-tuning-open-source-llms-with-lora-and-qlora-a-developer-s-field-guide", "markdown": "https://wpnews.pro/news/fine-tuning-open-source-llms-with-lora-and-qlora-a-developer-s-field-guide.md", "text": "https://wpnews.pro/news/fine-tuning-open-source-llms-with-lora-and-qlora-a-developer-s-field-guide.txt", "jsonld": "https://wpnews.pro/news/fine-tuning-open-source-llms-with-lora-and-qlora-a-developer-s-field-guide.jsonld"}}