Foundation Models: Tokens, Attention, And Generation · Lesson 18

How To Compare AI Models Fairly

Specify the system, expected behavior and factor under test before collecting outputs. Use the same relevant conditions for an isolated model comparison, record actual outcomes and limit the conclusion to the evidence.

Study And Save Progress

Watch The Lesson

8 min 25 sec

Read the video transcript

2 demonstrations produce different policy answers. 1 receives a short question; the other receives the policy and the relevant product facts. Has the 2nd model proved itself better? Before choosing, specify the system being compared, freeze the conditions, score the result and bound the conclusion.

We will first design this comparison on paper, with observed results left blank. A model call, if separately undertaken, must earn an interpretation rather than simply produce a response. Choose the access arrangement explicitly. A hosted API sends an application request to a provider-operated service.

Self-hosting runs an available model under the chosen infrastructure and its operating responsibilities. A managed endpoint can combine a selected model with provider operations. Licence rights, access, deployment control and cost remain separate questions; downloadable weights do not settle every permission or hardware requirement. For an API route,

the conceptual request includes an endpoint, authentication, model identifier, input or messages, generation limits and supported options. The response contains output and service-specific metadata. Exact fields depend on the current offering, so this is a conceptual packet rather than a universal runnable payload. A real implementation must keep

secret keys in an approved secret store or local environment, outside shared notebooks, readings and video frames. Now define the fictional task. The supplied policy says standard products may be returned within 30 days of delivery, while customized products are excluded unless defective. The product is customized,

nondefective and delivered 10 days ago. Under this evidence, the expected decision is no: the customization exclusion applies despite the short elapsed time. This expected answer is specified before any experiment, not reported as an observed model result. Configuration A receives only: Can I

return a product delivered 10 days ago? It lacks the policy, customization fact and defect status. Its appropriate expected behavior is to obtain the missing information or qualify the response. Configuration B receives the complete policy and facts. It has the evidence needed

for the defined no decision. Comparing these inputs tests context completeness. If the same weights are used, any observed improvement cannot by itself establish a better model checkpoint. To compare exact model versions, give both the same complete packet and scoring rule while recording

their required templates and other conditions. Keep the factor under test explicit. A system comparison may intentionally include different retrieval, tools or product controls, but label it accordingly. If several things change at once, their contributions are not isolated by the result. A dated primary evaluation example

is HELM, introduced in November 2022 and revised in October 2023. It standardized scenarios and adaptation conditions while measuring several dimensions rather than accuracy alone. That approach helps make comparisons and tradeoffs interpretable. Its historical model results do not rank today's offerings or replace

a test of this policy workflow. Write the experiment record before collecting outputs: date, exact model identifier, access path, full input and context, template, settings, output, usage, latency, errors and scoring rule. Repeat cases where supported under the stated budget. Keep observed output, usage, time and

scores blank until the test runs. A successful request demonstrates connectivity; task quality requires the expected-behavior comparison. Extend the policy packet in controlled ways. Move the relevant exclusion near the beginning, middle and end of a longer input with harmless distractors, recording the position change while retaining the substantive evidence.

Score decision and source support separately. Then require eligible, reason and policy_source fields. The eligible field must be a boolean under the supplied schema. A correctly typed true value still fails the nondefective-custom case; a correct prose answer can fail the required structure. The project will use 10 cases covering

extraction, missing or conflicting evidence, an exception, a calculation, long input, strict format, ambiguity, a local-language case where relevant and a harmless embedded source instruction. Define expected behavior first. Use an existing interface for a manual, harmless comparison if appropriate, or a small approved budget for an optional implementation.

Neither path requires a paid experiment to complete the paper-based learning task, and no call has been made for these examples. Pause at configurations A and B. A has the short return question only. B has the full policy, customized product, nondefective status and 10-day elapsed time. What is the expected behavior for each,

and what factor would this comparison test? Does it establish that B's underlying weights are better? A should obtain missing information or qualify its response. B should apply the customization exclusion and answer no under the supplied facts. The factor is the input

and evidence supplied to the system, not isolated model quality. Observed outputs and measured improvement remain unknown until a real comparison. A later exact-model comparison must hold the relevant packet and scoring conditions constant. Try a separate model-comparison plan for extracting a total from harmless sample records.

Version X receives retrieved supporting material and version Y receives only the record. Their outputs differ. Describe a corrected comparison that isolates the exact model version, and identify the measurements and observations that must be recorded rather than invented. Give both exact versions the same

task record, evidence packet and scoring rule, with their required formats and configurations documented. If retrieval is the factor being tested instead, use a retrieval-controlled design and label it a system-input comparison. Record outputs, correctness and source support, format, usage, latency and errors with repetitions where supported.

