Capstone Summary

Off the cloud: Local artificial intelligence for maritime contract intelligence

The SCM capstone project From Unstructured PDF Files to Contract Intelligence: A Local LLM RAG Pipeline for Extracting Demurrage Terms and Conditions, was authored by Stephen Day III and Wathila Ekanayake and supervised by Dr. Elena Dugundji (elenna_d@mit.edu). For more information on this project, please contact the capstone supervisor.

Our project tackled a critical bottleneck in maritime shipping: the inability to rapidly evaluate and negotiate incoming shipping contracts. We focused our proof of concept on the largest cost driver in these agreements: demurrage. In the oil, gas, and chemicals industry, profit lives in the margin between commodity prices and operational efficiency. Few costs erode that margin faster than demurrage, which is the penalty charged when loading or unloading a vessel runs past the allowed time. The terms governing these penalties, including laytime rules and exceptions, are buried in dense maritime charter agreements that routinely run 40 to 60 pages in length.

Our sponsor, a large energy company, signs thousands of these shipping agreements annually. Reconciling a single proposed voyage to understand demurrage exposure often takes an analyst up to six hours of reading redlined legal language and cross-referencing conflicting terms. Our tool revolutionizes this deal desk workflow. It uses semantic AI to let analysts instantly audit incoming, unsigned agreements against baseline templates. Because these maritime contracts are highly confidential, we had one hard constraint: the entire system had to run locally.

The cost of slow evaluations

A single voyage is governed by a hierarchy of documents. The Charter Party is the foundational template of standardized terms. The Recap is the authoritative record of what was negotiated and overrides any conflicting language elsewhere. Riders and addendums layer in further amendments.

When it takes hours to manually reconcile this complex legal hierarchy, discrepancies are usually caught only after the vessel has sailed. This delay completely neutralizes any leverage to negotiate or enforce a contractual amendment.

The core technical problem, then, was not simply using local AI to read PDFs. It was instantly converting an incoming, unstructured agreement into a structured data asset that faithfully respects this legal hierarchy. This speed allows traders to catch risks before the ink dries, all in an environment where confidentiality is non-negotiable.

A data center in a lunchbox

The instinct in enterprise AI is to assume that serious generative reasoning demands expensive third-party cloud infrastructure or data-center GPUs. Our project demonstrates that this assumption is overstated, and we are not the only ones making the point. At CES 2026, AMD CEO Lisa Su held up a lunchbox-sized mini PC and ran a 235-billion-parameter model on it live. This demo did not rely on a data center, the cloud, or a rented GPU. That machine was built on the same AMD Ryzen AI Max+ 395 “Strix Halo” processor that powers our system.

The contract intelligence system runs on a single compact Minisforum MS-S1 Max workstation built around that Strix Halo processor with 128 GB of unified memory. By permanently dedicating 96 GB of that memory to AI workloads at the firmware level, our machine holds a 26-billion-parameter language model and an 8-billion-parameter embedding model in fast local memory at the same time. The result is performance comparable to an enterprise server, sitting quietly in a standard office, requiring no climate-controlled server room and no external network connection.

That last point is the strategic one. For a firm handling sensitive commodity contracts, keeping the entire intelligence-gathering process on-premises is not a nice-to-have; it is what makes the technology viable at all. The economics reinforce the case. Because the entire AI stack is open source, there is no vendor lock-in and no per-token billing. Once the hardware is purchased, the marginal cost of analyzing one more contract is simply the electricity to run it.

From raw PDFs to a structured asset

Turning a contract into intelligence happens in a single on-device ingestion pass. Text is extracted with precise character coordinates, and, critically, strikethrough redlines left over from negotiation are detected and stripped out. Deleted clauses that remain visually present in a final PDF would otherwise be embedded into the knowledge base and silently bias the tool toward obsolete terms. Detecting where vector lines cross the midline of a character, and dropping that text, proved to be a mandatory step rather than a refinement.

The cleaned text is then semantically chunked, tagged with metadata that encodes document type and hierarchy level, and indexed for both keyword and semantic search. In parallel, the system runs a “map-reduce” pass in which the language model reads the full agreement and distills every clause, obligation, liability cap, and financial threshold into a structured “clause inventory” of typically 80 to 250 lines per contract. This information is stored in a local database. Decoupling this structured inventory from raw text retrieval was one of our biggest breakthroughs: it lets the system audit an entire contract directly and completely, rather than hoping a keyword search surfaces the right needle in a 60-page haystack.

Read more on SCMR.com »