<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  <title>devfacet - Blog</title>
  <subtitle>Blog posts and projects</subtitle>
  <link rel="self" type="application/atom+xml" href="https://devfacet.com/blog/atom.xml"/>
  <link rel="alternate" type="text/html" href="https://devfacet.com/blog"/>
  <id>https://devfacet.com/blog/atom.xml</id>
  <generator uri="https://www.getzola.org/">Zola</generator>
  <updated>2026-11-30T00:00:00+00:00</updated>
  
  
  <entry xml:lang="en">
    <title>A New Blog</title>
    <published>2026-11-30T00:00:00+00:00</published>
    <updated>2026-11-30T00:00:00+00:00</updated>
    
    <author><name>Fatih Cetinkaya</name></author>
    
    <link rel="alternate" type="text/html" href="https://devfacet.com/blog/p/1/a-new-blog"/>
    <id>https://devfacet.com/blog/p/1/a-new-blog</id>
    
    <content type="html" xml:base="https://devfacet.com/blog/p/1/a-new-blog/">&lt;p&gt;It&#39;s been more than two decades since I had a blog. I&#39;ve always enjoyed solving
problems and learning something new along the way. Keeping a blog just wasn&#39;t a
priority. This new era of AI has given me even more to explore and build. I have
a lot to share so I&#39;m starting a new blog.&lt;/p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;basic&quot;&gt;10 PRINT &amp;quot;hello, world&amp;quot;
20 END
&lt;/code&gt;&lt;/pre&gt;
</content>
    
  </entry>
  
  
  <entry xml:lang="en">
    <title>Experimenting with Specialized Small Language Models</title>
    <published>2026-11-30T00:00:00+00:00</published>
    <updated>2026-11-30T00:00:00+00:00</updated>
    
    <author><name>Fatih Cetinkaya</name></author>
    
    <link rel="alternate" type="text/html" href="https://devfacet.com/blog/p/2/experimenting-with-specialized-small-language-models"/>
    <id>https://devfacet.com/blog/p/2/experimenting-with-specialized-small-language-models</id>
    
    <content type="html" xml:base="https://devfacet.com/blog/p/2/experimenting-with-specialized-small-language-models/">&lt;p&gt;I&#39;ve been experimenting with specialized small language models for a while. I
tried many different ways to design and train them. They ended up with some
interesting characteristics:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Easy to train. Models can be trained independently and each covers one or more
domains.&lt;/li&gt;
&lt;li&gt;Composable. Models can be loaded and unloaded at any time and run side by
side.&lt;/li&gt;
&lt;li&gt;Accurate. Models can be pretty accurate within their domains.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here&#39;s what it looks like in a short demo. It starts with nothing loaded:&lt;/p&gt;
&lt;pre class=&quot;terminal&quot; data-title=&quot;demo&quot;&gt;&lt;code&gt;&lt;span class=&quot;demo-input&quot;&gt;$ demo&lt;/span&gt;
&lt;span class=&quot;demo-note&quot;&gt;Type a message or /help for the commands.&lt;/span&gt;

&lt;span class=&quot;demo-input&quot;&gt;&amp;gt; hi&lt;/span&gt;
&lt;span class=&quot;demo-note&quot;&gt;No model is loaded. Use /list and /load MODEL&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;No model, no response. Let&#39;s load one:&lt;/p&gt;
&lt;pre class=&quot;terminal&quot; data-title=&quot;demo&quot;&gt;&lt;code&gt;&lt;span class=&quot;demo-input&quot;&gt;&amp;gt; /load conversation&lt;/span&gt;
&lt;span class=&quot;demo-note&quot;&gt;Loaded conversation - 40M - 157MiB - 73ms&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The model has about 40 million parameters. It loaded in 73ms&lt;sup class=&quot;footnote-reference&quot;&gt;&lt;a href=&quot;#1&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; and takes
157MiB of GPU memory. That&#39;s with unquantized weights.&lt;/p&gt;
&lt;p&gt;Obviously this is a very small model and can&#39;t hold a deep conversation. Think
of it as an NPC (non-player character) in a game. It knows greetings, thanks and
a bit of small talk.&lt;/p&gt;
&lt;pre class=&quot;terminal&quot; data-title=&quot;demo&quot;&gt;&lt;code&gt;&lt;span class=&quot;demo-input&quot;&gt;&amp;gt; hi&lt;/span&gt;
&lt;span class=&quot;demo-answer&quot;&gt;Hello&lt;/span&gt;
&lt;span class=&quot;demo-note&quot;&gt;conversation - 86ms - 487 tokens/s&lt;/span&gt;

&lt;span class=&quot;demo-input&quot;&gt;&amp;gt; how are you doing today?&lt;/span&gt;
&lt;span class=&quot;demo-answer&quot;&gt;I&amp;#39;m doing well. How are you?&lt;/span&gt;
&lt;span class=&quot;demo-note&quot;&gt;conversation - 127ms - 513 tokens/s&lt;/span&gt;

