<?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: Jesus Huerta Martinez</title>
    <description>The latest articles on DEV Community by Jesus Huerta Martinez (@jhuerta07).</description>
    <link>https://dev.to/jhuerta07</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3787673%2Fbed0fb53-3566-4d82-bbcf-9a6674e1ef06.jpg</url>
      <title>DEV Community: Jesus Huerta Martinez</title>
      <link>https://dev.to/jhuerta07</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jhuerta07"/>
    <language>en</language>
    <item>
      <title>From Prompting to Programming: Making LLM Outputs More Predictable with Structure</title>
      <dc:creator>Jesus Huerta Martinez</dc:creator>
      <pubDate>Tue, 31 Mar 2026 14:45:52 +0000</pubDate>
      <link>https://dev.to/jhuerta07/from-prompting-to-programming-making-llm-outputs-more-predictable-with-structure-1f99</link>
      <guid>https://dev.to/jhuerta07/from-prompting-to-programming-making-llm-outputs-more-predictable-with-structure-1f99</guid>
      <description>&lt;p&gt;&lt;em&gt;Based on the open-source Symbolic Prompting framework. All benchmarks, datasets, and workflows are publicly available for verification.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Most interactions with LLMs today look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;I have a user who is 17 years old. Can they vote?
Please analyze their age and tell me if they meet the requirement.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the output is often something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“It depends on the country…”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This isn’t wrong — but it’s &lt;strong&gt;not predictable&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The model is interpreting intent, filling gaps, and defaulting to conversational behavior.&lt;/p&gt;




&lt;h2&gt;
  
  
  A Different Approach: Treat Prompts as Logic
&lt;/h2&gt;

&lt;p&gt;Instead of asking, we can structure the prompt more like a program:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[ROLE] ::= Age_Validator
$age := 17
IF $age &amp;gt;= 18 THEN
  _result := "APROVED"
ELSE
  _result := "REFUSED"
ENDIF
[CONSTRAINTS] { NO_ADD_COMMENTS_OR_PROSE, ONLY_PRINT_VALUE }
[OUTPUT] ::= _result
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Observed result (multiple runs):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;REFUSED
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Same input → same output pattern.&lt;/p&gt;




&lt;h2&gt;
  
  
  Quick Repro (Copy/Paste Test)
&lt;/h2&gt;

&lt;p&gt;You can test the difference yourself:&lt;br&gt;
&lt;strong&gt;1. Natural language prompt&lt;/strong&gt;&lt;br&gt;
• Run it 5–10 times&lt;br&gt;
• Slight variations in wording or reasoning may appear&lt;br&gt;
&lt;strong&gt;2. Structured prompt (above)&lt;/strong&gt;&lt;br&gt;
• Run it 5–10 times&lt;br&gt;
• Output remains stable in most cases&lt;br&gt;
This isn’t true determinism — but it &lt;strong&gt;reduces variance significantly.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What’s Happening Under the Hood?
&lt;/h2&gt;

&lt;p&gt;LLMs are still probabilistic systems. This approach doesn’t change that.&lt;br&gt;
What structured prompting does:&lt;br&gt;
• Reduces ambiguity&lt;br&gt;
• Narrows the model’s response space&lt;br&gt;
• Encourages consistent token paths&lt;br&gt;
In practice, this often leads to &lt;strong&gt;more stable outputs&lt;/strong&gt;, especially in simple decision logic.&lt;/p&gt;




&lt;h2&gt;
  
  
  Benchmarks (Summary)
&lt;/h2&gt;

&lt;p&gt;I ran ~300 tests across multiple models and prompt formats:&lt;br&gt;
• Natural language prompts&lt;br&gt;
• JSON/DSL structured inputs&lt;br&gt;
• Symbolic prompting (logic-like syntax)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Observation:&lt;/strong&gt;&lt;br&gt;
• Output consistency and latency varied significantly depending on format&lt;br&gt;
• In some cases, differences reached ~30–40% between formats on the same model&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt;&lt;br&gt;
• Some models appear optimized for JSON-style inputs&lt;br&gt;
• Token count alone does not explain performance differences&lt;/p&gt;

&lt;p&gt;Full data + methodology: 👉 &lt;a href="https://github.com/mindhack03d/SymbolicPrompting" rel="noopener noreferrer"&gt;https://github.com/mindhack03d/SymbolicPrompting&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  When This Approach Works Well
&lt;/h2&gt;

&lt;p&gt;Structured prompting is particularly useful for:&lt;br&gt;
• Validation logic (age, permissions, thresholds)&lt;br&gt;
• Routing decisions&lt;br&gt;
• Pre-processing steps in pipelines&lt;br&gt;
• Deterministic-like workflows&lt;/p&gt;




&lt;h2&gt;
  
  
  When It Doesn’t
&lt;/h2&gt;

&lt;p&gt;This approach is not ideal for:&lt;br&gt;
• Creative writing&lt;br&gt;
• Open-ended reasoning&lt;br&gt;
• Brainstorming tasks&lt;br&gt;
• Ambiguity-driven exploration&lt;br&gt;
In those cases, conversational prompting is still more effective.&lt;/p&gt;

&lt;p&gt;--&lt;/p&gt;

&lt;h2&gt;
  
  
  Common Pitfalls
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Mixing natural language inside logic
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❌ IF age is greater than 18 THEN
✅ IF age &amp;gt;= 18 THEN
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Silent error handling
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❌ [CATCH] =&amp;gt; { }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Always surface or log errors when possible.&lt;/p&gt;




&lt;h3&gt;
  
  
  “Magic” prompts you don’t understand
&lt;/h3&gt;

&lt;p&gt;If a structure works but you can’t explain why, it’s fragile.&lt;/p&gt;




&lt;h3&gt;
  
  
  Key Takeaways
&lt;/h3&gt;

&lt;p&gt;• LLMs don’t become deterministic — but they can become &lt;strong&gt;more predictable&lt;/strong&gt;&lt;br&gt;
• Structure reduces ambiguity&lt;br&gt;
• Prompt design benefits from software engineering principles&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thought
&lt;/h2&gt;

&lt;p&gt;Most people interact with LLMs conversationally by default.&lt;br&gt;
But if you're building systems — not just asking questions —&lt;br&gt;
it may be useful to think less in terms of prompts, and more in terms of &lt;strong&gt;interfaces and logic.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;p&gt;• Repo (benchmarks, workflows, datasets):&lt;br&gt;
&lt;a href="https://github.com/mindhack03d/SymbolicPrompting" rel="noopener noreferrer"&gt;https://github.com/mindhack03d/SymbolicPrompting&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;If you experiment with this approach, I’d be interested to hear what works (and what doesn’t) in your use case.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>promptengineering</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
