<?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: Dmitrii T.</title>
    <description>The latest articles on DEV Community by Dmitrii T. (@sumasbrod).</description>
    <link>https://dev.to/sumasbrod</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%2F4055192%2F83fc3228-bfcb-4bc6-8361-96bd1f50264b.jpg</url>
      <title>DEV Community: Dmitrii T.</title>
      <link>https://dev.to/sumasbrod</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sumasbrod"/>
    <language>en</language>
    <item>
      <title>I built a file format so AI answers cite an exact source sentence, or admit they don't know</title>
      <dc:creator>Dmitrii T.</dc:creator>
      <pubDate>Thu, 30 Jul 2026 13:45:26 +0000</pubDate>
      <link>https://dev.to/sumasbrod/i-built-a-file-format-so-ai-answers-cite-an-exact-source-sentence-or-admit-they-dont-know-4483</link>
      <guid>https://dev.to/sumasbrod/i-built-a-file-format-so-ai-answers-cite-an-exact-source-sentence-or-admit-they-dont-know-4483</guid>
      <description>&lt;p&gt;RAG has a trust problem: a model answers fluently, cites nothing, and you can't tell fact from confident improvisation without manually checking the source docs. This gets worse, not better, with smaller models — they're more likely to fill gaps with something plausible, and less likely to hedge.&lt;/p&gt;

&lt;p&gt;I've been building &lt;strong&gt;AIPK&lt;/strong&gt;, a package format that tries to close that gap — not by making the model smarter, but by making it &lt;em&gt;provably grounded&lt;/em&gt;, sentence by sentence, or explicit about the fact that it isn't.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it actually is
&lt;/h2&gt;

&lt;p&gt;An &lt;code&gt;.aipk&lt;/code&gt; file is a single binary package containing a persona, a RAG knowledge base (chunks + embeddings, no external vector DB), skills, tool definitions, and an auditable set of &lt;strong&gt;claims&lt;/strong&gt;: atomic, sourced factual statements extracted from the underlying documents.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;aipk serve&lt;/code&gt; is a ~9 MB Rust binary that turns a &lt;code&gt;.aipk&lt;/code&gt; file (or several, merged) into an OpenAI-compatible API on top of any backend that speaks that protocol — Ollama, vLLM, a cloud API, whatever. Point an existing chat UI at it and the package shows up as a model. Swap the backend model and the knowledge base, claims, and audit trail travel with it unchanged.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sentence-level provenance, not vibes
&lt;/h2&gt;

&lt;p&gt;Most "grounded RAG" setups stop at retrieval: stuff some chunks into the context window and hope the model sticks to them. AIPK adds an enforcement and auditing layer on top of that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Claims extraction.&lt;/strong&gt; An LLM pass reads the source documents and pulls out atomic factual statements — one per sentence-level fact — each tagged with its source. These go through a lifecycle (&lt;code&gt;extracted → reviewed → canonical → deprecated&lt;/code&gt;) before they're trusted.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Strict-render.&lt;/strong&gt; In this mode, the system prompt requires the model to append a &lt;code&gt;[claim_id]&lt;/code&gt; citation after every factual sentence it writes. No citation, no trust.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;aipk verify&lt;/code&gt;.&lt;/strong&gt; A separate, independent pass parses the model's answer sentence by sentence, checks that every citation resolves to a canonical claim, and reports a coverage score: what fraction of the answer's factual sentences are actually backed by something in the package, versus asserted on the model's own authority.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;None of this requires a word-for-word quote match — that would be brittle. It requires a valid ID pointing at a real, reviewed, canonical claim.&lt;/p&gt;

&lt;h2&gt;
  
  
  The benchmark
&lt;/h2&gt;

&lt;p&gt;To find out if this moves the needle rather than just adding ceremony, I built a small fictional corpus — a company handbook, an incident-response SOP, and a product spec for a robot that doesn't exist — specifically so the model couldn't fall back on pretraining knowledge. 23 questions: 15 answerable from the corpus, 8 deliberately not.&lt;/p&gt;

