<?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: Anurag-Rj</title>
    <description>The latest articles on DEV Community by Anurag-Rj (@anuragrjarch).</description>
    <link>https://dev.to/anuragrjarch</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%2F3909412%2F5a67e17e-8b00-4498-afc6-1968850b232d.png</url>
      <title>DEV Community: Anurag-Rj</title>
      <link>https://dev.to/anuragrjarch</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anuragrjarch"/>
    <language>en</language>
    <item>
      <title>Protocol Buffers</title>
      <dc:creator>Anurag-Rj</dc:creator>
      <pubDate>Sun, 12 Jul 2026 15:34:33 +0000</pubDate>
      <link>https://dev.to/anuragrjarch/protocol-buffers-3kfn</link>
      <guid>https://dev.to/anuragrjarch/protocol-buffers-3kfn</guid>
      <description>&lt;p&gt;Protocol Buffers are language-neutral, platform-neutral extensible mechanisms for serializing structured data.&lt;/p&gt;

&lt;p&gt;How it looks: (filed number + wiretype)(value) = ( field number &amp;lt;&amp;lt; 3 | wiretype)(value) precise view.&lt;/p&gt;

&lt;p&gt;There are three terms here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Serializing structured data:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Suppose you have an object in Java:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;classUser&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="n"&gt;intid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;101&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nc"&gt;Stringname&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Anurag"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Computers cannot directly send Java objects over a network.&lt;/p&gt;

&lt;p&gt;So we convert the object into a format that can be transmitted or stored.&lt;/p&gt;

&lt;p&gt;This conversion process is called S*&lt;em&gt;erialization&lt;/em&gt;*.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;101&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"Anurag"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Protocol Buffers serialize the same data into a compact binary format instead of JSON.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Language-neutral:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You define the data structure once in a &lt;code&gt;.proto&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight protobuf"&gt;&lt;code&gt;&lt;span class="kd"&gt;message&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kt"&gt;int32&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From this single file, Protocol Buffers can generate classes for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Java&lt;/li&gt;
&lt;li&gt;Python&lt;/li&gt;
&lt;li&gt;Go&lt;/li&gt;
&lt;li&gt;C++&lt;/li&gt;
&lt;li&gt;C#&lt;/li&gt;
&lt;li&gt;JavaScript&lt;/li&gt;
&lt;li&gt;Kotlin&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So a Java service and a Python service can communicate using the same contract.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One definition → many programming languages.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Protocol buffers binary encoding
&lt;/h3&gt;

&lt;p&gt;Let’s suppose:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="nx"&gt;User&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nx"&gt;int32&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And suppose the value of age that is send is : 25&lt;/p&gt;

&lt;h4&gt;
  
  
  What protobuf actually sends
&lt;/h4&gt;

&lt;p&gt;Instead of sending&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"age"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"25"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;protobuf sends:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;08   19&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Only 2 bytes!&lt;/p&gt;

&lt;p&gt;Let's understand where they come from.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Part 1: Field number - It is the just the numbering/ordering of fields that is set in “.proto” file. Like as age is at 1 then the field number is 1.&lt;/li&gt;
&lt;li&gt;Part 2: Wire Type - A wire type tells protobuf what kind of data follows.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Data Type&lt;/th&gt;
&lt;th&gt;Wire Type&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;int32, int64, bool&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;string&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;embedded message&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight protobuf"&gt;&lt;code&gt;&lt;span class="kt"&gt;int32&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;wire type =&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;because it's an integer.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Part 3: Combine Field Number + Wire Type&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Protobuf stores them together:&lt;/p&gt;

&lt;p&gt;Formula:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;field_number&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;wire_type&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;field_number = 1
wire_type = 0

1 &amp;lt;&amp;lt; 3 | 0 = ( 1 * 2 ^ 3 ) | 0 = 8 | 0 = 1000 | 0 = 1000 = 8
So, the decimal we get is 8 we need to get it Hexadecimal representation: 08.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Part 4: Encode Value&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Value:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;25 in hexadecimal:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;So protobuf stores:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Final Payload
&lt;/h2&gt;