&lt;span class=&quot;demo-input&quot;&gt;&amp;gt; pretty good&lt;/span&gt;
&lt;span class=&quot;demo-answer&quot;&gt;Glad to hear it.&lt;/span&gt;
&lt;span class=&quot;demo-note&quot;&gt;conversation - 113ms - 495 tokens/s&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This &lt;code&gt;conversation&lt;/code&gt; model handles greetings, thanks and small talk. But it
doesn&#39;t know anything else. For example:&lt;/p&gt;
&lt;pre class=&quot;terminal&quot; data-title=&quot;demo&quot;&gt;&lt;code&gt;&lt;span class=&quot;demo-input&quot;&gt;&amp;gt; what is 6 * 7?&lt;/span&gt;
&lt;span class=&quot;demo-note&quot;&gt;No response.&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;No response is expected because the conversation model doesn&#39;t know anything
about arithmetic. That being said there is an arithmetic model. Let&#39;s load it:&lt;/p&gt;
&lt;pre class=&quot;terminal&quot; data-title=&quot;demo&quot;&gt;&lt;code&gt;&lt;span class=&quot;demo-input&quot;&gt;&amp;gt; /load arithmetic&lt;/span&gt;
&lt;span class=&quot;demo-note&quot;&gt;Loaded arithmetic - 40M - 156MiB - 97ms&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It reminds me:&lt;/p&gt;
&lt;blockquote class=&quot;quote&quot;&gt;&lt;p&gt;- I know kung fu.&lt;/p&gt;&lt;p&gt;- Show me.&lt;/p&gt;&lt;/blockquote&gt;
&lt;pre class=&quot;terminal&quot; data-title=&quot;demo&quot;&gt;&lt;code&gt;&lt;span class=&quot;demo-input&quot;&gt;&amp;gt; what is 6 * 7?&lt;/span&gt;
&lt;span class=&quot;demo-answer&quot;&gt;42&lt;/span&gt;
&lt;span class=&quot;demo-note&quot;&gt;arithmetic - 125ms (128ms) - 441 tokens/s (709 tokens/s)&lt;/span&gt;

&lt;span class=&quot;demo-input&quot;&gt;&amp;gt; what is 12 * 6 * (30 - 2) + 1?&lt;/span&gt;
&lt;span class=&quot;demo-answer&quot;&gt;2017&lt;/span&gt;
&lt;span class=&quot;demo-note&quot;&gt;arithmetic - 186ms (188ms) - 501 tokens/s (682 tokens/s)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now we get a response. It comes from the arithmetic model we just loaded. The
conversation model still receives the prompt and still returns no response.&lt;/p&gt;
&lt;p&gt;You may notice multiple response time and token stats under each answer. The
values in brackets represent the total response time and tokens per second for
all loaded models. Models run in parallel and each one spends some time and
tokens even when it has no response.&lt;/p&gt;
&lt;p&gt;Let&#39;s do the same with algebra:&lt;/p&gt;
&lt;pre class=&quot;terminal&quot; data-title=&quot;demo&quot;&gt;&lt;code&gt;&lt;span class=&quot;demo-input&quot;&gt;&amp;gt; 14x + 15 = 71&lt;/span&gt;
&lt;span class=&quot;demo-note&quot;&gt;No response.&lt;/span&gt;

&lt;span class=&quot;demo-input&quot;&gt;&amp;gt; /load algebra&lt;/span&gt;
&lt;span class=&quot;demo-note&quot;&gt;Loaded algebra - 40M - 156MiB - 140ms&lt;/span&gt;

&lt;span class=&quot;demo-input&quot;&gt;&amp;gt; 14x + 15 = 71&lt;/span&gt;
&lt;span class=&quot;demo-answer&quot;&gt;x = 4&lt;/span&gt;
&lt;span class=&quot;demo-note&quot;&gt;algebra - 632ms (636ms) - 563 tokens/s (669 tokens/s)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So far we loaded three models for conversation, arithmetic and algebra. Together
they take about 469MiB of GPU memory.&lt;/p&gt;
&lt;pre class=&quot;terminal&quot; data-title=&quot;demo&quot;&gt;&lt;code&gt;&lt;span class=&quot;demo-input&quot;&gt;&amp;gt; /list&lt;/span&gt;
&lt;span class=&quot;demo-note&quot;&gt;Model         Status  Params  Memory Init  Memory Peak  Load time&lt;/span&gt;
&lt;span class=&quot;demo-note&quot;&gt;conversation  loaded     40M       157MiB       217MiB       73ms&lt;/span&gt;
&lt;span class=&quot;demo-note&quot;&gt;arithmetic    loaded     40M       156MiB       212MiB       97ms&lt;/span&gt;
&lt;span class=&quot;demo-note&quot;&gt;algebra       loaded     40M       156MiB       212MiB      140ms&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Models can be unloaded at any time too. Let&#39;s unload the arithmetic model:&lt;/p&gt;
&lt;pre class=&quot;terminal&quot; data-title=&quot;demo&quot;&gt;&lt;code&gt;&lt;span class=&quot;demo-input&quot;&gt;&amp;gt; /unload arithmetic&lt;/span&gt;
&lt;span class=&quot;demo-note&quot;&gt;Unloaded arithmetic&lt;/span&gt;

