The Lawfare Academy

Lawfare Group → Knowledge Institute → Lawfare Academy

← AI 320 — Applied AI, Retrieval and Reliable Automation

Weeks 1–2

Choose the task before the tool

Learning objectives

  • Explain and trace the mechanisms in choose the task before the tool.
  • Apply the method to the worked example and changed-condition exercise.
  • Identify assumptions, failure cases and the evidence needed to justify a result.

An AI project begins with a task and a reason to use AI. Extracting an invoice total from a consistent structured record may be simpler and more reliable with ordinary parsing than with generative text. Drafting an explanation from varied documents may benefit from language generation, but requires evidence checks. Define inputs, desired output, failure costs and a non-AI baseline.

Separate assistance from action. A draft shown to a person has different consequences from a system that sends a message, changes a balance or deletes a record. Draw the workflow, identify irreversible transitions and decide where explicit approval belongs. An impressive demonstration does not establish error rates on ordinary, difficult and adversarial cases. Measure the work that follows the generated output, including verification and corrections.

Use a bounded initial scope. A support assistant for fictional maintenance policies can answer only from a versioned document set and abstain when no source supports a response. This is a testable contract. An instruction to answer anything confidently is not. Document who maintains sources, how changes are detected and how the system behaves when retrieval or generation is unavailable. A useful prototype can use deterministic retrieval and templated responses before integrating any paid model service.

Worked reasoning The routing function encodes a deliberate decomposition. It does not use a model where arithmetic or lookup is sufficient. The reviewed-draft route still needs source support and cannot imply permission to send the result. An unknown task triggers clarification rather than guessing an action with potentially different consequences.

Extended teaching and laboratory

An AI workflow is a sequence of decisions with different error costs and evidence needs. Exact arithmetic, permission checks and record identity should use deterministic mechanisms with explicit contracts. A language model may help draft or classify, but its output must enter a validation boundary before it controls an action. A polished sentence does not substitute for a verified source or authorization.

Define the task’s allowed outputs and an abstention route. A bounded assistant can decline when the requested evidence is missing. That is meaningful only if downstream code treats abstention differently from an empty but supposedly authoritative answer.

Worked problem A user asks for the total of three invoices, an explanation of a refund policy, and transmission of a refund request. Design three separate stages.

Step-by-step reasoning 1. Calculate the invoice total from validated structured amounts with ordinary arithmetic; a generated number is not needed.

  1. Retrieve the relevant policy version, check its applicability and draft an explanation tied to specific passages.
  1. Prepare a proposed refund request separately from sending it. Validate the payload and obtain the required authorization for the actual external action.
  1. If policy evidence is missing or contradictory, abstain or route to review. Do not turn a plausible draft into an approved transaction.

Apply the idea

A user asks for the total of three invoices, an explanation of a refund policy, and transmission of a refund request. Design three separate stages.

The draft is correct but the recipient changed after approval. Is sending still covered by the prior approval?

Read the worked reasoning

No. Approval must bind the consequential payload, including recipient and relevant amount or record identity. A changed recipient requires a fresh approval under the workflow’s policy. Content quality and action authorization are independent conditions.

Check understanding

When is generative AI least justified?

  1. For exact arithmetic over a well-defined structured table
    Feedback

    Deterministic calculation is a clearer baseline for exact totals.

  2. For every task involving words
    Feedback

    Many text tasks are conventional search or parsing problems.

  3. Whenever a human can read the result
    Feedback

    Human readability alone does not settle method choice.

Further reading

Study the complete on-site source sections below, then work the original example, changed-condition problem and transfer laboratory. Review CS50 AI Knowledge and Language and the evaluation sections of scikit-learn. Compare a deterministic rule, search and a language-model approach on the same task.

My learning →