&lt;p&gt;Combine both parts:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Interpretation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;08 -&amp;gt; Field #1, Integer
19 -&amp;gt; Value 25
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>backend</category>
      <category>data</category>
      <category>java</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Understanding the Difference Between LLM, SLM, and FM</title>
      <dc:creator>Anurag-Rj</dc:creator>
      <pubDate>Sat, 02 May 2026 18:27:54 +0000</pubDate>
      <link>https://dev.to/anuragrjarch/understanding-the-difference-between-llm-slm-and-fm-4a4a</link>
      <guid>https://dev.to/anuragrjarch/understanding-the-difference-between-llm-slm-and-fm-4a4a</guid>
      <description>&lt;p&gt;In today’s AI-driven world, terms like LLM, SLM, and FM are often used interchangeably—but they represent different concepts with distinct roles. Let’s break them down in a simple and practical way 👇&lt;/p&gt;




&lt;h3&gt;
  
  
  🧠 &lt;strong&gt;1. Large Language Models (LLMs)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;LLMs are AI models trained on massive datasets to understand and generate human-like text.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Characteristics:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Trained on billions/trillions of tokens&lt;/li&gt;
&lt;li&gt;Strong at reasoning, conversation, and content generation&lt;/li&gt;
&lt;li&gt;Examples: GPT models, Claude&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use Cases:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Chatbots&lt;/li&gt;
&lt;li&gt;Code generation&lt;/li&gt;
&lt;li&gt;Content writing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 Think of LLMs as &lt;strong&gt;general-purpose brains for language tasks&lt;/strong&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  ⚡ &lt;strong&gt;2. Small Language Models (SLMs)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;SLMs are lightweight versions of LLMs, designed for efficiency rather than scale.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Characteristics:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Smaller in size → faster and cheaper&lt;/li&gt;
&lt;li&gt;Can run locally or on edge devices&lt;/li&gt;
&lt;li&gt;More focused, less generalized&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use Cases:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mobile AI apps&lt;/li&gt;
&lt;li&gt;On-device assistants&lt;/li&gt;
&lt;li&gt;Low-latency systems&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 Think of SLMs as &lt;strong&gt;compact, efficient versions of LLMs&lt;/strong&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  🏗️ &lt;strong&gt;3. Foundation Models (FMs)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Foundation Models are a broader category that includes models trained on large-scale data and can be adapted for multiple tasks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Characteristics:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pretrained on diverse datasets (text, images, etc.)&lt;/li&gt;
&lt;li&gt;Can be fine-tuned for specific applications&lt;/li&gt;
&lt;li&gt;Includes LLMs as a subset&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use Cases:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Multimodal AI (text + image + audio)&lt;/li&gt;
&lt;li&gt;Domain-specific fine-tuning&lt;/li&gt;
&lt;li&gt;Enterprise AI solutions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 Think of FMs as the &lt;strong&gt;base layer on which specialized AI systems are built&lt;/strong&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  🧩 &lt;strong&gt;Quick Comparison&lt;/strong&gt;
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;LLM&lt;/th&gt;
&lt;th&gt;SLM&lt;/th&gt;
&lt;th&gt;FM&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Size&lt;/td&gt;
&lt;td&gt;Very Large&lt;/td&gt;
&lt;td&gt;Small&lt;/td&gt;
&lt;td&gt;Large (varies)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Scope&lt;/td&gt;
&lt;td&gt;Language-focused&lt;/td&gt;
&lt;td&gt;Language-focused&lt;/td&gt;
&lt;td&gt;Broad (multi-domain)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flexibility&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Very High&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Performance&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Optimized efficiency&lt;/td&gt;
&lt;td&gt;Depends on fine-tuning&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h3&gt;
  
  
  🚀 &lt;strong&gt;Final Takeaway&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;LLMs&lt;/strong&gt; → Powerful, general-purpose language models&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SLMs&lt;/strong&gt; → Lightweight, efficient alternatives&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FMs&lt;/strong&gt; → The bigger umbrella that includes LLMs and beyond&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Understanding these differences helps you choose the right model based on &lt;strong&gt;scale, performance, and use-case requirements&lt;/strong&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  AI #MachineLearning #LLM #SLM #FoundationModels #TechExplained #ArtificialIntelligence
&lt;/h1&gt;

</description>
      <category>ai</category>
      <category>beginners</category>
      <category>llm</category>
      <category>nlp</category>
    </item>
  </channel>
</rss>
