<?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: dennyi konyak</title>
    <description>The latest articles on DEV Community by dennyi konyak (@dennyi_konyak_9ff6c99bfdc).</description>
    <link>https://dev.to/dennyi_konyak_9ff6c99bfdc</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%2F4105429%2Ff3499cca-b8d7-4ce1-84a9-6f830f4829fa.png</url>
      <title>DEV Community: dennyi konyak</title>
      <link>https://dev.to/dennyi_konyak_9ff6c99bfdc</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dennyi_konyak_9ff6c99bfdc"/>
    <language>en</language>
    <item>
      <title>When Should You Use Reinforcement Learning Instead of Rules?</title>
      <dc:creator>dennyi konyak</dc:creator>
      <pubDate>Wed, 23 Sep 2026 06:26:47 +0000</pubDate>
      <link>https://dev.to/dennyi_konyak_9ff6c99bfdc/when-should-you-use-reinforcement-learning-instead-of-rules-2jjj</link>
      <guid>https://dev.to/dennyi_konyak_9ff6c99bfdc/when-should-you-use-reinforcement-learning-instead-of-rules-2jjj</guid>
      <description>&lt;p&gt;Reinforcement learning is attractive for problems involving repeated decisions, changing environments, and limited resources.&lt;/p&gt;

&lt;p&gt;But a complicated decision problem is not automatically an RL problem.&lt;/p&gt;

&lt;p&gt;While working on hospital resource allocation, I kept coming back to a simpler question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;What would justify using reinforcement learning instead of a rule-based policy?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;My conclusion was simple:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Start with rules. Consider RL only when current decisions meaningfully affect future states, those delayed effects can be measured, and RL can outperform a strong baseline without making important outcomes worse.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  When Rules Are Enough
&lt;/h2&gt;

&lt;p&gt;Rule-based systems work well when decisions are mostly determined by clear constraints and priorities.&lt;/p&gt;

&lt;p&gt;For example, allocating a hospital resource may depend on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;clinical eligibility,&lt;/li&gt;
&lt;li&gt;urgency,&lt;/li&gt;
&lt;li&gt;resource availability,&lt;/li&gt;
&lt;li&gt;safe waiting time,&lt;/li&gt;
&lt;li&gt;available alternatives,&lt;/li&gt;
&lt;li&gt;operational constraints.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If these factors produce a stable decision, adding RL may only introduce more complexity.&lt;/p&gt;

&lt;p&gt;Rules also have practical advantages: they are easier to inspect, audit, debug, and explain.&lt;/p&gt;

&lt;p&gt;And some things should remain rules regardless of the model.&lt;/p&gt;

&lt;p&gt;An RL policy should not have to learn that an unavailable resource cannot be allocated or that a hard safety constraint should not be violated. Those constraints should define which actions are allowed before the policy makes a decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  When RL Becomes Interesting
&lt;/h2&gt;

&lt;p&gt;The stronger case for RL appears when a decision changes what happens next.&lt;/p&gt;

&lt;p&gt;Suppose allocating a ventilator now means it will not be available for another emergency later.&lt;/p&gt;

&lt;p&gt;Waiting for a predicted release may preserve capacity, but waiting also carries risk.&lt;/p&gt;

&lt;p&gt;Using an alternative resource may solve the current request while creating pressure somewhere else.&lt;/p&gt;

&lt;p&gt;Now the problem is not simply:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Who should receive the resource?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It becomes:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What decision now leads to the best sequence of outcomes later?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That is the kind of sequential decision problem RL is designed for.&lt;/p&gt;

&lt;p&gt;A useful test is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;If I change the current action, does it significantly change the future states and decisions?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If not, RL may be unnecessary.&lt;/p&gt;

&lt;p&gt;If yes, it becomes worth investigating.&lt;/p&gt;

&lt;h2&gt;
  
  
  RL Still Needs a Strong Baseline
&lt;/h2&gt;

&lt;p&gt;One mistake is comparing RL against an intentionally simple rule.&lt;/p&gt;

&lt;p&gt;If an RL agent beats “first come, first served,” that does not prove much if a real system would already consider urgency, waiting time, alternatives, or expected resource releases.&lt;/p&gt;

&lt;p&gt;The baseline should represent a policy you could realistically deploy.&lt;/p&gt;

&lt;p&gt;Only then does beating it mean something.&lt;/p&gt;

&lt;p&gt;It is also useful to compare both approaches against an exact solution on small scenarios when possible.&lt;/p&gt;

&lt;p&gt;If the rule-based system is already close to optimal, there may simply not be enough room for RL to justify its additional complexity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Better Reward Does Not Always Mean Better Policy
&lt;/h2&gt;

&lt;p&gt;This was one of the most important lessons from my experiments.&lt;/p&gt;

&lt;p&gt;A Q-learning policy could improve its average reward while individual outcome categories became less convincing.&lt;/p&gt;

&lt;p&gt;One type of failure decreased while another increased.&lt;/p&gt;

&lt;p&gt;The metric improved, but the underlying system had not necessarily improved in the same way.&lt;/p&gt;

&lt;p&gt;This is a fundamental RL problem:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The model optimizes the objective you give it, not necessarily the outcome you intended.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So evaluation cannot stop at reward.&lt;/p&gt;

&lt;p&gt;You also need to inspect failure rates, waiting times, worst-case behaviour, subgroup outcomes, constraint violations, and the overall state of the system.&lt;/p&gt;

&lt;p&gt;A policy that produces a higher reward while moving failures from one category to another has not necessarily solved the problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  So When Should You Use RL?
&lt;/h2&gt;

&lt;p&gt;I would seriously consider RL when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;decisions happen repeatedly,&lt;/li&gt;
&lt;li&gt;current actions affect future states,&lt;/li&gt;
&lt;li&gt;delayed consequences can be observed,&lt;/li&gt;
&lt;li&gt;complete decision-to-outcome trajectories are available,&lt;/li&gt;
&lt;li&gt;a strong rule-based baseline already exists,&lt;/li&gt;
&lt;li&gt;the policy can be evaluated safely,&lt;/li&gt;
&lt;li&gt;hard constraints remain outside the learned policy,&lt;/li&gt;
&lt;li&gt;RL improves real system outcomes, not only its reward,&lt;/li&gt;
&lt;li&gt;the improvement holds on unseen scenarios.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Otherwise, rules may still be the better engineering choice.&lt;/p&gt;

&lt;p&gt;The question should not be:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Can this problem be formulated as reinforcement learning?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Many problems can.&lt;/p&gt;

&lt;p&gt;The better question is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;What does reinforcement learning give us that a simpler rule-based system does not?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If that advantage cannot be clearly measured, start with the rules.&lt;/p&gt;

&lt;p&gt;If it can—and the improvement survives strong evaluation—then RL may have earned its place.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;The hospital resource-allocation examples here come from simulation-based experiments used while exploring this question. They are engineering examples, not clinical validation or a proposal for autonomous healthcare decision-making.&lt;/em&gt;&lt;/p&gt;

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