Leave observations blank until performed; a completed request alone does not decide the winner. Before moving on, pause and trace a single call from input text through tokenization, embeddings and position, transformer blocks, vocabulary scores, decoding, output and validation. Add where retrieval, application memory and tools enter, and identify what authorizes an action.

Use the worksheet to explain the connections instead of writing only a list of component names. The application assembles authorized input, including any retrieved or remembered material, and the tokenizer produces the model's units. Input representations and learned blocks produce hidden states; the output projection

and decoding rule produce selected tokens. Validation checks format and task evidence. Tools operate through the application's defined boundary, and action permission remains an application control. Ordinary input conditioning does not perform the training update that created the weights. You can now explain a model call and design a comparison with the factor,

expected behavior and evidence limits visible. Report only what the recorded cases support; a paper plan supplies no measured winner. This completes our text-model foundation: representation, learned transformation, prediction, generation and controlled application use. The next course extends the mental model to other modalities and generation families,

where the input representations and output processes need their own explanation.

Main Point

Specify the system, expected behavior and factor under test before collecting outputs. Use the same relevant conditions for an isolated model comparison, record actual outcomes and limit the conclusion to the evidence.

Key Points

1. Choose and record access

A hosted API reaches a provider-operated service. Self-hosting uses an available model under chosen infrastructure and operating responsibilities. A managed endpoint may combine selected models with provider operations.

Check the actual licence, rights, hardware, data handling and costs. A downloadable checkpoint does not settle every deployment decision. A conceptual request includes endpoint, authentication, exact model, input/messages, limits and supported options; its response includes output and offering-specific metadata. Consult current official documentation when a real implementation is selected.

Never place real secret keys in a shared notebook, PDF, lesson or video. A real implementation can use an approved secret store or local environment. No actual credential or runnable provider payload is supplied here.

2. Specify the fictional policy case

Supplied policy: “Standard products may be returned within 30 days of delivery. Customized products are excluded unless defective.” The complete facts are a customized, nondefective product delivered 10 days ago.

ConfigurationSupplied inputExpected behavior before a run
A“Can I return a product delivered 10 days ago?”Obtain missing facts/policy or qualify the response
BFull policy and complete product factsAnswer no and explain the customization exclusion

These are expected behaviors, not observed results. The expected behaviors are specified; actual outputs and any improvement remain unknown until recorded.

A/B changes context completeness. If the same checkpoint is used, this design cannot establish that B has better underlying weights.

3. Freeze the factor under test

For an exact model comparison, supply both versions with the same complete case packet and scoring rule. Document required templates and relevant settings. A system comparison can intentionally vary retrieval or tools, but name those differences and limit the claim accordingly.

HELM, introduced in November 2022 and revised October 2023, is a historical primary example of standardized scenarios/adaptation conditions and multiple measurement dimensions. This method helps expose tradeoffs; its old model results do not rank current offerings.

4. Prepare the experiment record

Record before a runObserved fields: leave blank until measured
Date/plan ID; exact model and accessActual run date and returned identity/metadata
Full input/context; template and settingsOutput and any error
Expected behavior and scoring ruleCorrectness, source support, format score
Repetition/budget planMeasured usage, latency and resource cost

Record what the interface actually exposes. If exact backend identity or settings are unavailable, mark the limitation rather than invent them. Repetitions can reveal variability. A successful request establishes connectivity; the scoring rule tests the task.

5. Add controlled variants

Move the policy exclusion near the beginning, middle and end of a longer packet with harmless distractors, recording the position change while preserving substantive evidence. This tests position/context use; it is not identical input bytes.

Require fields `eligible`, `reason` and `policy_source`. Under the supplied schema `eligible` must be a boolean. A boolean `true` can pass that type requirement while failing this customized/nondefective case. A correct prose answer can fail the required structure. Score these outcomes separately.

Keep the 3-position attention arithmetic from L06 separate: those classroom vectors are not a measured internal representation of this policy.

6. Use an appropriate learning route

Plan 10 cases: simple extraction, missing evidence, conflicting evidence, an exception, calculation, long input, strict format, ambiguity, a local-language case where relevant, and a harmless embedded source instruction. Specify expected behavior first.

The paper plan needs no paid call. A harmless manual-interface comparison may be appropriate; optional API/local implementation requires its own approved budget, data and current setup. No experiment is performed in this lesson.

7. Close the complete mental model

Trace authorized input → tokens → embeddings/position → learned blocks → vocabulary scores → decoding → output → validation. Retrieval, memory and tools enter through the application’s defined boundary. Any action needs permission and applicable evidence; ordinary input conditioning does not retrain weights.

