You have successfully completed the training loop and generated updated model weights. The next step is determining whether your small language model actually performs the required task correctly. A decreasing loss value during training indicates that the model is fitting the data. However, it does not guarantee that the generated text will be accurate, coherent, or useful in practice.
In this chapter, you will evaluate your fine-tuned model using both qualitative observation and quantitative measurements. You will start by examining text generation quality to see how the model responds to standard instruction prompts. From there, you will calculate standard natural language processing metrics to assign numerical scores to your model's performance. For instance, you will compute perplexity. If represents the number of tokens in a sequence, perplexity measures how well the model predicts that sample using the following formula:
You will also track metric scores like ROUGE to compare generated outputs against reference texts. We will test prompt generalization to ensure the model handles unfamiliar phrasing without breaking down. You will learn to identify signs of overfitting and catastrophic forgetting by comparing your fine-tuned outputs directly against the base model. Finally, you will write an automated evaluation script to process a holdout dataset. This gives you a repeatable method to benchmark your model before moving to the final deployment stage.
6.1 Evaluating Text Generation Quality
6.2 Quantitative Metrics for NLP Tasks
6.3 Testing Prompt Generalization
6.4 Identifying Overfitting in Generation
6.5 Hands-On Practical: Running Evaluation Scripts