liveBook · Manning

Fine-tuning

As explained in Software Testing with Generative AI

Fine-tuning is the process of adapting a pretrained model to a task or domain by training it further on targeted data.

Fine-tuning adapts a pretrained, or foundational, model by training it further on targeted data. It can make responses more attuned to a domain, tone, detail level, or instruction pattern. section 10.2.2 section 12.1.1

A practical fine-tuning process includes:

  • Set a specific goal for the tuned model before choosing data or tools. section 12.1
  • Prepare relevant, well-formatted data; its size and quality strongly influence the result. section 12.2.1
  • Preprocess the data through tokenization, run the tuning session, and monitor measures such as loss and learning rate. section 12.2.4 section 12.3
  • Test the resulting model through automated inference or manual evaluation, then iterate on data, model, tooling, or hyperparameters. section 12.2.6 section 12.3

Domain-specific code assistant

A model can be tuned on the restful-booker-platform codebase so that questions about the project receive context-sensitive answers. Example training records pair instructions such as asking for a class declaration or a setup method with the expected code output. section 12.2 section 12.2.1

Figure 12.1 A visual representation of the different steps taken during fine-tuning

Use the process map to navigate goal setting, data preparation, processing, tuning, and testing as connected stages. section 12.1.1

Fine-tuning offers more model and framework control than RAG, but requires a steeper learning curve, more experimentation, and potentially substantial hardware, tooling, and talent costs. Combining both approaches increases complexity and debugging difficulty. section 10.2.3 section 10.2.4

How Software Testing with Generative AI covers it

How deep it goes
Explains goals, data preparation, tokenization, tuning, metrics, testing, and iteration, while deferring many implementation nuances.
Examples
Uses London travel responses, project-code instruction records, Axolotl commands, and loss and learning-rate logs.
What it assumes
Assumes familiarity with LLM prompting and context, while introducing fine-tuning terminology, data preparation, tools, and evaluation.
What you can do after
Operate/configure Axolotl to prepare data, run a LoRA fine-tune, and test the resulting domain-specific model.
How it connects
Connects fine-tuning with RAG, prompt engineering, tokenization, context windows, LoRA, and model evaluation.

Also explained in

Compare how 37 books explain fine-tuning →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Testing with Generative AI. The section links point to the parts of the book it draws on.