Engineering 10 min

Clause extraction: why span labelling beats asking a model nicely

Written by

Akash Kurup

Prompt-only clause extraction fails on real-world contracts because of document length, varied formatting, and lack of provenance. Span labelling identifies specific text ranges, provides evidence, and enables robust review workflows.

The prompt-only approach and where it stops

Extracting a termination notice period with a prompt is a one-line problem on a clean two-page agreement. Real estates are not clean. A master services agreement of eighty pages, an amendment that changes one number, a side letter that overrides both, a scanned counterpart with a handwritten margin note, and a definitions section that redefines "Business Day" in a way that changes what a notice period means.

Three things break at that point. Long documents exceed the window or bury the relevant text among near-duplicates. The output is a string with no provenance, so nobody can check it. And the same clause phrased differently across counterparties produces inconsistent output with no way to notice.

Extraction as span labelling

We treat it as a span problem: identify the character range in the source document that constitutes the term, then normalise that span into a typed value. The span is the evidence and it is retained.

{
  "field": "termination_notice",
  "value": { "days": 90, "basis": "calendar" },
  "span": { "doc_id": "MSA-0412", "page": 34, "start": 1180, "end": 1268 },
  "text": "...upon not less than ninety (90) calendar days prior written notice...",
  "confidence": 0.94,
  "depends_on": ["definitions:Business Day"]
}

Every consequence of this shape is practical. A reviewer clicks the value and lands on the sentence. A disagreement is settled by reading the span. Re-running an improved model against an existing corpus produces a diff of spans, which is reviewable, rather than a diff of strings, which is not.

The document is a graph, not a sequence

The largest single accuracy gain did not come from a better extractor. It came from resolving the document graph before extraction.

  • Definitions. A defined term changes meaning inside the agreement that defines it. "Business Day" excluding local public holidays changes a notice deadline by days.
  • Amendment chains. The operative value lives in the most recent instrument that touches it. Extracting from the original MSA gives a confidently wrong answer.
  • Incorporation by reference. Schedules and exhibits carry terms the body only points at.
  • Side letters. Especially in financial services, a side letter silently overrides the standard form for one counterparty, and a most-favoured-nation clause propagates it to others.

We resolve this chain first and extract against the effective document. Skipping this step produces extraction that is accurate against the text and wrong about the obligation, which is the worst outcome available because it looks correct.

Calibration decides the workflow

A confidence score is only useful if it is calibrated. We evaluate reliability directly: of the extractions asserted at 0.9, are roughly 90 per cent correct? Uncalibrated scores are worse than none, because a review queue built on them silently lets errors through.

With calibration in place the workflow becomes simple. High confidence with a resolved dependency chain posts automatically. Anything below the threshold, anything with an unresolved reference and every extraction on a document type seen fewer than a set number of times goes to human review, and those decisions become training data.

What we measure

  • Span exact and overlap match against a reviewed gold set, tracked per clause type. Aggregate numbers conceal that indemnity extraction is far harder than a notice period.
  • Effective-value accuracy after the amendment chain is applied. This is the number that matters and it is always lower than raw extraction accuracy.
  • Reliability of the confidence estimate.
  • Review queue precision. If reviewers routinely agree with the machine, the threshold is too conservative and the queue is wasting expensive attention.

The general point

The interesting engineering in document AI is rarely in the extraction step. It is in deciding what the effective document is, and in keeping the evidence attached so a human can disagree with the machine cheaply.

Frequently asked questions

Why does prompt-only clause extraction fail on real-world contracts?

Prompt-only extraction struggles with real-world contracts due to their length, varied formatting, and lack of provenance. Long documents can exceed processing limits or hide relevant text among near-duplicates. The output is a simple string without supporting evidence, making it difficult to verify. Inconsistent phrasing across documents also leads to unreliable results.

How does span labelling improve clause extraction?

Span labelling identifies specific character ranges within a document that constitute a term, then normalises that span into a typed value. This span is retained as evidence, allowing reviewers to verify the extraction directly in the source text. This approach facilitates robust review workflows and enables effective comparison of model improvements.

What is the importance of the document graph in clause extraction?

The document graph refers to critical dependencies like definitions, amendment chains, and side letters that affect a document's true meaning. Resolving this graph before extraction ensures that the process operates on the effective document. This prevents accurate text extraction from leading to incorrect obligations, which is the worst outcome.

How does AKINO Labs ensure the reliability of its clause extraction?

AKINO Labs ensures reliability by calibrating confidence scores, meaning a 90 per cent confidence assertion is roughly 90 per cent correct. This calibration drives a workflow where high-confidence extractions post automatically. Lower confidence or unresolved references are sent for human review, which then serves as valuable training data.

Sources and further reading

  1. CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review. Hendrycks et al., NeurIPS 2021. Frames contract review as highlighting spans of text: 510 contracts, over 13,000 expert annotations across 41 clause types, renewal term and notice period among them.
  2. On Calibration of Modern Neural Networks. Guo et al., ICML 2017. Shows modern neural networks are often over-confident, and that a single learned temperature largely corrects their confidence scores.

0 comments

2000 characters left

Loading comments
Buy what exists. Build what doesn't.

Want this applied to your own operation?

A working session on your own estate, with a prioritised view of what to build, what to buy and what to leave alone.

Or speak to us directly
Kinjal DesaiFarhad WadiaHemang ShahMonesh ShahaniHeld by a principal. We respond within one business day.