Suppose a library needs both an opening-time display and a friendly event announcement. Both involve text, but they have different requirements. The display must preserve an exact stored value. The announcement permits new wording while retaining supplied event facts. Choosing a language model for both just because both outputs contain words adds unnecessary ways to fail.
You will identify a task's input, required output and evidence of success, then choose a method. This is a written exercise; you need only the course orientation and the examples on this page. No model, installation or account is needed.
What is being generated?
Artificial intelligence (AI) is a broad term for systems carrying out tasks such as interpreting input and producing predictions or decisions. In machine learning, a model learns numerical settings from data rather than having every input-output relationship written as an explicit rule. Those learned numerical settings are its parameters.
Generative AI uses learned patterns to produce content such as a sequence of text, an image or audio. The supplied input that guides a generation is often called a prompt. New content can repeat familiar phrases or closely resemble examples; generation does not guarantee originality, truth or a useful result.
A language model models patterns in sequences of text units called tokens. Tokens can be word parts, punctuation or other units, depending on the tokenizer. Our causal language model predicts a next token from preceding tokens. Generating a longer answer repeats that prediction-and-selection process. Generation therefore uses prediction; they are not opposing kinds of AI. The later token lessons make this mechanism visible.
Large language model (LLM) describes a language model at substantial scale. There is no universal parameter-count boundary separating large from small. Parameter count measures learned numerical settings, not the number of facts in a database, and does not alone determine task quality. This course's small SmolLM2 checkpoint illustrates the mechanism; its performance does not stand in for the largest models. The model card (S03) describes the particular checkpoint and its limitations.
Four useful task descriptions
These descriptions focus on the required result. They can be combined in a single application, and do not imply that every task needs a different model.
Lookup or a fixed rule returns a stored value or an explicitly defined transformation. Returning a book's recorded loan period requires the exact value, units and correct record.
Retrieval returns existing material relevant to a request. Finding passages about accessible facilities requires relevance, provenance (where the text came from) and coverage of the question.
Classification chooses from a defined set of categories. Labelling a message as loans, events or accessibility requires clear category meanings and reviewed examples against which to check the labels.
Generation produces content whose wording or structure is constructed. Drafting a welcoming event announcement requires checks on supplied facts, unsupported additions, form and usefulness.
A fixed lookup can be ordinary application code, without machine learning.
A classifier may use explicit rules or learned patterns. For varied messages,
learned classification might handle wording that a simple keyword rule misses,
but you need representative labelled examples to evaluate that claim. If an
LLM emits the label events, the required task is still classification. The
architecture's ability to generate text does not change that acceptance rule.
Retrieval finds candidates; it does not establish that they are current or complete. If two opening-hours documents conflict, returning both is useful diagnosis, not permission to invent a compromise. Generation may turn selected evidence into prose, but it can omit or contradict that evidence. Keep those checks separate.
Work through a concrete choice
Here are all the facts for this example. They describe an invented library:
- The current Monday opening time is
09:00and closing time is17:00. - The borrowing period for books is
21 days. - A storytelling event is on Saturday at
11:00in the children's room.
For "Show Monday opening time in the timetable", the input is the current
schedule record and the required output is exactly 09:00. A lookup preserves
the value. If the interface requires 9 am, a defined formatting rule can
convert the representation. There is no benefit from allowing a model to
invent or paraphrase the time. If the record is missing, display that it is
unavailable or obtain the record; plausible wording cannot supply evidence.
For "Write one welcoming sentence announcing the event", the input is the event note, and the required output is a short invitation preserving Saturday, 11:00 and the children's room. One illustrative sentence is:
Join us for storytelling on Saturday at 11:00 in the children's room.
That sentence is illustrative, not a required model output. A fixed template could also meet this particular need. Generation becomes useful if varied wording, tone or a first draft matters enough to justify checking the result. For this example, an announcement adding "free refreshments" fails: the supplied facts never promised refreshments. Hallucination is commonly used for generated content that is fabricated or unsupported; fluent delivery does not supply the missing support.
For "Which document explains step-free entry?", choose retrieval over writing a new policy. The three facts above contain no such document. The correct next action is to obtain the facilities source or report that it is missing. A language model cannot establish the library's current facilities from these notes. A larger model does not change the absence of supplied evidence.
Notice the decision sequence: state the required output, locate its evidence, then ask whether producing new content adds value. This is more useful than beginning with a model name and searching for a reason to use it.
Text is one modality
A modality is a kind of information, such as text, image, audio or video. Generating a poster image creates visual content; synthesising speech produces audio from a supplied script. Video generation must also produce content over time. These tasks have different output checks: a poster's legibility is not the same requirement as speech intelligibility or consistency across frames.
Multimodal systems take in or produce more than one modality. Reading a photo of a sign and returning its text crosses image and text. This need not involve inventing new visual content. Recognising recorded speech as text is transcription; producing spoken audio from a script is speech synthesis. The input and required output distinguish these tasks more clearly than the label "AI audio".
Text generation often uses repeated next-token selection, but other generative families exist. Diffusion models learn to reverse a noise-adding process; generative adversarial networks (GANs) train a generator against a discriminator that distinguishes generated from training examples; variational autoencoders (VAEs) learn a probabilistic latent representation, an internal description used to produce outputs. These are recognition-level signposts here. The model-families lesson compares them more carefully. None is restricted to a single modality, and you do not need to implement them for this course's text exercises.
Make your own decision before the solution
Write a short row for each scenario below: inputs, required output, simplest suitable method, evidence of success and one failure to inspect. These are fictional written scenarios; use only the stated inputs. Do not infer extra facts about a real library.
- A display must show the supplied
21 daysbook-loan period. Staff want the value preserved, without creative wording. - Staff supply twenty facilities paragraphs with document IDs and ask which passages answer a visitor's question. They want the passages and IDs first.
- Reviewed messages have three defined labels:
loans,eventsandaccessibility. New messages need one of those labels or a staff review when the message does not fit. Wording varies widely. - An approved event script must be spoken aloud, with unchanged words. The system receives text and should produce understandable audio.
- Staff want three possible decorative poster illustrations from a short description. They will select one; no factual schedule is to be embedded into the generated illustration.
Then change scenario 1: staff now request a plain-language explanation combining loan and renewal policies, with the relevant document IDs. Explain which parts retrieval and generation might each contribute, and what would still need checking. No implementation is required yet.
Hint
Ask whether the output should be an exact value, existing evidence, a category or newly produced content. For the audio and image cases, name the input and output modality separately. A method label without a check does not show why it meets the requirement.
Answer and reasoning
- Use a lookup or fixed display rule. Input is the approved book-loan value;
output is
21 days. Compare exact value and units. A generatedthree weeksmay preserve the duration but still violate the requested display format;28 daysviolates the fact as well. - Use retrieval. Input is the identified corpus and visitor question; output is matching passages with IDs. Check that the returned text comes from the supplied documents and covers the question. Relevant-looking text with an invented ID fails provenance; missing a needed paragraph fails coverage.
- The task is classification. Compare a rule baseline with a learned classifier on reviewed examples before deciding whether learning helps with varied wording. Check category definitions, correct labels and the review path for out-of-scope messages. A fluent explanation without a permitted label does not meet the output requirement. An LLM could be one implementation, not evidence that generation is necessary.
- This is text-to-audio speech synthesis, a generative output task. Compare intelligibility and spoken words with the approved script; adding an event detail or dropping a time is a failure. It is not transcription, whose input would be recorded speech and output would be text.
- This is text-to-image generation. Inspect correspondence to the description and suitability of the selected illustration. Keep factual schedule text in a controlled layout rather than assuming a generated picture preserves it. No image model is installed in this written exercise.
In the changed scenario, retrieval locates the current loan and renewal policy passages. Generation may combine them into an explanation; a fixed template may still suffice for stable policies. In either case check that the required facts are present, the IDs exist and the statements follow from the cited text. A real ID attached to a false statement is not factual support. If a policy source is missing, obtain it or report the gap instead of filling it with a plausible guess.
Use those checks as feedback on your own rows. If you chose a more complex method, state the extra requirement it satisfies and how you would measure that benefit. A well-justified combined method is acceptable; the task is not to memorise one model name per scenario.
Carry the distinction forward
Keep your written decisions for comparison when the course adds retrieval and evaluation. Nothing was installed or created by this task. If you pause, resume from an unanswered scenario rather than needing a model session or repeating setup. Any disposable notes are yours to keep or remove.
The later practical workflow deliberately includes generation so you can inspect its behaviour. It will also retain a retrieval-only comparison, so you can ask whether generated wording adds value beyond showing evidence.
Sources and next reading
- Causal language modelling (S38) supports preceding-context next-token prediction; this lesson does not adopt its training tutorial.
- Selected model card (S03) states the small checkpoint's identity and limitations.
- Denoising Diffusion Probabilistic Models (S17), Generative Adversarial Networks (S18) and Auto-Encoding Variational Bayes (S19) introduce the model families named above. Their technical derivations are beyond this task-choice lesson.
For the course path and programming starting point, return to orientation.