Free self-study · No account needed · Progress stays in this browser. Back it up before clearing site data or changing devices.

← Week 6: Context Engineering

Week 06 / Lesson 2

Selecting useful evidence for context

Choose between complete documents, selected passages, and summaries for a task.

Section 2.1 1 of 7

Overview

Focus

Choose between complete documents, selected passages, and summaries for a task.

Your route through the lesson

  • 2.2 Full context versus selected evidence
  • 2.3 Relevance, dates, provenance, and duplicates
  • 2.4 Long-context failures and evidence ordering
  • 2.5 Put it into practice
  • 2.6 Guided comparison
  • 2.7 An outdated policy beside its replacement

All required teaching is included here. Review selections are saved. Choose a correct answer for every question to continue; retries are unlimited. Study time and personal notes are optional.

Section 2.2 2 of 7

Full context versus selected evidence

Focus

Choose complete context, selected passages, or summaries according to evidence needs.

Full-context loading places all available documents into the request when capacity permits. Selected evidence includes only passages relevant to the question. A summary compresses content into a shorter representation. Each choice changes what the model can inspect and which details may be lost.

For a small two-page policy with one exception, full text can preserve nuance and reduce retrieval omissions. For hundreds of documents under a narrow budget, selecting current relevant passages may be necessary. A summary can help orientation but can erase dates, exceptions, or uncertainty. It should not replace original evidence when a precise clause determines the answer.

Consider asking how long project blue retains cases. A current passage says ninety days generally and one hundred twenty for project blue. Selecting only the general sentence yields the wrong answer despite high topical relevance. The useful unit of evidence includes the applicable exception and its source. Retrieval quality therefore depends on sufficiency for the actual question, not just shared keywords or short length. Compare strategies on the same cases and record which source facts survive each construction.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A policy says 90 days generally and 120 for project blue. Which evidence is sufficient for project blue?
2. When might full-context loading be reasonable?
3. What is a key risk of a short summary used instead of a precise source clause?

Section 2.3 3 of 7

Relevance, dates, provenance, and duplicates

Focus

Select current applicable evidence with provenance and avoid duplicate-weighted conclusions.

Relevance asks whether evidence addresses the question. Applicability asks whether it governs this project, time, jurisdiction, or user. Provenance identifies where it came from and which version it represents. A highly relevant old policy can still be superseded, while a less general exception can be the controlling current rule.

The weekly documents contain old policy retained thirty days, replacement policy ninety days with a project-blue exception of one hundred twenty, and an irrelevant plant-care note. The correct answer names the replacement source and the applicable exception. Document order does not establish authority, and three duplicate copies of an old policy do not outweigh one authoritative replacement.

Use explicit effective dates and supersession relationships when available. If two current sources conflict and no precedence rule resolves them, preserve uncertainty rather than average their numbers. A source identifier in the answer lets a reviewer inspect the relevant clause. The selected packet should retain enough surrounding text to interpret conditions, not clip away words such as except, only, or unless merely to save budget. Those small words often carry the rule's actual scope.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. Three duplicates of an old thirty-day policy accompany one current 120-day exception. Project-blue answer?
2. Two current sources conflict without a precedence rule. What is supported?
3. Why preserve words such as except and unless in selected passages?

Section 2.4 4 of 7

Long-context failures and evidence ordering

Focus

Test evidence order and irrelevant content without overclaiming model attention results.

A model can miss relevant details even when they fit in context. Irrelevant material competes for processing, and evidence order can influence the produced answer. These are empirical questions for a particular model and task: measure actual responses rather than assuming a larger window guarantees useful attention.

A deterministic fixture can expose a simpler analogous failure. A first-match policy selector returns the first retention statement it sees. With the old policy first it reports thirty days; reversing order brings the current exception first and yields one hundred twenty. A selector using explicit supersession and effective version remains tied to the current source under both orders.

This measures the fixture's selection rule, not a model's attention. The script also counts characters removed by excluding irrelevant plant-care text, explicitly labeling those units. A real model study would send the same question and evidence in varied orders, retain raw outputs and sources, and compare correctness and token usage under fixed conditions. Keep that optional execution claim separate from the core deterministic demonstration so an order-sensitive rule is never mislabeled as a measured long-context model phenomenon.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A first-match fixture changes from 30 to 120 when document order reverses. What is demonstrated?
2. What should a real evidence-order experiment preserve across conditions?
3. A larger context window automatically guarantees every exception is used. Correct?

