Macalinao StudioLearnAll enriched lessons ↗
College path · 7 sectionsSwitch to high school ↗

College / LONGER LESSON 27

Chat interfaces: make context and actions understandable

Design a conversation that exposes its limits and preserves user control.

Preparation: Token budgets and basic interaction design.

Plan 20–35 minutes with the activities; this is a study estimate, not a timed requirement. Both paths have complete narration. Your notes and progress are kept separately for each level.

Section 01 / 07

Messages become model input

College path. Design a conversation that exposes its limits and preserves user control.

Preparation: Token budgets and basic interaction design. Work through one section at a time. Predict the experiment result before changing its controls, then explain what the example leaves out.

A chat interface stores structured roles and content, then serializes them using a model-compatible template. The displayed bubbles are not necessarily the exact text the model receives. Chat templates define control tokens and formatting. Using the wrong template or duplicating special tokens can degrade behavior even with correct weights and tokenizer.

Worked step 1. Inspect a system, user and assistant message.

Worked step 2. Apply the intended template.

Worked step 3. Check role boundaries and generation prefix.

Try it yourself. Are role labels merely decorative UI text?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. No. Their serialization can affect model behavior and instruction interpretation.

Section 02 / 07

Budget the whole conversation

Context must accommodate instructions, history, evidence and any reserved output. A visible conversation can be longer than the portion supplied to the model. Count serialized tokens using the actual tokenizer. Truncation and summarization policies can discard constraints or introduce errors; expose meaningful context limits to the user.

available = capacity − instructions − history − evidence

Worked step 1. Budget is 8192 tokens.

Worked step 2. Instructions use 1000, history 2000 and evidence 3000.

Worked step 3. Remaining capacity is 2192 before other overhead.

Try it yourself. Can the interface promise unlimited memory from this budget?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. No. Persistent storage and the active model context are different things.

Section 03 / 07

Streaming needs a clear state

Text can arrive gradually while the answer is still incomplete. Distinguish generating, waiting for a tool, completed and failed states so users know what can be trusted or interrupted. Stream events need stable message IDs and explicit completion or error handling. Preserve partial output appropriately, avoid duplicate retries, and announce updates accessibly without excessive interruptions.

Worked step 1. Start a response.

Worked step 2. Pause the network midstream.

Worked step 3. Show a recoverable incomplete state rather than a false completion.

Try it yourself. Should a stalled spinner imply work definitely continues?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. No. Timeouts and retry controls should communicate uncertainty and preserve the user’s input.

Section 04 / 07

Tool actions need their own permissions

Generating a suggestion and executing an external action have different consequences. Show what an action will do and apply the relevant authorization before execution. Separate proposed tool calls from execution results, validate arguments and scope permissions. A model-generated confirmation sentence is not itself proof that the action was authorized or completed.

Worked step 1. Show recipient and message preview for a send action.

Worked step 2. Obtain required authorization.

Worked step 3. Display the actual result after execution.

Try it yourself. Can a tool result be invented to make the conversation feel smooth?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. No. Report the real outcome, including errors or unknown status.

Section 05 / 07

Attach evidence to claims

Citations should lead to supporting material and remain associated with the claims they support. A list of links at the bottom can conceal unsupported statements. Validate source identifiers and access permissions. Generated citation strings are not reliable evidence unless resolved to retrieved sources; distinguish quoted text from paraphrase and inference.

Worked step 1. Choose one factual sentence.

Worked step 2. Open its cited source.

Worked step 3. Check whether the source supports the complete sentence.

Try it yourself. Does a working URL alone validate the claim?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. No. Availability and substantive support are separate checks.

Section 06 / 07

Include keyboard, motion and failure paths

A modern interface should work for people who type, zoom, reduce motion or temporarily lose connectivity. Preserve their draft and give clear recovery controls. Check focus order, dialog dismissal, accessible names, contrast, reduced-motion behavior and overflow. Automated checks help but do not replace physical-device or assistive-technology testing.

Worked step 1. Navigate by keyboard.

Worked step 2. Enlarge text and switch views.

Worked step 3. Interrupt a request and verify the draft survives.

Try it yourself. Is a desktop screenshot sufficient accessibility evidence?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. No. Interaction, semantics and recovery behavior require additional checks.

Section 07 / 07

Mastery and transfer

Bring the pieces together. First answer the checkpoint without the worked solutions. Then explain the mechanism in your own words, using one numerical example from this lesson.

A completed-looking chat bubble proves… Option 1: A tool action succeeded. Option 2: Nothing about an external action without its real result. Option 3: The whole history reached the model.

Pause here and choose an answer before continuing. The checkpoint explanation follows.

Reveal worked solution

The correct choice is option 2: Nothing about an external action without its real result. The interface must distinguish generated text, execution and verified outcomes.

Transfer task. Change one assumption in the worked example. State your prediction, calculate or test it in Workbench, then explain whether the result supports your prediction.

Reveal worked solution

Self-check rubric. Name the changed assumption, keep the other inputs fixed, show at least one intermediate calculation, and distinguish what the toy example guarantees from what would require a trained model or a real measurement.

MODERN MODEL CASE STUDY

DeepSeek V4.1 Flash: where this idea goes next

Test long-context retrieval and cache-resumption boundaries. Follow the worked examples, then evaluate the reported gains and their limits.

Open the college case study →

Added October 21, 2026. This optional extension has its own complete local narration.

LONGER INFERENCE LESSONS

Follow the mechanism in depth

Worked examples, local narration and connected learning modes at your level.

LONGER ATTENTION LESSONS

Follow the mechanism in depth

Worked examples, local narration and connected learning modes at your level.

Sources and scope

Original worked examples and teaching text, grounded in these primary references. Numerical fixtures explain mechanisms; model quality and hardware performance require separate measurements. Both levels share key examples, with different explanations and checkpoints.

Reset this college path?

This removes only this path’s notes, progress and experiments from this browser.