<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Steven Miller</title>
    <description>The latest articles on DEV Community by Steven Miller (@stevenmillerfl).</description>
    <link>https://dev.to/stevenmillerfl</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4164615%2F23278f66-20d2-4ba4-916f-84f84d9d19de.png</url>
      <title>DEV Community: Steven Miller</title>
      <link>https://dev.to/stevenmillerfl</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/stevenmillerfl"/>
    <language>en</language>
    <item>
      <title>ContractClarity: Benchmarking LLMs on Contract Understanding</title>
      <dc:creator>Steven Miller</dc:creator>
      <pubDate>Mon, 05 Oct 2026 18:19:23 +0000</pubDate>
      <link>https://dev.to/stevenmillerfl/contractclarity-benchmarking-llms-on-contract-understanding-42l0</link>
      <guid>https://dev.to/stevenmillerfl/contractclarity-benchmarking-llms-on-contract-understanding-42l0</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/kaggle-2026-09-23"&gt;Kaggle Benchmarking Challenge&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Benchmarked
&lt;/h2&gt;

&lt;p&gt;I built &lt;strong&gt;ContractClarity&lt;/strong&gt;, a legal-domain benchmark that measures how well LLMs handle two practical contract-understanding skills:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Structured fact extraction&lt;/strong&gt; (&lt;code&gt;contract_fact_extraction&lt;/code&gt;): The model reads a synthetic services agreement and must extract six facts exactly — client name, provider name, effective date, governing law, termination notice period (days), and liability cap (USD) — into a structured schema. Six strict equality assertions grade it pass/fail.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Contract question answering&lt;/strong&gt; (&lt;code&gt;contract_qa_accuracy&lt;/code&gt;): The model answers 6 questions over contract clauses (payment terms, termination notice, governing law, liability cap, confidentiality survival, renewal terms). Accuracy is measured over the dataset via substring match against gold answers.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Why contracts? With a legal/paralegal background, I know contract review is high-stakes, detail-oriented work where a single misread clause — a date, a cap, a notice period — can cost real money. If LLMs are going to assist with legal documents, we need to measure whether they can reliably extract exact facts, not just produce plausible-sounding summaries.&lt;/p&gt;

&lt;h2&gt;
  
  
  Models Tested
&lt;/h2&gt;

&lt;p&gt;I ran the benchmark against two open-weight instruction-tuned models, executed locally on Kaggle (CPU) via Hugging Face Transformers and plugged into the &lt;code&gt;kaggle-benchmarks&lt;/code&gt; task framework:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Qwen/Qwen2.5-1.5B-Instruct&lt;/strong&gt; (1.5B parameters)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TinyLlama/TinyLlama-1.1B-Chat-v1.0&lt;/strong&gt; (1.1B parameters)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why these two? I wanted to compare compact, openly available models that a small team could actually run — the realistic choice for a paralegal shop, not a frontier API. The 1.1B vs 1.5B size difference also lets me test whether slightly larger scale helps on precise legal extraction.&lt;/p&gt;

&lt;p&gt;(Note: Kaggle's hosted model proxy requires account identity verification, so I ran the models locally in the notebook instead — same tasks, same assertions, real inference.)&lt;/p&gt;

&lt;h2&gt;
  
  
  Findings
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Headline result: both models scored 50.0% (3/6) on contract QA — an exact tie.&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;QA Accuracy&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Qwen2.5-1.5B-Instruct&lt;/td&gt;
&lt;td&gt;50.0% (3/6)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TinyLlama-1.1B-Chat-v1.0&lt;/td&gt;
&lt;td&gt;50.0% (3/6)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;What this tells me:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Small models are coin-flips on contract QA.&lt;/strong&gt; 50% on straightforward clause questions (e.g., "Within how many days must invoices be paid?") means these models cannot be trusted for unsupervised contract review. A paralegal relying on a 1.5B model would miss half the answers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scale didn't help here.&lt;/strong&gt; The 1.5B model tied the 1.1B model exactly. For precise, detail-oriented extraction, architectural and training differences mattered more than the parameter gap — or both models are simply below the capability threshold for this task.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Strict extraction is the more valuable test.&lt;/strong&gt; The fact-extraction task (exact match on 6 fields including a dollar amount and a date) is where I expect larger models to differentiate. The benchmark gives no partial credit for "close" answers, because in contracts, close doesn't count.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What surprised me: I expected Qwen2.5-1.5B to clearly beat TinyLlama-1.1B given its newer architecture and larger size. The tie suggests that for niche, precision-heavy domains like contracts, general capability gains don't automatically transfer — domain-specific evaluation matters.&lt;/p&gt;

&lt;p&gt;What I'd measure next: run the same tasks against larger models (7B–70B) and frontier APIs to find the scale at which contract QA becomes reliable (&amp;gt;90%), and add adversarial clauses (conflicting terms, amendments) to test whether models track the &lt;em&gt;current&lt;/em&gt; version of a term.&lt;/p&gt;

&lt;h2&gt;
  
  
  My Benchmark
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.kaggle.com/code/stevenmillerfl/contractclarity-benchmarking-llms-on-contract-und" rel="noopener noreferrer"&gt;ContractClarity notebook on Kaggle&lt;/a&gt;&lt;/strong&gt; (public, runs end-to-end)&lt;/p&gt;

&lt;p&gt;The notebook defines the tasks with the &lt;code&gt;kaggle-benchmarks&lt;/code&gt; library, runs them against both models, and prints the summary table. All contract text and questions are original, written for this benchmark.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>kagglechallenge</category>
      <category>ai</category>
      <category>machinelearning</category>
    </item>
  </channel>
</rss>
