Clark Farming CompanySoftware Foundry

AI / Agent Reference · Reference

Fine-Tuning Methodologies

Overview of Large Language Model fine-tuning approaches — from supervised fine-tuning (SFT) to reinforcement learning from human feedback (RLHF) and beyond. Each methodology optimizes different objectives and requires different data formats. The simplest and most common fine-tuning method. Train the model on labeled input-output pairs using standard cross-entropy loss. Or conversational format: Standard next-token pr…

draftneeds-review0 source links1 resolved links
wiki/wiki/ai-ml/fine-tuning-methodologies.md

Answer

Overview of Large Language Model fine-tuning approaches — from supervised fine-tuning (SFT) to reinforcement learning from human feedback (RLHF) and beyond. Each methodology optimizes different objectives and requires different data formats. The simplest and most common fine-tuning method. Train the model on labeled input-output pairs using standard cross-entropy loss. Or conversational format: Standard next-token pr…

Auto-generated neutral summary from the source page — needs human review before trusted use.

Evidence & Source Cards

No explicit artifact, library, or external source links found in this sample slice. Evidence state remains needs-review.

Source Excerpt

Overview of Large Language Model fine-tuning approaches — from supervised fine-tuning (SFT) to reinforcement learning from human feedback (RLHF) and beyond. Each methodology optimizes different objectives and requires different data formats.

Supervised Fine-Tuning (SFT)

Description

The simplest and most common fine-tuning method. Train the model on labeled input-output pairs using standard cross-entropy loss.

Data Format

{
  "instruction": "Summarize this article.",
  "input": "Article text...",
  "output": "Summary..."
}

Or conversational format:

{
  "conversations": [
    {"from": "human", "value": "Summarize this article.\n\nArticle text..."},
    {"from": "gpt", "value": "Summary..."}
  ]
}

Loss Function

L_SFT = -Σ log P(y_i | x, y_<i)

Standard next-token prediction loss on the output tokens only.

Strengths

Weaknesses

Direct Preference Optimization (DPO)

Description

Optimize the model directly on preference data (chosen vs rejected responses) without a separate reward model. Simplifies RLHF by combining reward modeling and policy optimization into a single step.

Data Format

{
  "prompt": "Write a Python function to sort a list.",
  "chosen": "def sort_list(lst):\n    return sorted(lst)",
  "rejected": "Here's how you might sort a list in Python..."
}

Loss Function

L_DPO = -log σ(β log π(chosen/prompt) - β log π(rejected/prompt))

Where π is the policy model, σ is sigmoid, and β controls strength.

Strengths

Weaknesses

Online Reinforcement Learning from Human Feedback (RLHF)

Description

The classic alignment pipeline: train a reward model on human preferences, then optimize the policy using PPO (Proximal Policy Optimization).

Pipeline

SFT → Reward Model Training → PPO Fine-Tuning → Aligned Model

Data Format

Same as DPO (preference pairs), but used to train a separate reward model first.

Strengths

Weaknesses

Group Relative Policy Optimization (GRPO)

Description

A variant of RLHF that uses group-relative advantages instead of absolute rewards. More stable than PPO, less prone to reward hacking.

How It Works

  1. Generate multiple responses per prompt
  2. Score all responses (reward model or verifier)
  3. Compute relative advantages within the group
  4. Update policy using relative advantages

Strengths

Weaknesses

Odds Ratio Preference Optimization (ORPO)

Description

Optimizes the odds ratio between chosen and rejected responses. Simpler than DPO, more stable in practice.

Loss Function

L_ORPO = -log(π(chosen) / (π(chosen) + π(rejected)))

Strengths

Weaknesses

Kahneman-Tversky Optimization (KTO)

Description

Inspired by prospect theory. Optimizes based on desired/undesired labels rather than pairwise preferences. More flexible data format.

Data Format

{
  "prompt": "Write a Python function.",
  "completion": "def sort_list(lst): return sorted(lst)",
  "label": true  # true = desired, false = undesired
}

Strengths

Weaknesses

Method Selection Guide

GoalRecommended MethodData NeededComplexity
Basic task adaptationSFTInput-output pairsLow
Alignment with preferencesDPOPreference pairsMedium
Maximum alignment qualityRLHF (PPO)Preference pairsHigh
Stable alignmentGRPOPreference pairs + verifierMedium-high
Simple preference optimizationORPOPreference pairsLow-medium
Implicit feedbackKTOLabeled completionsMedium

Training Pipeline

Typical Production Pipeline

1. SFT (instruction tuning) → Base capable model
2. DPO (preference optimization) → Aligned model
3. GRPO (jailbreak resistance) → Safe model

Data Requirements

MethodData SizeData QualityCollection Effort
SFT1K-100K examplesHigh (accurate outputs)Medium
DPO1K-50K pairsHigh (clear preferences)High

Source excerpt truncated at 220 of 229 lines. Open the canonical wiki path above for the full page.

Relationships

Outbound links

Referenced by

Tags

ai-mlfine-tuningsftdporlhfgrpoorpokto