&lt;p&gt;Model: &lt;code&gt;llama3.2:3b&lt;/code&gt;, run locally. Two conditions: vanilla RAG vs. &lt;code&gt;--strict-render&lt;/code&gt;, both scored by &lt;code&gt;aipk verify&lt;/code&gt;.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;slice&lt;/th&gt;
&lt;th&gt;vanilla coverage&lt;/th&gt;
&lt;th&gt;strict-render coverage&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;in-corpus (15 questions)&lt;/td&gt;
&lt;td&gt;0.933&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.983&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;out-of-corpus (8 questions)&lt;/td&gt;
&lt;td&gt;0.166&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.000&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;out-of-corpus refusal rate&lt;/td&gt;
&lt;td&gt;1/8&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;8/8&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;On the 8 questions the corpus genuinely can't answer, vanilla RAG produced a plausible-sounding response with &lt;em&gt;some&lt;/em&gt; grounding 7 times out of 8 — it just quietly filled the rest with invention. Strict-render refused outright on all 8.&lt;/p&gt;

&lt;h2&gt;
  
  
  One concrete example
&lt;/h2&gt;

&lt;p&gt;The benchmark corpus was synthetic on purpose. A more convincing test was real: a package built from the official Kubernetes documentation (CC-BY 4.0, 111 MB, 35,588 chunks, 1,354 canonical claims), asked about a &lt;code&gt;kubectl&lt;/code&gt; flag that doesn't exist (&lt;code&gt;--force-evict&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;In normal mode, the model caught it cleanly and substituted the real command. With &lt;code&gt;--strict-render&lt;/code&gt; on, it hedged honestly ("insufficient grounded information") — then invented a &lt;em&gt;different&lt;/em&gt; fake flag while explaining why the first one was fake. Citation-only prompting doesn't stop a model from writing fiction; it just makes the fiction visible if you check:&lt;/p&gt;

&lt;p&gt;_aipk: canonical_used=0 invalid_ids=[] coverage=0.00 uncited_sentences=4 fully_grounded=false&lt;/p&gt;

&lt;p&gt;Zero canonical citations, zero coverage. The system didn't stop the model from bluffing — it caught the bluff and said so in a structured, machine-checkable way.&lt;/p&gt;

&lt;h2&gt;
  
  
  What dogfooding actually found
&lt;/h2&gt;

&lt;p&gt;Building the benchmark and the Kubernetes package surfaced real defects synthetic unit tests hadn't:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The coverage report used to lie by omission.&lt;/strong&gt; The original &lt;code&gt;fully_grounded&lt;/code&gt; check only verified that &lt;em&gt;already-cited&lt;/em&gt; claim IDs were valid — an answer with zero citations passed trivially. Fixed to check what fraction of sentences carry a citation at all.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A missing token limit could hang the whole request.&lt;/strong&gt; Nothing capped generation length, so a model that occasionally fails to emit a stop token would generate indefinitely. Fixed with a &lt;code&gt;--max-tokens&lt;/code&gt; cap and a request timeout.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Decimal points were splitting sentences.&lt;/strong&gt; "8.4 kWh" silently became two sentences, mangling claim extraction. Fixed across all three places doing sentence splitting.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of these are exotic. They're the kind of bug that only shows up when you run the loop end to end at realistic scale.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;.aipk&lt;/code&gt; files are self-contained — one file, offline-capable, works with any OpenAI-compatible local or cloud backend.&lt;/p&gt;

&lt;p&gt;curl -fsSL &lt;a href="https://aipk.dev/install.sh" rel="noopener noreferrer"&gt;https://aipk.dev/install.sh&lt;/a&gt; | sh&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/ArchDuran/aipk" rel="noopener noreferrer"&gt;https://github.com/ArchDuran/aipk&lt;/a&gt;&lt;br&gt;
Site + demo video: &lt;a href="https://aipk.dev" rel="noopener noreferrer"&gt;https://aipk.dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Source-available under BSL 1.1 — free for evaluation, individuals, and small teams; commercial license for larger production use.&lt;/p&gt;

&lt;p&gt;Feedback on the coverage methodology, the claim lifecycle, or where this still falls over is genuinely wanted.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>rust</category>
      <category>opensource</category>
      <category>machinelearning</category>
    </item>
  </channel>
</rss>
