<?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: Prem Siva</title>
    <description>The latest articles on DEV Community by Prem Siva (@prem_siva_f2170b0361ea140).</description>
    <link>https://dev.to/prem_siva_f2170b0361ea140</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%2F4000964%2Fd62fe60a-41e4-41b6-a0c3-a14843be31fd.png</url>
      <title>DEV Community: Prem Siva</title>
      <link>https://dev.to/prem_siva_f2170b0361ea140</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/prem_siva_f2170b0361ea140"/>
    <language>en</language>
    <item>
      <title>Where Does the LLM Fit?</title>
      <dc:creator>Prem Siva</dc:creator>
      <pubDate>Thu, 25 Jun 2026 02:44:30 +0000</pubDate>
      <link>https://dev.to/prem_siva_f2170b0361ea140/where-does-the-llm-fit-2826</link>
      <guid>https://dev.to/prem_siva_f2170b0361ea140/where-does-the-llm-fit-2826</guid>
      <description>&lt;p&gt;Most people start with the wrong request:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Build me a tool that flags risky trades.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It sounds reasonable.&lt;/p&gt;

&lt;p&gt;But it asks the LLM to do the wrong job.&lt;/p&gt;

&lt;p&gt;An LLM should not decide whether a trade is risky. It should explain a risk decision after the real risk system has already measured the risk and chosen the action.&lt;/p&gt;

&lt;h2&gt;
  
  
  Think of it like a hospital
&lt;/h2&gt;

&lt;p&gt;A good risk system has three separate jobs.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Measure
&lt;/h3&gt;

&lt;p&gt;In a hospital, this is the blood test.&lt;/p&gt;

&lt;p&gt;The test might say:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Your inflammation marker is 9.2&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In trading, this is the risk model.&lt;/p&gt;

&lt;p&gt;The model might say:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Margin-call probability = 0.88&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This job is about producing a number.&lt;/p&gt;

&lt;p&gt;Not a feeling.&lt;br&gt;&lt;br&gt;
Not a sentence.&lt;br&gt;&lt;br&gt;
A number.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Decide
&lt;/h2&gt;

&lt;p&gt;In a hospital, the doctor follows a protocol.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If the marker is above 8.0, admit the patient to ICU.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In trading, the policy rule does the same thing.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If margin-call probability is above 0.80, freeze leverage and alert the risk desk.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This job is about choosing the action.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Communicate
&lt;/h2&gt;

&lt;p&gt;In a hospital, the nurse explains the situation to the family in plain language.&lt;/p&gt;

&lt;p&gt;In trading, this is where the LLM belongs.&lt;/p&gt;

&lt;p&gt;The LLM can write:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This member has an 88% estimated margin-call risk, mainly due to high leverage and correlated positions. Leverage has been frozen and the case has been sent to the risk desk for review.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That is the right job for the LLM.&lt;/p&gt;

&lt;p&gt;It explains the decision.&lt;/p&gt;

&lt;p&gt;It does not make the decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  The common mistake
&lt;/h2&gt;

&lt;p&gt;Nobody asks the nurse to run the blood test, diagnose the patient, and decide the treatment.&lt;/p&gt;

&lt;p&gt;But that is exactly what people do when they ask an LLM:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Is this trade risky?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That question sounds simple, but it gives the LLM too much responsibility.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the LLM should not be the risk model
&lt;/h2&gt;

&lt;p&gt;Ask an LLM if something is risky, and it may say:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This account shows concerning risk characteristics and significant leverage.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That sounds serious.&lt;/p&gt;

&lt;p&gt;But what does it actually mean?&lt;/p&gt;

&lt;p&gt;Does it mean there is an 80% chance of a margin call?&lt;/p&gt;

&lt;p&gt;A 15% chance?&lt;/p&gt;

&lt;p&gt;A 3% chance?&lt;/p&gt;

&lt;p&gt;You cannot tell.&lt;/p&gt;

&lt;p&gt;That is the problem.&lt;/p&gt;

&lt;p&gt;Language can sound confident without being precise.&lt;/p&gt;

&lt;p&gt;Risk systems need numbers that can be tested against history.&lt;/p&gt;

&lt;p&gt;An LLM gives you persuasive wording.&lt;/p&gt;

&lt;p&gt;A risk model gives you a probability.&lt;/p&gt;

&lt;p&gt;For trading risk, you need the probability first.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix: answer four questions before building
&lt;/h2&gt;

&lt;p&gt;Before writing code, answer these four questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. What is the real number?
&lt;/h2&gt;

&lt;p&gt;Do not start with:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This trade is risky.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Start with something measurable:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Margin-call probability = 0.88&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That number can be checked later.&lt;/p&gt;

