Forward Pass During Fine-Tuning
What you'll learn: How input sequences flow through the pretrained model to produce predictions during the fine-tuning forward pass.
The Core Idea
When you fine-tune an LLM, the forward pass is mechanically identical to pretraining—but conceptually different. Your task-specific input (a prompt, instruction, or labeled example) flows through every layer of the pretrained model exactly as before: through embeddings, attention layers, feedforward networks, and normalization. The model's billions of parameters process your input to generate predictions, just like during pretraining.
The key difference? The input format and output interpretation are now task-specific. Instead of generic web text, you might feed instruction-answer pairs, classification prompts, or domain-specific documents. The model's output—whether logits for next-token prediction or hidden states for classification—is compared against your fine-tuning labels to compute loss.
Why This Matters
During full fine-tuning, all parameters remain active and differentiable throughout the forward pass. This means:
- Every transformer block processes your input with its current (initially pretrained) weights
- The causal attention mechanism still applies masking and position encodings (RoPE or ALiBi)
- KV cache isn't typically used during training (only inference)
- The final unembedding layer projects hidden states to vocabulary logits
Think of it like running a dress rehearsal with the same actors (parameters) on a new script (your fine-tuning data). The performance machinery is unchanged; only the material being performed differs.
The forward pass outputs flow into your loss function, which measures how well the pretrained model handles your specific task—before any weights update via backpropagation.
Key Takeaway: The forward pass during fine-tuning uses the exact same architecture and mechanisms as pretraining, but processes task-specific inputs to produce predictions that will guide parameter updates.