Fine-Tuning11 articles

Fine-Tuning

Articles

  • Embedding Model Fine-Tuning in Production: Hard Negative Mining, Synthetic Data Pipelines, and Contrastive Distillation

    Production retrieval-augmented generation (RAG) and semantic search architectures frequently suffer from domain mismatch when relying on general-purpose embedding models. Off-the-shelf bi-encoders trained on broad web corpora often experience a 15% to 30% degradation in retrieval metrics such as NDCG@10 and MRR@10 when deployed on specialized enterprise corpora, including proprietary codebases, internal API schemas, clinical trials, and technical documentation. While downstream cross-encoder re

    1 min
  • Retrieval-Augmented Fine-Tuning (RAFT) in Production: Architecture, Synthetic Distractor Pipelines, and Evaluation

    Standard approaches to enterprise domain adaptation typically force a choice between two paradigms: Supervised Fine-Tuning (SFT) or Retrieval-Augmented Generation (RAG). SFT bakes domain knowledge directly into model weights, functioning like a closed-book exam. When facts change or precise source attribution is required, SFT models often hallucinate or fail to incorporate updated context. Conversely, standard RAG operates like an open-book exam without prior preparation. The base model reads re

    1 min
  • Fine-Tuning vs. RAG in Production: Knowledge Injection, Task Adaptation, Latency Economics, and Hybrid Architecture Trade-Offs

    Fine-Tuning vs. RAG in Production: Knowledge Injection, Task Adaptation, Latency Economics, and Hybrid Architecture Trade-Offs When adapting large language models to domain-specific enterprise workloads, engineering teams face a fundamental architectural choice: modify the model's parametric weights via fine-tuning, or supply dynamic context at inference time via Retrieval-Augmented Generation (RAG). While early discussions often framed this decision as a binary trade-off, empirical evaluation

    1 min
  • NormalFloat (NF4) and Double Quantization: The Information-Theoretic Foundations of QLoRA

    Fine-tuning large language models under full 16-bit precision is governed by strict memory scaling laws. For a standard 65-billion parameter transformer model, storing weights in 16-bit BrainFloat (BF16) or Float16 (FP16) requires 130 GB of GPU memory. During training with standard first-order adaptive optimizers such as AdamW, each parameter requires an additional 2 bytes for gradients and 8 bytes for FP32 optimizer states (4 bytes for first-moment momentum and 4 bytes for second-moment varianc

    1 min
  • Parameter-Efficient Fine-Tuning Beyond LoRA: How Adapters, Prefix Tuning, Prompt Tuning, and (IA)3 Adapt Frozen LLMs

    Parameter-Efficient Fine-Tuning Beyond LoRA: How Adapters, Prefix Tuning, Prompt Tuning, and (IA)3 Adapt Frozen LLMs While Low-Rank Adaptation (LoRA) and its weight-decomposed variant (DoRA) serve as the prevailing standard for adapting large language models, parameter-efficient fine-tuning (PEFT) encompasses a broader taxonomy of mathematical approaches. The core objective of PEFT is to adapt multi-billion-parameter foundation models to specialized downstream tasks while updating only a fracti

    1 min
  • Self-Play Fine-Tuning (SPIN): How Iterative Games Against Historical Checkpoints Eliminate Preference Labels

    Self-Play Fine-Tuning (SPIN): How Iterative Games Against Historical Checkpoints Eliminate Preference Labels Supervised fine-tuning (SFT) remains the standard entry point for adapting foundation language models to downstream instructions. By training on curated prompt-response pairs via token-level cross-entropy loss, SFT forces a model to mirror reference demonstrations. However, standard maximum likelihood estimation (MLE) suffers from exposure bias and covariate shift. During inference, the

    1 min
  • Weight-Decomposed Low-Rank Adaptation (DoRA): How Decoupling Magnitude and Direction Closes the LoRA Gap

    Weight-Decomposed Low-Rank Adaptation (DoRA): How Decoupling Magnitude and Direction Closes the LoRA Gap Parameter-efficient fine-tuning (PEFT) has become the standard operational paradigm for adapting large language models to domain-specific downstream tasks. Among existing PEFT methodologies, Low-Rank Adaptation (LoRA) remains the default implementation across industry and academia due to its minimal parameter footprint and zero inference overhead. However, empirical studies consistently reve

    1 min
  • Supervised Fine-Tuning in Large Language Models: Loss Masking, Sequence Packing, and Alignment Dynamics

    Pre-training endows a large language model with broad linguistic patterns, world knowledge, and reasoning primitives by predicting the next token across trillions of uncurated web tokens. However, a raw base model remains a document completer rather than an interactive assistant. Given a prompt such as "Explain how a compiler works," a base model is as likely to generate additional exam questions or web navigation headers as it is to answer the query. Supervised Fine-Tuning (SFT), frequently te

    1 min
  • Reference-Free Preference Optimization: How ORPO and SimPO Eliminate Reference Models in LLM Alignment

    Aligning large language models with human preferences has historically relied on two distinct stages after pretraining: Supervised Fine-Tuning (SFT) to establish instruction-following behaviors, followed by reinforcement learning from human feedback (RLHF) or Direct Preference Optimization (DPO) to maximize response quality. While DPO removed the need for explicit reward modeling and complex actor-critic policy loops (such as Proximal Policy Optimization, or PPO), it retained an architectural b

    1 min
  • LLM Fine-Tuning Frameworks in Production: Unsloth vs. Axolotl vs. LLaMA-Factory vs. Torchtune Architecture, Throughput, and Distributed Scaling

    Modern post-training pipelines have moved beyond basic training scripts. As model parameter counts, context windows, and alignment techniques expand, the choice of fine-tuning framework directly dictates GPU memory overhead, token throughput, and developer iteration speed. Four open-source frameworks dominate the enterprise fine-tuning landscape: Unsloth, Axolotl, LLaMA-Factory, and Meta's Torchtune. While all four orchestrate parameter-efficient fine-tuning (PEFT) and full parameter adaptation

    1 min
  • Low-Rank Adaptation (LoRA): How Matrix Decomposition Made LLM Fine-Tuning Accessible

    Full-parameter fine-tuning of modern foundation models requires substantial compute and memory infrastructure. Adapting an open-weight 70-billion-parameter model using standard 16-bit precision and first-order adaptive optimizers like AdamW demands well over 1 terabyte of GPU memory. Low-Rank Adaptation (LoRA) bypassed this hardware bottleneck by framing task-specific weight updates as low-rank matrix decompositions. By freezing pre-trained weights and training small auxiliary rank decompositio

    1 min