&lt;span class=&quot;demo-input&quot;&gt;&amp;gt; what is 12 * 6 * (30 - 2) + 1?&lt;/span&gt;
&lt;span class=&quot;demo-note&quot;&gt;No response.&lt;/span&gt;

&lt;span class=&quot;demo-input&quot;&gt;&amp;gt; how are you?&lt;/span&gt;
&lt;span class=&quot;demo-answer&quot;&gt;I&amp;#39;m doing well. How are you?&lt;/span&gt;
&lt;span class=&quot;demo-note&quot;&gt;conversation - 138ms (141ms) - 464 tokens/s (707 tokens/s)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The arithmetic model is unloaded so we get no response again. The rest stay
loaded and keep working.&lt;/p&gt;
&lt;h2 id=&quot;how-is-this-different-than-model-routing&quot;&gt;How is this different than model routing?&lt;/h2&gt;
&lt;p&gt;Model routing is a common way to work with more than one language model. A
router sits in front of the models and decides where each prompt goes. In most
of these setups the models are general and any of them can answer the prompt.
The router picks one that is good enough, cheap enough or available.&lt;/p&gt;
&lt;p&gt;There is no model router here so nothing reads the prompt first and decides
where it goes. Every loaded model gets the prompt. The models are specialized
and only the ones that know the domain answer the prompt. No model is picked in
advance.&lt;/p&gt;
&lt;p&gt;One may argue that sending prompts to all loaded models costs more than routing
them. That is a fair point. But the models are so small and they load and unload
almost instantly. And remember that a model uses only a small number of tokens
when it doesn&#39;t know the domain. By the way a model router can still sit in
front of these models. In fact I&#39;m thinking about implementing a model router
specifically for these small models.&lt;/p&gt;
&lt;h2 id=&quot;what-is-this-good-for&quot;&gt;What is this good for?&lt;/h2&gt;
&lt;p&gt;These models are good for specialized tasks. They are pretty accurate within
their domains and they are reluctant to answer anything else. That matters when
a wrong answer is worse than no answer. For example a support assistant for a
product or a learning app for children shouldn&#39;t answer questions about anything
else.&lt;/p&gt;
&lt;p&gt;They are also good when different capabilities are needed at different times.
Models can be loaded and unloaded as needed. For example an NPC in a game only
needs the models that match its role and an app only needs the models for the
feature in use.&lt;/p&gt;
&lt;h2 id=&quot;technical-details&quot;&gt;Technical Details&lt;/h2&gt;
&lt;p&gt;The three models have the same size. Each one has 12 layers, about 40 million
parameters and is trained on its own dataset.&lt;/p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Model&lt;/th&gt;&lt;th&gt;Training examples&lt;/th&gt;&lt;th&gt;Validation examples&lt;/th&gt;&lt;th&gt;Training time&lt;sup class=&quot;footnote-reference&quot;&gt;&lt;a href=&quot;#1&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/th&gt;&lt;th&gt;Validation accuracy&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;conversation&lt;/td&gt;&lt;td&gt;22,500&lt;/td&gt;&lt;td&gt;2,500&lt;/td&gt;&lt;td&gt;1h 13m&lt;/td&gt;&lt;td&gt;99.4%&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;arithmetic&lt;/td&gt;&lt;td&gt;64,881&lt;/td&gt;&lt;td&gt;7,209&lt;/td&gt;&lt;td&gt;22h 6m&lt;/td&gt;&lt;td&gt;98.8%&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;algebra&lt;/td&gt;&lt;td&gt;46,718&lt;/td&gt;&lt;td&gt;5,191&lt;/td&gt;&lt;td&gt;14h 6m&lt;/td&gt;&lt;td&gt;84.8%&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;Validation accuracy is the share of the validation examples that the model got
right. These examples are kept out of training.&lt;/p&gt;
&lt;p&gt;I&#39;m pretty sure that accuracy can go higher with larger datasets, longer
training, different batch sizes and other training parameters. Nevertheless
these are still great numbers for training on a single 16GB GPU&lt;sup class=&quot;footnote-reference&quot;&gt;&lt;a href=&quot;#1&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;hr class=&quot;break&quot;&gt;
&lt;p&gt;There is more to specialized small language models than a demo can show. If you
have any questions or comments feel free to reach out to me on
&lt;a rel=&quot;external&quot; href=&quot;https://x.com/devfacet&quot;&gt;X&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;footnote-definition&quot; id=&quot;1&quot;&gt;&lt;sup class=&quot;footnote-definition-label&quot;&gt;1&lt;/sup&gt;
&lt;p&gt;RTX 5060 Ti 16GB&lt;/p&gt;
&lt;/div&gt;
</content>
    
  </entry>
  
</feed>
