<?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: Yashwanth</title>
    <description>The latest articles on DEV Community by Yashwanth (@yash_softeng).</description>
    <link>https://dev.to/yash_softeng</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%2F1329170%2Fd63e4c08-ce10-4632-b3c1-b29726c5f99f.png</url>
      <title>DEV Community: Yashwanth</title>
      <link>https://dev.to/yash_softeng</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yash_softeng"/>
    <language>en</language>
    <item>
      <title>Generative AI: Under the hood</title>
      <dc:creator>Yashwanth</dc:creator>
      <pubDate>Sun, 17 Aug 2025 11:31:24 +0000</pubDate>
      <link>https://dev.to/yash_softeng/generative-ai-under-the-hood-208</link>
      <guid>https://dev.to/yash_softeng/generative-ai-under-the-hood-208</guid>
      <description>&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Generative AI doesn’t just search—it creates (text, images, music, etc.).&lt;/li&gt;
&lt;li&gt;It’s powered by Transformers (introduced by Google in 2017).&lt;/li&gt;
&lt;li&gt;Language is broken into tokens (small pieces of text) that the model predicts step by step.&lt;/li&gt;
&lt;li&gt;Each model has its own vocabulary &amp;amp; token rules, so token splits can differ.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 Think of Generative AI as a creative engine, tokens as its alphabet, and transformers as the brain that puts it all together.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction:
&lt;/h2&gt;

&lt;p&gt;Imagine typing just a few words, and an AI writes an entire story for you, paints a picture, or even composes music. That’s the magic of Generative AI—it doesn’t just find information, it creates something new.&lt;/p&gt;

&lt;p&gt;Take Google Search as an example: when you enter a query, it’s like asking a librarian for a book. The librarian fetches the best book already on the shelf.&lt;/p&gt;

&lt;p&gt;Generative AI, on the other hand, is like an author. You give it an idea, and it writes you a brand-new book on the spot.&lt;/p&gt;

&lt;h3&gt;
  
  
  GPT(Generative Pre-Trained Transformer):
&lt;/h3&gt;

&lt;p&gt;One of the most famous Generative AI models is GPT.&lt;/p&gt;

&lt;p&gt;In simple words, GPT is a Transformer that has been trained on a huge amount of data, and now it can generate new text based on that training.&lt;/p&gt;

&lt;h4&gt;
  
  
  What is a Transformer?
&lt;/h4&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.amazonaws.com%2Fuploads%2Farticles%2Fg5asclr0qirs25g2puq0.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.amazonaws.com%2Fuploads%2Farticles%2Fg5asclr0qirs25g2puq0.png" alt="Simple Transformer Image" width="778" height="236"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Think of a Transformer as a very smart system that can look at words (or images, or sounds), understand how they relate to each other, and then predict what comes next.&lt;/p&gt;

&lt;p&gt;Originally introduced by Google in 2017 in the paper &lt;a href="https://research.google/pubs/attention-is-all-you-need/" rel="noopener noreferrer"&gt;“Attention is All You Need”&lt;/a&gt;, Transformers were first used in Google Translate to make translations smoother and more accurate.&lt;/p&gt;

&lt;p&gt;Today, GPT uses the same idea — but instead of just translating, it generates brand-new text.&lt;/p&gt;

&lt;p&gt;In practice, it works by predicting the next token. A token can be as small as a character or as large as a word or sentence, depending on the model. These tokens differ from LLM to LLM.&lt;/p&gt;

&lt;p&gt;A computer will only understand numbers. When an input token or a sequence(a collection of tokens) is provided, it is split and converted into numbers so this process is called &lt;strong&gt;Tokenization&lt;/strong&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Vocabulary in LLMs
&lt;/h4&gt;

&lt;p&gt;OpenAI (and other LLMs) don’t read text the way humans do.&lt;br&gt;
Instead, they convert text into numbers—because computers understand numbers, not letters.&lt;/p&gt;

&lt;p&gt;To do this, the model uses a vocabulary (a special “dictionary”) where:&lt;/p&gt;

&lt;p&gt;A character, word, or even part of a word is assigned a unique number (called a token ID).&lt;br&gt;
For example:&lt;br&gt;
"cat" → 1234&lt;br&gt;
"dog" → 5678&lt;br&gt;
"ing" → 91011&lt;/p&gt;

&lt;p&gt;When you type something like “The cat is running”, the model breaks it into tokens:&lt;/p&gt;

&lt;p&gt;"The" → 101&lt;br&gt;
" cat" → 1234&lt;br&gt;
" is" → 202&lt;br&gt;
" run" → 3300&lt;br&gt;
"ing" → 91011&lt;/p&gt;

&lt;p&gt;So your text becomes a sequence of numbers:&lt;br&gt;
[101, 1234, 202, 3300, 91011]&lt;/p&gt;

&lt;p&gt;This numeric form is what the Transformer processes to predict the next token.&lt;/p&gt;

&lt;p&gt;👉 Key Point for Beginners:&lt;br&gt;
You can say, “Vocabulary = the mapping of text to numbers that the AI understands.”&lt;/p&gt;

&lt;p&gt;Try generating the token for your message here: &lt;a href="https://tiktokenizer.vercel.app/" rel="noopener noreferrer"&gt;TikTokenizer&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Each LLM has its own vocabulary and vocabulary size, so the way a sentence is split into tokens and assigned numbers may differ depending on the model.&lt;/p&gt;

&lt;h4&gt;
  
  
  Comparison between two different Models:
&lt;/h4&gt;

&lt;p&gt;Input: "Generative Pre-Trained Transformer".&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;gpt-4o&lt;/strong&gt;: &lt;br&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.amazonaws.com%2Fuploads%2Farticles%2Fcyhw3edztl7a2pqppsgm.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.amazonaws.com%2Fuploads%2Farticles%2Fcyhw3edztl7a2pqppsgm.png" alt="Tokenization by gpt-4o" width="391" height="37"&gt;&lt;/a&gt;&lt;br&gt;
      Token count: 6&lt;br&gt;
      Tokens: 5926, 1799, 4659, 61607, 3883, 113133&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;davinci&lt;/strong&gt;:&lt;br&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.amazonaws.com%2Fuploads%2Farticles%2Fikr9kouaz5ktmd061xqx.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.amazonaws.com%2Fuploads%2Farticles%2Fikr9kouaz5ktmd061xqx.png" alt="Tokenization by davinci" width="384" height="33"&gt;&lt;/a&gt;&lt;br&gt;
      Token count: 8&lt;br&gt;
      Tokens: 8645, 876, 3771, 12, 2898, 1328, 3602, 16354&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In Progress....🚧🚧🚧&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>programming</category>
      <category>ai</category>
      <category>python</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
