Let’s Get Certified
Module 04 / 14 · Claude models, prompting, and context engineering

Select a model and specify its job

Interpret a benchmark, repair an ambiguous prompt, and choose a prompting technique.

A publisher classifies incoming corrections and drafts replies. Only one in ten cases requires comparing conflicting sources. The team has measured three candidate tiers on representative requests.

2.1 · Select a model tier under constraints

CandidateCorrection accuracyp95 latencyCost per 1,000
Small90%0.7 s$2
Middle96%1.3 s$5
Large98%2.4 s$10

These are illustrative measurements. With a 95% quality floor, a 1.5-second p95 limit, and a $6 ceiling, only the middle tier is feasible. A routing design can send ambiguous items to a stronger tier, but evaluate the entire route, including misrouting and the tail latency of escalation.

Audit a two-tier router

In a replay of 1,000 corrections, 900 are routine and 100 require reconciling sources. A router escalates 80 of the difficult cases and 20 routine ones. The smaller tier gets 98% of routine and 55% of difficult cases right. The larger tier gets 99% and 95% respectively. Each case takes exactly one model call. Estimate accuracy if routed correctly according to this observed routing behavior. The editor requires 96% overall and 92% on difficult cases.

Compute both acceptance gates

The smaller tier handles 880 routine and 20 difficult cases. The larger tier handles 20 routine and 80 difficult cases. Expected correct answers are 862.4 + 11 + 19.8 + 76 = 969.2, about 96.9% overall. On difficult cases the expectation is 87 of 100. The router misses the difficult-case floor despite passing the aggregate. These are expected counts from measured rates, so confirm on held-out labeled cases.

Inspect the 20 missed escalations. A routing threshold change may recover them while increasing expensive calls. Benchmark the revised route against cost and measured end-to-end p95 before approval.

2.2 · Repair an underspecified system prompt

“Handle the correction professionally” leaves scope, evidence, and output undefined. A stronger contract says to classify the requested change, cite the supplied passage, mark evidence as missing when necessary, and return category, passage ID, and proposed reply. Define when a case should go to an editor. Leave the wording of a courteous reply flexible. A trusted application validates the output and handles approval to publish.

Write a contract for missing evidence

Input A supplies edition E4, passage 17, and a new printing date. Input B asks for the same change but omits its source. The current prompt returns polished replies claiming both changes were verified. Write the smallest instruction and output contract an editor could test against these inputs.

Inspect a candidate prompt and its tests

“Classify the requested correction using the supplied edition and passage. Return the category, cited passage ID, evidence status and a proposed reply. If the passage is absent or cannot support the change, set the status to needs review and leave the citation empty. Address the reader in your own words.” This defines behavior for missing inputs without fixing the wording of every reply.

For A, check that the returned ID exists in E4 and its text supports the date. For B, assert a null citation and a review status. Add a conflicting passage as a third fixture. A schema catches a missing field, while an evidence check catches an invented but well-formed ID.

Video background · freeCodeCamp at 10:38:02 · validating an extraction before retry

2.3 · Match prompting technique to the failure

Start with a zero-shot instruction and test it on unseen examples. If adjacent categories are confused, demonstrate contrasting few-shot cases with labels and short decision criteria. When consumers fail on formatting, constrain the output with a schema. For problems requiring several dependent comparisons, try native thinking or a higher reasoning effort on a model that supports it. Compare the gain against latency and token cost. Request verifiable evidence and a concise decision rationale as the visible output.

Choose an intervention from four failures

A baseline prompt handles routine edits. In an error sample, dates are confused with opinions, a downstream parser rejects trailing prose, some source passages are absent, and one decision requires reconciling three conflicting editions. Assign a separate intervention to each, then decide which changes deserve a model benchmark.

Match the treatment to the evidence

For the label confusion, give a small pair of contrasting labeled examples and measure fresh cases near that boundary. For the parser, use supported structured output and validate the returned object. For missing evidence, change retrieval or ask for the passage and permit abstention. More reasoning cannot reconstruct an absent document.

For the three-edition case, try a simple explicit comparison procedure first. Benchmark native thinking or a higher supported effort if dependent comparisons still fail. Grade cited revisions and the resulting decision, and compare latency and spend. Keep the original zero-shot path as the control for routine edits.

Design exercise

Twenty replies parse correctly, but corrections involving dates are repeatedly classified as changes of opinion. Add one paired boundary example and evaluate on fresh date-related cases. An output schema may still be useful for consumers, but it cannot define the difference between two valid labels.

Further reading · Claude model comparison and availability · Reasoning effort

Knowledge check

Select a model and specify its job quiz

Answer 9 questions. Check each answer for an explanation.