liveBook · Manning

Training dataset

As explained in Data Analysis with LLMs

Task-specific training data is a dataset of examples tailored to the task for which a model is being adapted.

A training dataset is a collection of task-specific examples used to adapt an existing model. For review classification, each example pairs a review with its desired label, such as neg. section 1.5.2

Fine-tuning data represents successful interactions: an input message followed by the output the model should produce. OpenAI chat models encode each interaction as a message history, with one Python dictionary per message. section 9.8

A practical preparation workflow includes:

  • Start with labeled examples, such as rows containing review text and sentiment labels. section 9.8
  • Convert each row into a messages object containing a user message and the desired assistant response. section 9.8
  • Write one interaction per line in JSON-lines format, commonly using the .jsonl suffix. section 9.8
  • Use enough examples to make adaptation useful; the demonstrated range is at least 50 and up to a few thousand samples. section 9.8

Review classification example

A review becomes a training interaction when its text is assigned the user role and its known sentiment, such as neg, is assigned the assistant role. A Python preparation script can read train_reviews.csv and produce train_reviews.jsonl.

How Data Analysis with LLMs covers it

How deep it goes
Defines examples, specifies message and JSONL formats, and demonstrates CSV conversion, stopping short of dataset quality evaluation.
Examples
Uses movie reviews paired with neg labels, train_reviews.csv, a Python conversion script, and train_reviews.jsonl.
What it assumes
Assumes labeled tabular examples and basic Python handling while demonstrating the required message structure and file transformation.
What you can do after
Operate/configure a fine-tuning workflow by converting labeled CSV rows into JSONL and submitting the resulting file.
How it connects
Connects labeled examples with fine-tuning, message histories, JSON Lines, sentiment classification, and base models.

Also explained in

Compare how 36 books explain training dataset →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Data Analysis with LLMs. The section links point to the parts of the book it draws on.