16. Instruct vs Base Models
Base models and instruct models serve different purposes. Understanding when to use each helps you select the right model variant.
What base models are:
Base models (also called "pretrained" or "raw") are trained on text completion. Given "The capital of France is", they continue the sequence with high probability next tokens.
# Base model behavior
prompt = "The capital of France is"
response = base_model.complete(prompt)
# Output: "Paris, located in the Ile-de-France region..."
Base models are useful for:
- Code completion (fill in the middle)
- Text continuation with specific style
- Fine-tuning on your own data
What instruct models are:
Instruct models are fine-tuned to follow instructions. Given the same prompt, they respond differently:
# Instruct model behavior
prompt = "The capital of France is"
response = instruct_model.generate(prompt)
# Output: "The capital of France is Paris."
Training methodology difference:
# Base model training: Next token prediction
# Document: "The capital of France is Paris."
# Target: "capital of France is Paris."
# Instruct fine-tuning: Instruction-response pairs
# Input: "What is the capital of France?"
# Target: "Paris."
The spectrum:
Not all models fit binary categories:
- Base only: No instruction tuning (Llama base)
- SFT (Supervised Fine-Tuned): Trained on instruction pairs
- RLHF-tuned: Further tuned with reinforcement learning
- DPO-tuned: Direct Preference Optimization
- Chat-tuned: System prompt optimized with personality
When to use base models:
- You are fine-tuning on your own data
- You need code completion (fill in the middle)
- You want maximum control over generation behavior
- You are building a custom system with your own prompting
When to use instruct models:
- Direct user interaction
- Standard chat interfaces
- When you lack fine-tuning infrastructure
- When you want predictable instruction following
Conversion possibility:
You can turn a base model into an instruct-like model with strong prompting:
system_prompt = """You are a helpful assistant. Answer questions directly.
If you need to reason through something, show your thinking step by step.
Format answers clearly with bullet points or numbered lists as appropriate."""
def query_base_as_instruct(base_model, question, system_prompt):
full_prompt = f"{system_prompt}\
\
Question: {question}\
Answer:"
return base_model.generate(full_prompt)
This works for some tasks but cannot fully replicate fine-tuned instruction following.
Take a base model and create a system prompt that makes it behave like an instruct model. Compare responses to the same query with the actual instruct version of that model.