Section 2.5 5 of 7

Put it into practice

Focus

Run dated-policy selection and observe a controlled order-sensitive baseline.

Download week06.py, save it in an exercise folder, and run python week06.py --lesson 2. This single practice uses three synthetic documents and one policy question. It is standard-library, processor-only work and finishes within seconds. No model call or retrieval service is involved.

The selected source is new, containing ninety-day general retention and the project-blue exception of one hundred twenty. Its text fits an explicitly labeled 100-character fixture budget. The result includes project, retention_days, and source. A first-match helper is then tested on original and reversed document order. reversed returns an iterator in reverse order; list materializes it as a list. The baseline yields 30 then 120.

A second helper filters superseded and irrelevant records, then max chooses the greatest effective version. It selects new in both orders. The report gives removed irrelevant characters, baseline order outcomes, stable authoritative source, and model_order_effect='not measured'. PASS therefore establishes deterministic evidence handling and exposes a bad baseline. It does not claim real token budgeting or a live model's response to ordering; the previous lesson provides the separate actual-tokenizer path.

Download this week’s Python lab ↓

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. The authoritative helper selects new in both orders. What property passed?
2. The report counts irrelevant_characters_removed. What are the units?
3. Why include source=new beside retention_days=120?

Section 2.6 6 of 7

Guided comparison

Focus

Explain the current exception, irrelevant-text reduction, and baseline order failure.

The worked answer is one hundred twenty days for project blue. The replacement policy contains that exception, while the older thirty-day rule is marked superseded. The plant-care note contributes no retention evidence. Removing its thirty-two characters saves fixture space without removing any fact needed for the question.

The first-match baseline produces thirty days in original order because it stops at the old policy. Reversing the list places the irrelevant note first, which it skips, then the current policy, which supplies one hundred twenty. The difference reveals a selection mechanism that confuses position with authority. The authoritative helper filters and compares effective versions, so both orders select new.

The example deliberately distinguishes deterministic failure from a model behavior claim. It shows why evidence packets need provenance, currency, and scope before they reach a model. A live model could still ignore the exception even with the right packet, requiring separate output evaluation. A complete report can therefore say source selection passed and model answer generation not measured, rather than compressing all stages into a misleading end-to-end policy-answer score.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. Why does the first-match baseline report thirty days in original order?
2. Removing the plant-care note saves space while preserving which decisive fact?
3. Correct source selection proves a live model will use the exception. True?

Section 2.7 7 of 7

An outdated policy beside its replacement

Focus

Prefer an applicable replacement over an outdated policy even when the old document is longer.

A request asks for current project-red retention. Document P1, a lengthy older handbook, says sixty days. Document P2, a short replacement notice, says the new general period is ninety days and project red requires one hundred fifty. P2 explicitly supersedes P1. Loading both documents without precedence can leave the answer vulnerable to length or order effects.

The worked evidence packet keeps P2's effective date, supersession statement, general rule, and project-red exception. It returns one hundred fifty with source P2. P1 may remain as historical context if space permits, clearly labeled obsolete. It is not averaged with P2 and does not receive greater authority because it has more pages.

If P2's authenticity or applicability is uncertain, the answer should state that uncertainty rather than treating a short notice as automatically authoritative. The decision depends on trusted provenance and the actual supersession relationship. This transfer teaches selection as a small evidence argument: which source applies, which clause controls, and which uncertainty remains. A compact packet succeeds by preserving those relationships, not merely by reducing the number of words.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. P2 supersedes P1 and gives project red 150 days. Current answer?
2. How may obsolete P1 be retained if useful?
3. P2 authenticity is uncertain. What should the answer preserve?

Your personal notes

Optional, ungraded, and saved only in this browser. Export a backup from the Academy homepage to keep them.

References and further reading
Ask your own AI assistant

Copy this prompt into an assistant you already use. Nothing is sent automatically, and your personal notes are not included.

Next lesson: Compacting a conversation without losing decisions →