<?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: Michi Yamamoto</title>
    <description>The latest articles on DEV Community by Michi Yamamoto (@michi_yamamoto).</description>
    <link>https://dev.to/michi_yamamoto</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%2F4016172%2Fd1ce5151-9d5b-411f-9e99-71846973b1ab.png</url>
      <title>DEV Community: Michi Yamamoto</title>
      <link>https://dev.to/michi_yamamoto</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/michi_yamamoto"/>
    <language>en</language>
    <item>
      <title>Ask the model for something your code can check</title>
      <dc:creator>Michi Yamamoto</dc:creator>
      <pubDate>Wed, 16 Sep 2026 13:01:48 +0000</pubDate>
      <link>https://dev.to/michi_yamamoto/ask-the-model-for-something-your-code-can-check-4eaa</link>
      <guid>https://dev.to/michi_yamamoto/ask-the-model-for-something-your-code-can-check-4eaa</guid>
      <description>&lt;p&gt;Every AI feature eventually has to deal with the model being wrong. Four projects with public code handled it the same way, and none of them relied on the prompt to do it. Each one changed what the model hands back, so plain code could check it before anything happened.&lt;/p&gt;

&lt;p&gt;They're hackathon winners, but you don't need to know the events. Every detail below comes from their code.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Ask for coordinates, not a direction
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/psymon-ai/gilbeot-public" rel="noopener noreferrer"&gt;Gilbeot&lt;/a&gt; is an on-device walking assistant for older adults in Korea. You photograph a confusing corner, and a small vision model (Gemma 4 E2B) tells you which way to go. A &lt;a href="https://github.com/psymon-ai/gilbeot-public/blob/b9c5d631ac24c2f07a8a675fd922ea630e099d14/app/lib/screens/home_screen.dart#L1210" rel="noopener noreferrer"&gt;comment in the code&lt;/a&gt; (in Korean) notes that small vision-language models often reverse left and right. Here, a flipped word means walking the wrong way.&lt;/p&gt;

&lt;p&gt;So the model also returns the x-coordinates of the arrow's tip and tail, and code settles the direction. Roughly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tipX&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;tailX&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;sentence&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// nothing to check&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tipX&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;tailX&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mf"&gt;0.05&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;sentence&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// too close to call&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;dir&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;tipX&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;tailX&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;left&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;right&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;replaceWord&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;sentence&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;opposite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dir&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nx"&gt;dir&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;    &lt;span class="c1"&gt;// coordinates win&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This only makes the sentence agree with the coordinates. It can't prove the model found the right arrow. But "which number is smaller?" is a question code always answers correctly, and "left or right?" wasn't.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Let the model choose where, not what
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/BashaarJavaid/MCP-Sentinel/tree/e717e95" rel="noopener noreferrer"&gt;Sentinel&lt;/a&gt; scans MCP servers for security issues and asks GPT to review candidate findings in structured JSON. The host throws out any review that cites lines it wasn't shown, returns finding IDs that don't match the batch, or proposes a probe plan that doesn't fit the tool's input schema.&lt;/p&gt;

&lt;p&gt;The probe plan is the clever part. The model decides the order of four predefined probes and which input fields they target. The values are placeholder tokens from a fixed set, so the model never writes the payload. A rejected review is retried. If nothing passes, those findings stay "needs review," or the scan fails, depending on a setting.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Check the call, not the intent
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/atarantino/AirBridge/tree/df2abe8" rel="noopener noreferrer"&gt;AirBridge&lt;/a&gt; streams Windows audio to AirPlay speakers and includes an assistant that can call tools. A local catalog labels every tool read-only, reversible, confirmation-required, or forbidden (&lt;code&gt;arbitrary_shell&lt;/code&gt; is on the list, forbidden). Tools missing from the catalog are refused, arguments are range-checked (volume must be 0–100), and a pending confirmation is bound to the exact tool name and arguments.&lt;/p&gt;

&lt;p&gt;A refusal isn't an exception. It goes back to the model as the tool's result, so the assistant can explain or ask the user.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. If the right answer is already known, don't ask
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/shashank-padala/project-rosie" rel="noopener noreferrer"&gt;Project Rosie&lt;/a&gt; is a prototype that helps veterinary oncologists design personalized mRNA cancer vaccines for dogs. One commit had Gemma write the synthesis specification sent to a contract manufacturer. About five hours later, another commit replaced it with a template.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://github.com/shashank-padala/project-rosie/commit/22bd44d" rel="noopener noreferrer"&gt;commit message&lt;/a&gt; explains why. The document goes out verbatim. An invented catalog number or a drifted QC threshold is exactly what makes a formulation scientist dismiss the tool. And the only things that change between patients are case data.&lt;/p&gt;

&lt;p&gt;Any check on that document would have compared the model's output with values the pipeline already knew. So the template just writes those values. Gemma kept the work where prose is the point: the clinical report and questions about the case.&lt;/p&gt;

&lt;h2&gt;
  
  
  The question to ask first
&lt;/h2&gt;

&lt;p&gt;Side by side, the four projects answer one question you can ask before writing any prompt:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What will code check before this output affects anything, and what happens when the check fails?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If the answer is a comparison, an ID, a line the model was shown, or a name on a list, ask the model for exactly that. If the answer is "nothing," the model probably shouldn't produce that output.&lt;/p&gt;

&lt;p&gt;None of these checks make the model right. They limit what a wrong answer can do.&lt;/p&gt;




&lt;p&gt;Originally published on &lt;a href="https://sound.fan/editorial/ask-the-model-for-something-your-code-can-check" rel="noopener noreferrer"&gt;sound.fan&lt;/a&gt;, where I look under the hood of winning hackathon projects.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>architecture</category>
      <category>softwareengineering</category>
    </item>
  </channel>
</rss>
