Delivered architecture / 05
Online retailer · Large marketplace operator

Intelligent Supplier Contract Anomaly Detection

A retrieval pipeline that compares every incoming supplier document against the clauses of the contract that governs it, with supplier-controlled text kept out of the instruction context and output locked to a strict anomaly schema.

A large marketplace operator held thousands of active supplier contracts governing pricing terms, exclusivity clauses, volume commitments, and rebate structures. Nobody could cross-reference every invoice line against the applicable contract terms at human speed.

Invoices carrying pricing violations, or terms inconsistent with the governing contract, were approved simply because no one caught them in time. Semantic clause-level comparison across thousands of contract permutations is structurally impossible without AI.

In productionAzureAzure OpenAIDocument IntelligenceAzure AI SearchRAGSchema-constrained output
Cloud
Azure, fully cloud-native
Pattern
RAG clause-level comparison
Model
Azure OpenAI GPT-4o
Network path
Private endpoints, no public egress
The pipeline / End to end

How the system actually runs.

Each stage below is a real component in the deployed pipeline. Stages outlined in teal are control points: the places where the architecture constrains what the model can receive or emit.

01 · Ingest
Supplier document arrives
Invoice, pricing update, or contract amendment
02 · Orchestrate
Azure Functions
Serverless routing through the pipeline
03 · Extract
Document Intelligence
Structured paragraph-level content
04 · Classify
Semantic role classifier
Supplier text kept out of instruction context
05 · Retrieve
Azure AI Search
Top matching contract clauses per chunk
06 · Compare
Azure OpenAI GPT-4o
Clause-level comparison against contract terms
07 · Emit
Strict JSON anomaly report
Type, severity, clause reference, explanation
Services / The stack

What it runs on.

Azure Document Intelligence

Structured extraction from supplier invoices, pricing update submissions, and contract amendments at ingestion time.

Azure AI Search

Vector store for embedded contract sections and submitted document chunks. Powers the RAG retrieval layer.

Azure OpenAI, GPT-4o

RAG pipeline performing clause-level comparison between submitted document content and stored contract terms, producing structured anomaly reports.

Azure Functions

Serverless orchestration routing incoming supplier documents through extraction, embedding, and analysis in sequence.

Azure Storage, separate accounts per data type

Supplier documents and contract data stored in isolated accounts with distinct RBAC assignments.

Azure Private Endpoints

All Azure OpenAI calls route through private endpoints. No public internet egress from the pipeline at any stage.

Build-out / Architecture

How it is wired.

  1. Fully cloud-native on Azure with no on-premises footprint.
  2. Incoming supplier documents trigger an Azure Function, and Azure Document Intelligence extracts structured paragraph-level content.
  3. Extracted chunks are embedded and stored in Azure AI Search alongside embeddings of the relevant contract sections.
  4. The RAG pipeline retrieves the top matching contract clauses for each document chunk and passes them to GPT-4o for clause-level comparison.
  5. GPT-4o output is constrained to a strict JSON schema: anomaly type, severity, affected clause reference, and plain-English explanation.
  6. Procurement reviewers act on the structured anomaly report before approving any supplier payment.
  7. Supplier documents and contract data live in entirely separate Azure Storage accounts with distinct access controls.
Guardrails / Safety

What keeps it inside its contract.

Guardrails were designed in from the start, not added after the fact. Where the system touches untrusted input, a control sits between that input and the model.

Risks / Open

What we still track.

No production AI system is finished. These are the live risks carried by this architecture, documented for the operating team rather than buried.

Outcomes / Post-deployment

What changed.

On numbers. Client identity and any identifying detail are withheld under NDA. Outcomes are stated as direction and materiality rather than as figures we are not free to publish.

Have a problem that rules cannot solve?

Most engagements start with a short, paid R&D sprint so both sides can decide if it is a fit. If we are not the right call, we will say so early.

Start a conversation