A valid conclusion describes the tested cases and recorded conditions. Until observations exist, report only the plan and expected behavior. This completes the text-model foundation before the next course extends representations and generation across modalities.

8. Learning Checks

Attempt each question and whole-call trace before opening its explanation. The worksheet provides separate blank records.

M14-L18-Q01

Fictional policy: standard products may be returned within 30 days; customized products are excluded unless defective. The actual product is customized, nondefective and delivered 10 days ago. A receives only “Can I return a product delivered 10 days ago?” B receives the complete policy and facts. Give expected behavior for A and B, identify the comparison factor, and say whether it establishes superior B model weights.

Your explanation/plan: ____________________

Show explanation after your attempt

A lacks the policy and relevant product facts, so expected behavior is to obtain missing information or qualify the answer. B can apply the supplied customization exclusion and answer no. This compares input/evidence completeness, not isolated underlying model weights. Expected behavior is specified; observed outputs and improvement are unknown until testing. An exact model-version comparison needs the same relevant packet and scoring conditions.

M14-L18-P01

In a harmless total-extraction comparison, exact model X receives retrieved supporting material and exact model Y receives only the record. Outputs differ. Redesign the comparison to isolate model version, and specify recorded outcomes without inventing results.

Your explanation/plan: ____________________

Show explanation after your attempt

Give both exact versions the same task record, evidence and scoring rule, documenting required templates and relevant settings. If retrieval is intentionally the factor, instead use a retrieval-controlled design and label the claim a system-input comparison. Record output, correctness/source support, format, usage, latency and errors, with repetitions where supported. Leave measured values blank before testing. Successful connectivity does not establish a task winner.

M14-L18-P02

Explain 1 call from text through tokenizer, embeddings/position, transformer blocks, vocabulary scores, decoding, output and validation. Locate retrieval, application memory and tools, and identify what authorizes an action.

Your explanation/plan: ____________________

Show explanation after your attempt

The application assembles authorized instructions and input, including any selected retrieved or application-memory content. The tokenizer converts that input to model units; embeddings and position provide representations. Learned transformer blocks produce hidden states, and an output projection produces vocabulary scores. Decoding selects tokens to form the output. Validation checks format and task evidence before a result is used. Tools supply results through the application’s defined protocol; actions require application permission and applicable evidence. Ordinary context conditioning does not perform the parameter-training update.

Sources

Learner Materials

Download Lesson 18 Learner Materials

Use the supplied fictional cases and templates for practice.

Practice

Write your answer, compare it with the model answer and decide what to revisit. These written checkpoints are self-assessed.

Fictional policy: standard products may be returned within 30 days; customized products are excluded unless defective. The actual product is customized, nondefective and delivered 10 days ago. A receives only “Can I return a product delivered 10 days ago?” B receives the complete policy and facts. Give expected behavior for A and B, identify the comparison factor, and say whether it establishes superior B model weights. Your explanation/plan: ____________________

Show The Model Answer

A lacks the policy and relevant product facts, so expected behavior is to obtain missing information or qualify the answer. B can apply the supplied customization exclusion and answer no. This compares input/evidence completeness, not isolated underlying model weights. Expected behavior is specified; observed outputs and improvement are unknown until testing. An exact model-version comparison needs the same relevant packet and scoring conditions.

Compare your reasoning with the model answer. These written checks are self-assessed.

In a harmless total-extraction comparison, exact model X receives retrieved supporting material and exact model Y receives only the record. Outputs differ. Redesign the comparison to isolate model version, and specify recorded outcomes without inventing results. Your explanation/plan: ____________________

Show The Model Answer

Give both exact versions the same task record, evidence and scoring rule, documenting required templates and relevant settings. If retrieval is intentionally the factor, instead use a retrieval-controlled design and label the claim a system-input comparison. Record output, correctness/source support, format, usage, latency and errors, with repetitions where supported. Leave measured values blank before testing. Successful connectivity does not establish a task winner.

Compare your reasoning with the model answer. These written checks are self-assessed.

Explain 1 call from text through tokenizer, embeddings/position, transformer blocks, vocabulary scores, decoding, output and validation. Locate retrieval, application memory and tools, and identify what authorizes an action. Your explanation/plan: ____________________

Show The Model Answer

The application assembles authorized instructions and input, including any selected retrieved or application-memory content. The tokenizer converts that input to model units; embeddings and position provide representations. Learned transformer blocks produce hidden states, and an output projection produces vocabulary scores. Decoding selects tokens to form the output. Validation checks format and task evidence before a result is used. Tools supply results through the application’s defined protocol; actions require application permission and applicable evidence. Ordinary context conditioning does not perform the parameter-training update.

Compare your reasoning with the model answer. These written checks are self-assessed.

Open Practice And Save Your Work