liveBook · Manning

Input-output pair

As explained in Data Storytelling with Altair and AI

An input-output pair is a training example consisting of an input instruction or prompt and the corresponding desired model response.

An input-output pair is one training sample: a prompt that states the task and a completion that demonstrates the desired response. Fine-tuning uses many task-relevant pairs to steer a pretrained language model toward a particular domain, audience, scenario, or text type. section 7.4.1

Teach audience-specific titles

For a general-public title, pair “Generate a title for the general public about topic X” with “X revealed to you!” A model trained on similar pairs can produce a comparable title for a new topic, such as relativity. section 7.4.1

Table 7.2 The samples based on the information to convey
Information to Convey
Prompt
Completion a
Parts of a whole
Percentage of participants in the conference by type (researchers 5%, students 30%, professors 65%)
More professors participated in the conference (65%). Researchers were not interested in the event (5%).
Comparison among entities
Comparison between red (80%), yellow, and green performance
Compared to yellow and green, red experienced an improvement in performance of 80%.
Trend
Sales changed in the last 12 months (–12%), due to fewer subscribers and video views.
Over the last 12 months, sales decreased by 12% based on various metrics, including subscribers and video views.
Outcomes of a survey or a questionnaire
Questionnaire: 3 positive answers, 7 negative answers
Three out of 10 people answered the questionnaire with a positive answer.
Distribution
Sales of product A (+30%) and product B over the last 12 months
Compared to product B, sales of product A have increased by 30% over the last 12 months.
Spatial information
Sales in North Europe (+23%) compared to South Europe
Compared to South Europe, sales in North Europe increased by 23%.
Relationship
The sales trend line from 1990 to 2020 increased by 120%.
Between 1990 and 2020, sales increased by 120%.
Comparison among entities
Top ingredients for our recipe: sugar and salt
The chosen ingredients for our recipe are sugar and salt.
Comparison among entities
Comparison between gold (30), silver (20), and bronze (40)
Bronze beats silver and gold with 40.
Distribution
Distribution of household chores (cooking 35%, cleaning 30%, laundry 20%, and yard work 15%)
Cooking takes up the most significant portion at 35%. Cleaning follows at 30%, while laundry and yard work account for 20% and 15%, respectively.
a. The word completion may be confusing, but it is used by the OpenAI API. Completion refers to the output produced by the model.

Use paired samples to demonstrate how to turn data-storytelling inputs into concise commentary for patterns such as parts of a whole, comparisons, trends, surveys, and distributions. section 7.4.1

Specificity matters: separate datasets can target the general public, professionals, decision makers, particular products or topics, and outputs such as titles, annotations, or commentary. A JSONL sample can represent the behavior as system, user, and assistant messages. section 7.4.1 section 7.4.1

How Data Storytelling with Altair and AI covers it

How deep it goes
Defines pairs and contrasts manual construction with source-built datasets, without detailing training mechanics beyond API examples.
Examples
Shows a public-facing title pair and commentary samples for percentages, trends, surveys, and distributions.
What you can do after
Apply it via the OpenAI API by preparing prompt-completion samples for a fine-tuning dataset.
How it connects
Connects input-output pairs to fine-tuning, prompts, completions, JSONL, and data storytelling.

Related concepts

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