&lt;p&gt;If the model says 0.88, you can ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Did accounts like this actually margin call around 88% of the time?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That is how you improve the system.&lt;/p&gt;

&lt;p&gt;You cannot improve vague language in the same way.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. What can we actually do about it?
&lt;/h2&gt;

&lt;p&gt;An alert is not an action.&lt;/p&gt;

&lt;p&gt;An alert just says, “Someone should look at this.”&lt;/p&gt;

&lt;p&gt;That is often too vague.&lt;/p&gt;

&lt;p&gt;Instead, define real actions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Do nothing&lt;/li&gt;
&lt;li&gt;Send a soft warning&lt;/li&gt;
&lt;li&gt;Freeze leverage and send to human review&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now the system knows what to do.&lt;/p&gt;

&lt;p&gt;The LLM can explain the action after it happens.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. What does it cost to be wrong?
&lt;/h2&gt;

&lt;p&gt;Not all mistakes have the same cost.&lt;/p&gt;

&lt;p&gt;If you warn a healthy account by mistake, maybe the cost is small.&lt;/p&gt;

&lt;p&gt;Maybe the member is annoyed.&lt;br&gt;&lt;br&gt;
Maybe support gets one extra message.&lt;br&gt;&lt;br&gt;
Maybe it costs $5 in friction.&lt;/p&gt;

&lt;p&gt;But if you miss a real margin call, the cost can be much higher.&lt;/p&gt;

&lt;p&gt;It might mean financial loss.&lt;br&gt;&lt;br&gt;
It might mean legal risk.&lt;br&gt;&lt;br&gt;
It might mean a serious review from the risk team.&lt;/p&gt;

&lt;p&gt;That could easily cost $2,000 or more.&lt;/p&gt;

&lt;p&gt;These two errors are not equal.&lt;/p&gt;

&lt;p&gt;So the system should not treat them equally.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Where does the LLM actually belong?
&lt;/h2&gt;

&lt;p&gt;The LLM belongs last.&lt;/p&gt;

&lt;p&gt;First, the risk model measures the risk.&lt;/p&gt;

&lt;p&gt;Then, the policy decides the action.&lt;/p&gt;

&lt;p&gt;Then, the LLM explains the result in plain English.&lt;/p&gt;

&lt;p&gt;That order matters.&lt;/p&gt;

&lt;p&gt;The LLM should not say:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I think this account is risky.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It should say:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This account has an 88% estimated margin-call risk. The main drivers are 4.2x leverage and two highly correlated positions. Based on policy, leverage has been frozen and the case has been sent to the risk desk.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That message is useful because it includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The number&lt;/li&gt;
&lt;li&gt;The reason&lt;/li&gt;
&lt;li&gt;The action already taken&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What the finished system looks like
&lt;/h2&gt;

&lt;p&gt;Here is the simple structure.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frbmfov7n9fk3hg2cqvs5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frbmfov7n9fk3hg2cqvs5.png" alt=" " width="800" height="541"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Risk model
&lt;/h3&gt;

&lt;p&gt;Job:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Generate the risk score.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Margin-call probability = 0.88&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Decision logic
&lt;/h3&gt;

&lt;p&gt;Job:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Apply the policy rule.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If probability is above 0.80, freeze leverage and notify the risk desk.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  LLM
&lt;/h3&gt;

&lt;p&gt;Job:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Write the message in clear language.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Member is at 88% margin-call risk, driven by 4.2x leverage across two correlated positions.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Feedback loop
&lt;/h3&gt;

&lt;p&gt;Job:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Learn from what actually happened.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Did the margin call happen? Use the outcome to retrain the model.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The important shift
&lt;/h2&gt;

&lt;p&gt;The goal is not to make the alert sound more dramatic.&lt;/p&gt;

&lt;p&gt;The goal is to make it more useful.&lt;/p&gt;

&lt;p&gt;A bad alert says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This account appears risky.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A better alert says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This account has an 88% margin-call probability. The risk is driven by 4.2x leverage across two correlated positions. Leverage has been frozen and the risk desk has been notified.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That is the difference.&lt;/p&gt;

&lt;p&gt;The first one sounds worried.&lt;/p&gt;

&lt;p&gt;The second one helps someone act.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final rule
&lt;/h2&gt;

&lt;p&gt;Do not ask the LLM to decide risk.&lt;/p&gt;

&lt;p&gt;Use the model to measure risk.&lt;/p&gt;

&lt;p&gt;Use policy to decide the action.&lt;/p&gt;

&lt;p&gt;Use the LLM to explain the decision clearly.&lt;/p&gt;

&lt;p&gt;That is where the LLM fits.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>llm</category>
      <category>agenticsystems</category>
    </item>
  </channel>
</rss>
