

W18 / 2027-01-04 / 20 MIN / ENGLISH
Optional final written and oral rehearsal
Optional written/oral exam rehearsal. This does not add a weekly graded assignment. The exercise time is included in class practice, not added after the three-hour meeting.
Before you start
- Use a CPU runtime. Save a personal copy or open the downloaded notebook in Jupyter.
- Run the included complete walkthrough first. Read its setup, definitions, and checkpoints.
- Predict before running each exercise cell; then change only the requested factor.
- Keep your actual outputs, configuration, explanation, and limitation. Free tools are sufficient.
TASK 1 / PREDICT - RUN - EXPLAIN
Reconstruct the full attention operation
Predict scores, weights, and context before running. Explain why a key with raw score zero can still receive positive weight.
- Write your prediction in the notebook response field before running.
- Run the starter cell below after the worked walkthrough.
- Make the requested controlled change and record the configuration.
- Explain the mechanism using the actual output, not an invented result.
s_final=np.array([1.,0.,1.])/np.sqrt(2)
w_final=np.exp(s_final-s_final.max()); w_final/=w_final.sum()
v_final=np.array([[10.,0.],[0.,10.],[10.,10.]])
observations['task1']={'scores':s_final.tolist(),'weights':w_final.tolist(),'context':(w_final@v_final).tolist()}
print(observations['task1'])Self-check: The context is about [8.0222,5.9889]. Scores, normalized weights, and retrieved values are distinct objects.
TASK 2 / PREDICT - RUN - EXPLAIN
Explain a causal mask
Build a four-position causal mask. Explain which positions the final query may use and which positions the first query cannot use.
- Write your prediction in the notebook response field before running.
- Run the starter cell below after the worked walkthrough.
- Make the requested controlled change and record the configuration.
- Explain the mechanism using the actual output, not an invented result.
mask_final=np.tril(np.ones((4,4),dtype=bool))
weights_final=mask_final.astype(float)/mask_final.sum(axis=-1,keepdims=True)
observations['task2']={'allowed':mask_final.tolist(),'illustrative_uniform_weights':weights_final.tolist(),'row_sums':weights_final.sum(axis=-1).tolist()}
print(observations['task2'])Self-check: The first query can use only position 0; the last can use positions 0 through 3. These are illustrative weights, not a learned attention map.
TASK 3 / PREDICT - RUN - EXPLAIN
Defend a model versus an agent
Explain the roles of model, validator, tool, state, and stopping rule. Name one action that must require human approval.
- Write your prediction in the notebook response field before running.
- Run the starter cell below after the worked walkthrough.
- Make the requested controlled change and record the configuration.
- Explain the mechanism using the actual output, not an invented result.
observations['task3']={'components':['predictor','validator','permitted tool','state','step budget','human oversight'],'exercise_type':'optional examination rehearsal'}
print(observations['task3'])Self-check: A Transformer is a model component, not a complete permissioned agent. This practice does not change written/oral exam policy.
Completion checklist
- Three predictions and three explanations.
- One controlled change with its actual outcome.
- One limitation and a brief AI-use/checking disclosure, or "none".
- A downloaded W18-evidence.json, then a two-minute peer explain-back.
The notebook marks incomplete response records as drafts. Completing the fields is not proof that an explanation is correct.
The guided walkthroughs were previously executed. The new exercise extension cells have not yet been execution-tested for this revision. Agent exercises are deterministic simulations; no paid model or consequential external action is used.