<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ketakikasar on Medium]]></title>
        <description><![CDATA[Stories by Ketakikasar on Medium]]></description>
        <link>https://medium.com/@ketakikasar93?source=rss-121467d9f9d2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*u2la_fyo4yzoPBtE</url>
            <title>Stories by Ketakikasar on Medium</title>
            <link>https://medium.com/@ketakikasar93?source=rss-121467d9f9d2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 10:33:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ketakikasar93/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Step 4 — Model Architecture (Transformer Architecture)]]></title>
            <link>https://medium.com/@ketakikasar93/step-4-model-architecture-transformer-architecture-40b8811893a3?source=rss-121467d9f9d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/40b8811893a3</guid>
            <dc:creator><![CDATA[Ketakikasar]]></dc:creator>
            <pubDate>Mon, 31 Aug 2026 05:19:38 GMT</pubDate>
            <atom:updated>2026-08-31T05:19:38.342Z</atom:updated>
            <content:encoded><![CDATA[<p>Previous Post (Step 3.2): <a href="https://medium.com/@ketakikasar93/step-3-2-indexing-ddabe91c0fd2?sharedUserId=ketakikasar93">https://medium.com/@ketakikasar93/step-3-2-indexing-ddabe91c0fd2?sharedUserId=ketakikasar93</a></p><p>In the previous posts, we explored how data is created, tokenized, converted into embeddings, chunked, and indexed.</p><p>Now we reach one of the most important steps in building modern AI models:</p><h3>Step 4 — Model Architecture</h3><p>So far, we have converted our text into numerical representations.</p><p>But how does a model actually <strong>understand the relationship between these numbers?</strong></p><p>This is where the <strong>Transformer architecture</strong> comes in.</p><h3>What is a Transformer?</h3><p>A <strong>Transformer</strong> is a neural network architecture designed to process sequences of data and understand relationships between different elements in that sequence.</p><p>It was introduced in the famous 2017 research paper:</p><blockquote><strong><em>“Attention Is All You Need.”</em></strong></blockquote><p>The key idea behind Transformers is <strong>Attention</strong>.</p><p>In very simple terms:</p><blockquote><strong><em>Attention allows the model to determine which parts of the input are important when understanding a particular part of the input.</em></strong></blockquote><h3>Different Transformer Architectures</h3><p>The Transformer isn&#39;t limited to one specific architecture.</p><p>Different variations have been developed for different tasks.</p><p>A simple classification is:</p><pre>Transformers<br>│<br>├── Encoder-only<br>│<br>├── Decoder-only<br>│<br>├── Encoder-Decoder<br>│<br>├── Vision Transformers<br>│<br>├── Multimodal Transformers<br>│<br>└── Other specialized Transformers</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40b8811893a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Step 3.2 — Indexing]]></title>
            <link>https://medium.com/@ketakikasar93/step-3-2-indexing-ddabe91c0fd2?source=rss-121467d9f9d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/ddabe91c0fd2</guid>
            <dc:creator><![CDATA[Ketakikasar]]></dc:creator>
            <pubDate>Mon, 31 Aug 2026 04:46:59 GMT</pubDate>
            <atom:updated>2026-08-31T04:46:59.931Z</atom:updated>
            <content:encoded><![CDATA[<p>Previous Post (Step 3.2): <a href="https://medium.com/@ketakikasar93/step-3-1-chunking-385afe62dd1e?sharedUserId=ketakikasar93">https://medium.com/@ketakikasar93/step-3-1-chunking-385afe62dd1e?sharedUserId=ketakikasar93</a></p><p>In the previous post, we discussed <strong>Chunking</strong> — breaking large documents into smaller, meaningful pieces.</p><p>Once we have these chunks, we convert them into <strong>embeddings (vectors)</strong>.</p><p>But imagine having <strong>millions of vectors</strong>.</p><p>How do we quickly find the vectors most similar to a user’s query?</p><p>This is where <strong>indexing</strong> comes in.</p><h3>What is Indexing?</h3><blockquote><strong><em>Indexing is the process of organizing vectors in a structured way so that similar vectors can be searched efficiently.</em></strong></blockquote><h3>Common Indexing Approaches</h3><p>Some commonly used approaches include:</p><ul><li><strong>Flat / Brute-Force Index</strong> — compares the query against all vectors; simple but expensive at large scale.</li><li><strong>Tree-Based Index</strong> — organizes vectors using tree-like structures to reduce the search space.</li><li><strong>Inverted File (IVF)</strong> — divides vectors into clusters and searches only relevant clusters.</li><li><strong>HNSW</strong> — builds a graph of vectors to efficiently navigate toward similar vectors.</li><li><strong>Product Quantization (PQ)</strong> — compresses vectors to reduce memory usage and speed up search.</li></ul><p>The choice of indexing strategy depends on factors such as <strong>dataset size, search speed, memory requirements, and accuracy</strong>.</p><h3>Step 4 — Model Architecture</h3><p>Here, we will explore the architecture that powers modern LLMs: <strong>Transformers and Attention</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ddabe91c0fd2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Step 3.1 — Chunking]]></title>
            <link>https://medium.com/@ketakikasar93/step-3-1-chunking-385afe62dd1e?source=rss-121467d9f9d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/385afe62dd1e</guid>
            <dc:creator><![CDATA[Ketakikasar]]></dc:creator>
            <pubDate>Thu, 27 Aug 2026 11:41:30 GMT</pubDate>
            <atom:updated>2026-08-27T11:41:30.995Z</atom:updated>
            <content:encoded><![CDATA[<p>Previous Post (Step 2):<a href="https://medium.com/@ketakikasar93/step-3-embeddings-e4adc75ce03f?sharedUserId=ketakikasar93">https://medium.com/@ketakikasar93/step-3-embeddings-e4adc75ce03f?sharedUserId=ketakikasar93</a></p><p>In the previous post, we discussed Step 3 — Embeddings and understood how text or other forms of data can be converted into numerical vectors.</p><h3><strong>What is Chunking ?</strong></h3><p>Imagine that we have a 200-page PDF.</p><p>If we create one embedding for the entire PDF, it becomes difficult to retrieve a small piece of information from it.</p><p>Instead, we divide the document into smaller pieces called chunks.</p><p>For example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/1*1xHPsVTAmZNMmiluSBnoHA.png" /></figure><p>Each chunk can then be converted into an embedding:<br>Chunk 1 → Vector 1<br>Chunk 2 → Vector 2<br>Chunk 3 → Vector 3<br>…<br>Chunk N → Vector N</p><p><strong>The objective is simple:</strong></p><p>Create chunks that contain enough information to be meaningful, but are small enough to be efficiently retrieved.</p><p>There is no single chunking strategy that works best for every use case.</p><h3><strong>Common Chunking Strategies</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*miNJKFnsYFOpOWMCY7w1Hg.png" /><figcaption>Chunking Strategies</figcaption></figure><p><strong>The important takeaway is:</strong></p><p>Chunking is not simply about splitting text into equal pieces. It is about creating meaningful units of information that can later be retrieved effectively.</p><h3>Step 3.2 — Indexing</h3><p>Once we have created chunks and generated embeddings for them, we need an efficient way to store and search those embeddings. This is where indexing comes in.</p><p>Suppose we have:</p><p>Chunk 1 → Vector 1<br>Chunk 2 → Vector 2<br>Chunk 3 → Vector 3<br>…<br>Chunk N → Vector N</p><p>If we have millions of vectors, comparing a query against every single vector can become expensive.</p><p>An index organizes these vectors in a way that allows us to find similar vectors more efficiently.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=385afe62dd1e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Step 3: Embeddings]]></title>
            <link>https://medium.com/@ketakikasar93/step-3-embeddings-e4adc75ce03f?source=rss-121467d9f9d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4adc75ce03f</guid>
            <dc:creator><![CDATA[Ketakikasar]]></dc:creator>
            <pubDate>Thu, 27 Aug 2026 04:45:26 GMT</pubDate>
            <atom:updated>2026-08-27T04:45:26.705Z</atom:updated>
            <content:encoded><![CDATA[<p>Previous Post (Step 2): <a href="https://medium.com/@ketakikasar93/step-2-tokenization-b2fe7d9a6ef2?sharedUserId=ketakikasar93">https://medium.com/@ketakikasar93/step-2-tokenization-b2fe7d9a6ef2?sharedUserId=ketakikasar93</a></p><p>We saw how text can be broken down into smaller units such as characters, words, subwords, or bytes.</p><p>For example:</p><pre>&quot;The cat is sleeping.&quot;</pre><pre>        ↓ Tokenization</pre><pre>[&quot;The&quot;, &quot;cat&quot;, &quot;is&quot;, &quot;sleeping&quot;, &quot;.&quot;]</pre><p>But there is still a problem.</p><p>A neural network doesn’t understand the token &quot;cat&quot; as a concept.</p><p>It needs numbers.</p><p>This is where <strong>embeddings</strong> come into the picture.</p><h3>What are Embeddings?</h3><p>In very simple terms:</p><blockquote><strong><em>An embedding is a numerical representation of data that captures useful relationships and meaning.</em></strong></blockquote><p>A token such as:</p><pre>&quot;cat&quot;</pre><p>can be converted into a vector of numbers:</p><pre>cat<br> ↓<br>[0.21, -0.45, 0.73, 0.12, ...]</pre><p>Similarly:</p><pre>dog<br> ↓<br>[0.19, -0.41, 0.69, 0.15, ...]</pre><p>The actual numbers are not important for us right now.</p><p>What matters is that <strong>similar or related concepts can have similar representations in the embedding space</strong>.</p><p>For example, conceptually:</p><pre>cat  ──────┐<br>           │<br>dog  ──────┤  Similar representations<br>           │<br>lion ──────┘</pre><pre>car  ─────────────── Farther away</pre><p>This allows mathematical operations to be performed on language and other types of data.</p><p>So the simplified journey is:</p><pre>Human Text<br>    ↓<br>Tokenization<br>    ↓<br>Tokens<br>    ↓<br>Token IDs<br>    ↓<br>Embeddings<br>    ↓<br>Numerical Vectors<br>    ↓<br>Neural Network</pre><p>This is one of the fundamental ideas behind modern AI systems.</p><h3>Types of Embeddings</h3><p>There are several ways to classify embeddings.</p><p>We can broadly categorize them based on:</p><ol><li><strong>What is being represented</strong></li><li><strong>What type of data is being represented</strong></li><li><strong>How the embedding is learned</strong></li><li><strong>Where it appears inside a Transformer</strong></li></ol><p>Let’s look at each one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uNS3Y0rW_VpYFss745KoFg.png" /></figure><h3>1. Embeddings Based on Representation</h3><p>The first way to classify embeddings is based on <strong>the size or level of the information being represented</strong>.</p><pre>Embeddings<br>│<br>├── Token Embedding<br>├── Word Embedding<br>├── Phrase Embedding<br>├── Sentence Embedding<br>├── Paragraph Embedding<br>└── Document Embedding</pre><h3>1.1 Token Embedding</h3><p>A <strong>token embedding</strong> represents an individual token as a numerical vector.</p><p>For example:</p><pre>&quot;cat&quot;<br>   ↓<br>[0.21, -0.43, 0.67, ...]</pre><p>In modern LLMs, tokens may represent complete words, subwords, or even other units depending on the tokenizer.</p><h3>1.2 Word Embedding</h3><p>A <strong>word embedding</strong> represents a complete word as a vector.</p><p>For example:</p><pre>king → [vector]<br>queen → [vector]<br>man → [vector]<br>woman → [vector]</pre><p>Words with related meanings or usage patterns can have related representations.</p><p>Classic techniques such as <strong>Word2Vec</strong> and <strong>GloVe</strong> are examples of word-embedding approaches.</p><h3>1.3 Phrase Embedding</h3><p>A <strong>phrase embedding</strong> represents a group of words or a short phrase as a single vector.</p><p>For example:</p><pre>&quot;machine learning&quot;<br>        ↓<br>     [vector]</pre><p>The embedding attempts to capture the meaning of the phrase as a whole rather than treating each word independently.</p><h3>1.4 Sentence Embedding</h3><p>A <strong>sentence embedding</strong> represents an entire sentence as a single vector.</p><p>For example:</p><pre>&quot;The cat is sleeping.&quot;<br>        ↓<br>     [vector]</pre><p>This is particularly useful when we want to compare the semantic similarity between sentences.</p><h3>1.5 Paragraph Embedding</h3><p>A <strong>paragraph embedding</strong> represents a complete paragraph as a vector.</p><p>For example:</p><pre>Paragraph<br>    ↓<br>Single vector</pre><p>It captures the overall information or semantic content of the paragraph rather than individual words.</p><h3>1.6 Document Embedding</h3><p>A <strong>document embedding</strong> represents an entire document as a vector.</p><p>For example:</p><pre>PDF / Article / Report<br>          ↓<br>      [vector]</pre><p>Document embeddings are useful for tasks such as document similarity, semantic search, clustering, and retrieval.</p><h3>2. Embeddings Based on Data</h3><p>Embeddings are not limited to text.</p><p>Almost any type of data can potentially be converted into a useful numerical representation.</p><pre>Embeddings<br>│<br>├── Text Embedding<br>├── Image Embedding<br>├── Audio Embedding<br>├── Video Embedding<br>├── Code Embedding<br>├── Graph Embedding<br>└── Multimodal Embedding</pre><h3>2.1 Text Embedding</h3><p>A <strong>text embedding</strong> converts text into a numerical vector that captures useful linguistic or semantic information.</p><p>For example:</p><pre>&quot;Machine learning is useful.&quot;<br>              ↓<br>           [vector]</pre><p>Text embeddings are widely used in semantic search, recommendation systems, clustering, and RAG systems.</p><h3>2.2 Image Embedding</h3><p>An <strong>image embedding</strong> converts an image into a numerical vector representing visual information.</p><p>For example:</p><pre>Image of a cat<br>       ↓<br>    [vector]</pre><p>Images with similar visual characteristics can have similar representations.</p><h3>2.3 Audio Embedding</h3><p>An <strong>audio embedding</strong> converts an audio signal or speech segment into a numerical representation.</p><p>For example:</p><pre>Speech / Music / Sound<br>          ↓<br>       [vector]</pre><p>These embeddings can be used for tasks such as speech recognition, speaker identification, and audio similarity.</p><h3>2.4 Video Embedding</h3><p>A <strong>video embedding</strong> represents information from a video as a numerical vector or sequence of vectors.</p><p>It can capture information from both the <strong>visual content and temporal changes</strong> within the video.</p><p>For example:</p><pre>Video<br>  ↓<br>Frames + temporal information<br>  ↓<br>Embedding</pre><h3>2.5 Code Embedding</h3><p>A <strong>code embedding</strong> represents source code as a numerical vector.</p><p>For example:</p><pre>def add(a, b):<br>    return a + b</pre><p>can be converted into an embedding that captures useful information about the code.</p><p>Code embeddings can be useful for code search, code similarity, classification, and AI-powered developer tools.</p><h3>2.6 Graph Embedding</h3><p>A <strong>graph embedding</strong> represents elements of a graph — such as nodes, edges, or the graph itself — as numerical vectors.</p><p>For example:</p><pre>Customer → Account → Transaction</pre><p>can be represented mathematically so that relationships within the graph can be captured.</p><p>Graph embeddings are useful in areas such as recommendation systems, fraud detection, and knowledge graphs.</p><h3>2.7 Multimodal Embedding</h3><p>A <strong>multimodal embedding</strong> represents different types of data in a common or related embedding space.</p><p>For example:</p><pre>Image ───────┐<br>             │<br>Text ────────┼──→ Embedding Space<br>             │<br>Audio ───────┘</pre><p>This allows different modalities to be compared or connected.</p><p>For example, an image of a dog and the text:</p><blockquote><strong><em>“A dog running in a park.”</em></strong></blockquote><p>could potentially have related representations.</p><p>This concept is particularly important in <strong>multimodal AI</strong>.</p><h3>3. Embeddings Based on How They Are Learned</h3><p>Another way to categorize embeddings is based on whether the representation is fixed or depends on context.</p><pre>Embeddings<br>│<br>├── Static Embedding<br>└── Contextual Embedding</pre><h3>3.1 Static Embedding</h3><p>A <strong>static embedding</strong> gives a word or token essentially the same vector regardless of the sentence in which it appears.</p><p>For example:</p><pre>&quot;bank&quot;</pre><p>would have the same embedding in:</p><blockquote><em>“I went to the bank.”</em></blockquote><p>and:</p><blockquote><em>“The river bank was beautiful.”</em></blockquote><p>This can be a limitation because the meaning of “bank” changes depending on context.</p><h3>3.2 Contextual Embedding</h3><p>A <strong>contextual embedding</strong> considers the surrounding words when creating the representation.</p><p>Therefore:</p><pre>&quot;I went to the bank.&quot;</pre><pre>             ↓<br>        bank → Vector A</pre><p>and:</p><pre>&quot;The river bank was beautiful.&quot;</pre><pre>             ↓<br>        bank → Vector B</pre><p>can produce different representations.</p><p>This ability to incorporate context is a major characteristic of modern Transformer-based language models.</p><h3>4. Embeddings Inside Transformers</h3><p>Now let’s connect embeddings directly to the architecture of modern LLMs.</p><p>Inside a Transformer-based model, we commonly encounter concepts such as:</p><pre>Transformer<br>│<br>├── Token Embedding<br>├── Positional Embedding / Encoding<br>└── Contextual Representations</pre><p>Let’s understand them very briefly.</p><h3>4.1 Token Embedding</h3><p>The tokenizer converts text into token IDs.</p><p>For example:</p><pre>&quot;The cat&quot;<br>    ↓<br>[&quot;The&quot;, &quot;cat&quot;]<br>    ↓<br>[1024, 5821]</pre><p>The token IDs are then mapped to vectors through a <strong>token embedding layer</strong>.</p><pre>Token ID<br>   ↓<br>Embedding Layer<br>   ↓<br>Vector</pre><p>These vectors become the initial numerical representations that enter the Transformer.</p><h3>4.2 Positional Embedding</h3><p>A Transformer also needs information about <strong>where a token occurs in the sequence</strong>.</p><p>Consider:</p><blockquote><em>“Dog bites man.”</em></blockquote><p>and:</p><blockquote><em>“Man bites dog.”</em></blockquote><p>The same words are present, but their order changes the meaning.</p><p>Therefore, the model needs some representation of token position.</p><p>This is handled through <strong>positional information</strong>, which may be implemented using positional embeddings or positional encodings depending on the architecture.</p><p>Conceptually:</p><pre>Token information<br>       +<br>Position information<br>       ↓<br>Information given to Transformer</pre><p>The exact positional mechanism varies across modern Transformer architectures.</p><h3>4.3 Contextual Embedding / Representation</h3><p>After the tokens pass through the Transformer layers and attention mechanisms, their representations become <strong>context-aware</strong>.</p><p>For example:</p><pre>&quot;The dog chased the cat.&quot;</pre><pre>        ↓ Transformer</pre><pre>Context-aware representations</pre><p>The representation of &quot;dog&quot; can now be influenced by the surrounding words.</p><p>This is why we can think of the model’s internal representations as becoming increasingly contextual as information flows through the Transformer.</p><h3>Step 3.1 — Chunking</h3><p>Before we move forward, there is another concept that frequently appears when working with embeddings:</p><p><strong>Chunking.</strong></p><p>Chunking means breaking a large piece of text into <strong>smaller sections or chunks</strong>.</p><p>For example, suppose we have a 50-page document.</p><p>Instead of creating one embedding for the entire document, we can divide it into smaller pieces:</p><pre>50-page document<br>       ↓<br>   Chunk 1<br>   Chunk 2<br>   Chunk 3<br>   Chunk 4<br>      ...<br>   Chunk N</pre><p>Each chunk can then be converted into its own embedding:</p><pre>Chunk 1 → Vector 1<br>Chunk 2 → Vector 2<br>Chunk 3 → Vector 3<br>...<br>Chunk N → Vector N</pre><p>This is particularly important in <strong>RAG (Retrieval-Augmented Generation)</strong> systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4adc75ce03f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Step 2: Tokenization]]></title>
            <link>https://medium.com/@ketakikasar93/step-2-tokenization-b2fe7d9a6ef2?source=rss-121467d9f9d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2fe7d9a6ef2</guid>
            <dc:creator><![CDATA[Ketakikasar]]></dc:creator>
            <pubDate>Wed, 26 Aug 2026 10:22:29 GMT</pubDate>
            <atom:updated>2026-08-26T10:22:29.147Z</atom:updated>
            <content:encoded><![CDATA[<p>Previous Post (Step 1:Data Creation): <a href="https://medium.com/@ketakikasar93/step-1-data-creation-f597a31efed7?sharedUserId=ketakikasar93">https://medium.com/@ketakikasar93/step-1-data-creation-f597a31efed7?sharedUserId=ketakikasar93</a></p><p>GitHub link for each algorithm: <a href="https://github.com/kasar0206/tokenization-algorithms">https://github.com/kasar0206/tokenization-algorithms</a></p><p>In the previous post, we explored the <strong>first step in building an LLM: Data Creation</strong>.</p><p>We saw how raw data is collected from sources such as the internet, books, GitHub, Wikipedia, research papers, and other datasets. We also discussed why that data needs to be cleaned, filtered, deduplicated, and de-identified before it can be used for training.</p><p>But there is a fundamental problem.</p><p>Computers don’t understand a sentence like:</p><blockquote><strong><em>“The books are interesting.”</em></strong></blockquote><p>the same way humans do.</p><p>A neural network works with <strong>numbers</strong>.</p><p>So, before text can be passed into an LLM, we need a way to convert human language into smaller pieces that the model can process.</p><p>This is where <strong>tokenization</strong> comes in.</p><h3>What is Tokenization?</h3><p><strong>Tokenization is the process of breaking text into smaller units called tokens.</strong></p><p>Depending on the tokenizer, a token could be:</p><ul><li>A character</li><li>A word</li><li>Part of a word</li><li>A byte</li><li>A combination of frequently occurring characters or subwords</li></ul><p>For example, the sentence:</p><blockquote><strong><em>“I love books.”</em></strong></blockquote><p>could potentially be represented as:</p><pre>&quot;I&quot; | &quot;love&quot; | &quot;books&quot; | &quot;.&quot;</pre><p>These are our <strong>tokens</strong>.</p><p>But tokenization doesn’t stop here.</p><p>An LLM cannot directly process the strings &quot;I&quot;, &quot;love&quot;, and &quot;books&quot;.</p><p>The tokens are eventually mapped to numerical IDs:</p><pre>Text<br>  ↓<br>Tokens<br>  ↓<br>Token IDs<br>  ↓<br>Embeddings<br>  ↓<br>Model</pre><p>For example, conceptually:</p><pre>&quot;I love books.&quot;</pre><pre>        ↓</pre><pre>[&quot;I&quot;, &quot;love&quot;, &quot;books&quot;, &quot;.&quot;]</pre><pre>        ↓</pre><pre>[41, 892, 1572, 13]</pre><pre>        ↓</pre><pre>Numerical representations</pre><pre>        ↓</pre><pre>Neural Network</pre><p>The actual token IDs will depend on the tokenizer and its vocabulary.</p><p>So tokenization is essentially the <strong>bridge between human language and the numerical world of neural networks</strong>.</p><p>GitHub link for each algorithm: <a href="https://github.com/kasar0206/tokenization-algorithms">https://github.com/kasar0206/tokenization-algorithms</a></p><p>Different tokenization algorithms are as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w2ryyIngdm0vTYbBikVSMw.png" /></figure><h3>1. Character Tokenization</h3><p>The simplest approach is to treat <strong>every character as a token</strong>.</p><p>For example:</p><pre>books</pre><p>becomes:</p><pre>[&quot;b&quot;, &quot;o&quot;, &quot;o&quot;, &quot;k&quot;, &quot;s&quot;]</pre><p>Spaces and punctuation can also be treated as tokens.</p><p>The vocabulary is therefore relatively small because we only need to represent the characters that appear in the language.</p><h3>Advantages</h3><ul><li>Very simple.</li><li>Small vocabulary.</li><li>Can handle words that the tokenizer has never seen before.</li><li>Can represent unusual words and spellings.</li></ul><h3>Disadvantages</h3><ul><li>Produces many tokens.</li><li>Individual characters carry very little meaning.</li><li>A long piece of text can result in a very large number of tokens.</li><li>Processing becomes more expensive as the sequence becomes longer.</li></ul><p>For example:</p><pre>&quot;unbelievable&quot;</pre><p>might become:</p><pre>u | n | b | e | l | i | e | v | a | b | l | e</pre><p>Humans naturally see one word.</p><p>The model sees twelve separate tokens.</p><h3>2. Word Tokenization</h3><p>The next obvious approach is:</p><p><strong>Why not simply make every word a token?</strong></p><p>For example:</p><pre>&quot;The books are interesting.&quot;</pre><pre>        ↓</pre><pre>[&quot;The&quot;, &quot;books&quot;, &quot;are&quot;, &quot;interesting&quot;]</pre><p>This is much closer to how humans think about language.</p><p>Each token generally has a clear meaning.</p><p>However, this approach creates another problem:</p><h3>Vocabulary size</h3><p>Consider these words:</p><pre>play<br>plays<br>played<br>playing<br>player<br>playful</pre><p>If every word is treated independently, all of these become separate tokens.</p><p>The vocabulary can therefore become extremely large.</p><p>There is another problem:</p><h3>Unknown words</h3><p>Suppose the tokenizer has never encountered:</p><blockquote><strong><em>“Chatification”</em></strong></blockquote><p>What should it do?</p><p>This is commonly referred to as an <strong>out-of-vocabulary (OOV)</strong> problem.</p><p>Word tokenization therefore has a fundamental trade-off:</p><blockquote><em>Larger vocabulary → fewer tokens<br>Smaller vocabulary → more unknown words</em></blockquote><h3>Advantages</h3><ul><li>Very easy to understand.</li><li>Tokens generally have clear semantic meaning.</li><li>Usually requires fewer tokens than character tokenization.</li></ul><h3>Disadvantages</h3><ul><li>Requires a very large vocabulary.</li><li>Unknown words can be problematic.</li><li>Morphologically related words may be treated as completely different tokens.</li></ul><p>For example:</p><pre>play<br>playing<br>played</pre><p>could all be three independent tokens.</p><p>This limitation motivated the development of <strong>subword tokenization</strong>.</p><h3>3. Byte Pair Encoding (BPE)</h3><p>Now we get to one of the most important ideas in modern NLP.</p><p><strong>Byte Pair Encoding</strong>, commonly called <strong>BPE</strong>, is a subword tokenization technique.</p><p>Instead of deciding:</p><blockquote><em>“One word = one token”</em></blockquote><p>or:</p><blockquote><em>“One character = one token”</em></blockquote><p>BPE tries to find a useful middle ground.</p><p>The basic idea is:</p><blockquote><em>Start with small units and repeatedly merge frequently occurring neighboring units.</em></blockquote><p>Let’s take a simplified example.</p><p>Suppose our training corpus contains:</p><pre>low<br>lower<br>lowest</pre><p>Initially, we might have:</p><pre>l | o | w</pre><p>If:</p><pre>l + o</pre><p>appears frequently, the tokenizer can learn a merge:</p><pre>l + o → lo</pre><p>Then:</p><pre>lo + w → low</pre><p>So the word:</p><pre>low</pre><p>can eventually become:</p><pre>[&quot;low&quot;]</pre><p>But for:</p><pre>lowest</pre><p>the tokenizer might represent it as:</p><pre>[&quot;low&quot;, &quot;est&quot;]</pre><p>This is powerful because the tokenizer can represent both complete words and smaller subword pieces.</p><p>Instead of requiring:</p><pre>lowest</pre><p>to exist as one complete vocabulary entry, it can construct the word using:</p><pre>low + est</pre><h3>Advantages</h3><ul><li>Handles unseen words well.</li><li>Creates a manageable vocabulary.</li><li>Can represent both complete words and subwords.</li><li>Widely used in NLP and LLM systems.</li></ul><h3>Disadvantages</h3><ul><li>Requires training to learn merge rules.</li><li>Tokenization depends on the learned vocabulary.</li><li>Some words can be split into pieces that don’t look linguistically intuitive.</li></ul><h3>4. WordPiece</h3><p><strong>WordPiece</strong> is another subword tokenization technique.</p><p>It is closely related to the idea of breaking words into reusable pieces.</p><p>For example:</p><pre>playing</pre><p>could become:</p><pre>[&quot;play&quot;, &quot;##ing&quot;]</pre><p>The ## convention indicates that ing is a continuation of the previous token in tokenizers that use this notation.</p><p>Similarly:</p><pre>unwanted</pre><p>could be represented as:</p><pre>[&quot;un&quot;, &quot;##wanted&quot;]</pre><p>The important idea is that the tokenizer doesn’t necessarily need to store every complete word.</p><p>Instead, it can build words from smaller pieces.</p><p>So:</p><pre>playing</pre><p>doesn’t necessarily need its own dedicated vocabulary entry if the vocabulary already contains:</p><pre>play<br>ing</pre><h3>Advantages</h3><ul><li>Handles unknown or uncommon words better than pure word tokenization.</li><li>Reduces vocabulary size.</li><li>Reuses common subword pieces.</li><li>Useful for representing different forms of words.</li></ul><h3>Disadvantages</h3><ul><li>Requires a trained vocabulary.</li><li>More complex than simple word splitting.</li><li>Splits do not always correspond to meaningful linguistic units.</li></ul><h3>5. Byte-Level BPE</h3><p>Byte-Level BPE combines two ideas:</p><p><strong>Bytes + BPE</strong></p><p>Traditional BPE can start from characters or other initial units.</p><p>Byte-Level BPE instead starts from <strong>bytes</strong>.</p><p>For example, the word:</p><pre>&quot;hello&quot;</pre><p>can first be represented using its UTF-8 byte representation.</p><p>Conceptually:</p><pre>h → byte<br>e → byte<br>l → byte<br>l → byte<br>o → byte</pre><p>BPE can then learn frequent combinations of these byte-level units.</p><p>For example:</p><pre>h + e → he<br>he + l → hel<br>hel + l → hell</pre><p>and so on.</p><p>The important difference is the starting point:</p><pre>Traditional BPE<br>Characters / initial symbols<br>        ↓<br>Learn merges<br></pre><pre>Byte-Level BPE<br>Bytes<br>        ↓<br>Learn merges</pre><p>Because every piece of text can ultimately be represented as bytes, this approach can handle a very wide range of text.</p><h3>Advantages</h3><ul><li>Can represent virtually any text.</li><li>Handles unusual characters naturally.</li><li>Works well with multilingual and diverse text.</li><li>Avoids the traditional unknown-character problem.</li></ul><h3>Disadvantages</h3><ul><li>Some languages or types of text can require more tokens.</li><li>More complex than simple word or character tokenization.</li><li>Requires learned merge rules.</li></ul><h3>6. SentencePiece</h3><p>There is an important distinction to understand here.</p><p><strong>SentencePiece is not itself a single tokenization algorithm.</strong></p><p>It is a tokenizer framework that can implement algorithms such as <strong>BPE</strong> and <strong>Unigram</strong>.</p><p>One of its important characteristics is that it can operate directly on raw text without requiring traditional word-level preprocessing.</p><p>For example:</p><pre>&quot;The book is good&quot;</pre><p>could conceptually become:</p><pre>[&quot;▁The&quot;, &quot;▁book&quot;, &quot;▁is&quot;, &quot;▁good&quot;]</pre><p>The special character:</p><pre>▁</pre><p>is commonly used to represent a space.</p><p>So:</p><pre>&quot;The book&quot;</pre><p>can conceptually be viewed as:</p><pre>▁The | ▁book</pre><p>This allows the tokenizer to treat spaces as part of the tokenization process rather than relying on a separate word-splitting step.</p><p>SentencePiece is particularly useful when working with multiple languages where traditional assumptions about spaces and word boundaries don’t always work well.</p><h3>Advantages</h3><ul><li>Does not require traditional word-level preprocessing.</li><li>Works well across different languages.</li><li>Handles spaces consistently.</li><li>Can use BPE or Unigram-style tokenization.</li></ul><h3>Disadvantages</h3><ul><li>Requires a trained tokenizer model.</li><li>Tokens can sometimes look unusual.</li><li>More complex than simple word tokenization.</li></ul><h3>7. Unigram Language Model</h3><p>The <strong>Unigram Language Model</strong> takes a different approach to subword tokenization.</p><p>Instead of starting with merge operations, it begins with a large collection of possible subword pieces.</p><p>Each possible piece is associated with a probability.</p><p>Consider:</p><pre>books</pre><p>The tokenizer might consider:</p><pre>[&quot;books&quot;]</pre><p>or:</p><pre>[&quot;book&quot;, &quot;s&quot;]</pre><p>or potentially other segmentations.</p><p>It then evaluates the possible segmentations and selects the one with the highest overall probability according to its learned model.</p><p>Conceptually:</p><pre>books<br>                   │<br>          ┌────────┴────────┐<br>          ↓                 ↓<br>       [&quot;books&quot;]        [&quot;book&quot;, &quot;s&quot;]<br>          │                 │<br>          ↓                 ↓<br>      Probability       Probability<br>          │                 │<br>          └────────┬────────┘<br>                   ↓<br>             Best segmentation</pre><p>This makes Unigram different from BPE.</p><p>A simplified way to remember the distinction is:</p><p><strong>BPE:</strong></p><blockquote><em>Start small and repeatedly merge.</em></blockquote><p><strong>Unigram:</strong></p><blockquote><em>Start with many possible pieces and select the most probable segmentation.</em></blockquote><h3>Advantages</h3><ul><li>Probability-based approach.</li><li>Produces useful subword representations.</li><li>Handles uncommon words better than word tokenization.</li><li>Can choose between multiple possible segmentations.</li></ul><h3>Disadvantages</h3><ul><li>Requires a trained vocabulary and probabilities.</li><li>More computationally involved than simple tokenization.</li><li>Requires maintaining possible subword pieces.</li></ul><h3>8. Byte Tokenization</h3><p>Finally, we can go all the way down to the byte level.</p><p>Instead of treating words, subwords, or characters as tokens, we can treat <strong>individual bytes as tokens</strong>.</p><p>For example:</p><pre>&quot;ABC&quot;</pre><p>using ASCII/UTF-8 byte values can be represented as:</p><pre>A → 65<br>B → 66<br>C → 67</pre><p>So conceptually:</p><pre>&quot;ABC&quot;<br>   ↓<br>[65, 66, 67]</pre><p>For ordinary English characters, one character generally corresponds to one byte in UTF-8.</p><p>However, many Unicode characters require multiple bytes.</p><p>For example, a single non-ASCII character can be represented by multiple UTF-8 bytes.</p><p>This means byte tokenization can represent essentially any text that can be encoded.</p><h3>Advantages</h3><ul><li>Extremely simple conceptually.</li><li>Can represent any text that can be encoded.</li><li>No traditional unknown-word problem.</li><li>Works naturally with arbitrary Unicode data.</li></ul><h3>Disadvantages</h3><ul><li>Can produce many tokens.</li><li>Individual bytes carry very little semantic information.</li><li>Long sequences can become inefficient.</li></ul><h3>So Which One Is Better?</h3><p>There isn’t one universally “best” tokenizer.</p><p>Different tokenization strategies make different trade-offs between:</p><ul><li>Vocabulary size</li><li>Sequence length</li><li>Ability to handle unseen words</li><li>Multilingual support</li><li>Computational efficiency</li><li>Semantic usefulness of individual tokens</li></ul><p>This is why modern LLMs generally don’t use simple character or word tokenization.</p><p>Instead, <strong>subword and byte-level approaches</strong> provide a useful balance.</p><h3>One Important Concept: Token Count</h3><p>There is one more reason tokenization matters enormously for LLMs:</p><p><strong>Token count affects computational cost.</strong></p><p>Suppose the same paragraph can be represented using:</p><pre>100 tokens</pre><p>with one tokenizer and:</p><pre>180 tokens</pre><p>with another.</p><p>The second representation produces a longer sequence.</p><p>Longer sequences generally mean more computation and memory requirements during model training and inference.</p><p>This is one reason tokenizer design is not just a preprocessing detail.</p><p>It can have a significant impact on the efficiency of an LLM.</p><h3>From Text to an LLM</h3><p>We can now extend the pipeline from our previous article.</p><p>In <strong>Step 1</strong>, we started with:</p><pre>Raw Data<br>   ↓<br>Cleaning<br>   ↓<br>Filtering<br>   ↓<br>Deduplication<br>   ↓<br>De-identification<br>   ↓<br>Clean Training Data</pre><p>Now we add tokenization:</p><pre>Clean Training Data<br>        ↓<br>   Tokenization<br>        ↓<br>      Tokens<br>        ↓<br>    Token IDs</pre><p>But we’re still not done.</p><p>The model doesn’t really work with the token IDs as meaningful representations of language.</p><p>We need to convert those token IDs into <strong>dense numerical vectors</strong> that can capture relationships between tokens.</p><p>For example, conceptually:</p><pre>&quot;king&quot;<br>   ↓<br>Token ID<br>   ↓<br>Embedding<br>   ↓<br>[0.21, -0.43, 0.87, ...]</pre><p>And this brings us to the next step in our roadmap:</p><h3>Step 3 — Word Embeddings</h3><p>We’ll explore how tokens are converted into vectors, why <strong>“king” and “queen”</strong> can have related representations, and how embeddings allow neural networks to work with the meaning and relationships present in language.</p><p>The journey from <strong>text → tokens → numbers → meaning</strong> is just beginning.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2fe7d9a6ef2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Step 1:Data Creation]]></title>
            <link>https://medium.com/@ketakikasar93/step-1-data-creation-f597a31efed7?source=rss-121467d9f9d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/f597a31efed7</guid>
            <dc:creator><![CDATA[Ketakikasar]]></dc:creator>
            <pubDate>Tue, 25 Aug 2026 09:21:10 GMT</pubDate>
            <atom:updated>2026-08-25T09:21:10.983Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Previous Post:</strong><a href="https://medium.com/@ketakikasar93/how-are-llms-built-24ce521ed6b8?sharedUserId=ketakikasar93"><strong> </strong>https://medium.com/@ketakikasar93/how-are-llms-built-24ce521ed6b8?sharedUserId=ketakikasar93</a></p><p>In the previous post, we briefly discussed what an LLM actually is and looked at the high-level process involved in building one.</p><p>The first and arguably one of the most important steps in building an LLM is <strong>data</strong>.</p><p>A model can have a sophisticated architecture and billions of parameters, but if the training data is poor, noisy, duplicated, or biased, the quality of the resulting model will also suffer.</p><p>A simple way to think about it is:</p><blockquote><strong><em>Good data → Better learning → Better model</em></strong></blockquote><p>In this post, we will focus on the first stage of our roadmap:</p><pre>Data Creation<br>      ↓<br>Data Cleaning &amp; Filtering<br>      ↓<br>Deduplication<br>      ↓<br>De-identification<br>      ↓<br>Clean Training Dataset</pre><p>Let’s understand each stage.</p><h3>1.1 Data Creation</h3><p>The first step is to collect a large and diverse amount of data that the model can learn from.</p><p>For an LLM, this data is primarily text, although modern multimodal models can also be trained using images, audio, video, and other types of information.</p><p>For a traditional text-based LLM, potential sources can include:</p><ul><li>🌐 <strong>Internet</strong> — publicly available websites, articles, blogs, documentation, etc.</li><li>📚 <strong>Books</strong> — books and other text-based publications where legally permitted.</li><li>💻 <strong>GitHub</strong> — source code, documentation, README files, and other publicly available repositories, subject to licensing and usage requirements.</li><li>📖 <strong>Wikipedia</strong> — encyclopedic knowledge and structured textual information.</li><li>📰 <strong>News and articles</strong> — useful for learning different writing styles and domains.</li><li>📄 <strong>Research papers</strong> — scientific and technical knowledge.</li><li>📚 <strong>Public datasets</strong> — curated datasets specifically created for machine learning and NLP.</li></ul><p>The goal isn’t simply to collect <strong>as much data as possible</strong>.</p><p>The goal is to collect <strong>high-quality, diverse, relevant, and legally usable data</strong>.</p><p>For example, imagine we collect:</p><pre>100 GB of Internet data</pre><p>That doesn’t necessarily mean we have:</p><pre>100 GB of useful training data</pre><p>A significant portion could contain:</p><ul><li>Duplicate pages</li><li>Spam</li><li>Advertisements</li><li>Broken HTML</li><li>Navigation menus</li><li>Repeated boilerplate</li><li>Low-quality content</li><li>Personally identifiable information</li><li>Machine-generated or meaningless text</li></ul><p>Therefore, collecting data is only the beginning.</p><p>The next challenge is <strong>cleaning it</strong>.</p><h3>1.2 Data Cleaning and Filtering</h3><p>Raw Internet data is extremely messy.</p><p>If we directly feed raw web pages into an LLM training pipeline, the model would learn a lot of information that we don’t actually want it to learn.</p><p>For example, a web page might contain:</p><pre>Home<br>About Us<br>Login<br>Subscribe<br>Advertisement</pre><pre>The Earth revolves around the Sun.</pre><pre>Privacy Policy<br>Terms &amp; Conditions<br>Copyright © 2026</pre><p>Only a small portion of this content may actually be useful for language-model training.</p><p>Therefore, the collected data needs to go through a <strong>cleaning and filtering pipeline</strong>.</p><p>A simplified pipeline could look like:</p><pre>Raw Data<br>   ↓<br>HTML / Markup Removal<br>   ↓<br>Text Extraction<br>   ↓<br>Normalization<br>   ↓<br>Language Detection<br>   ↓<br>Quality Filtering<br>   ↓<br>Toxic / Unsafe Content Filtering<br>   ↓<br>Length Filtering<br>   ↓<br>Clean Text</pre><h3>Text Pre-processing</h3><p>This stage often involves several techniques from <strong>Natural Language Processing (NLP)</strong> and general text processing.</p><p>Some common operations include:</p><h3>HTML and markup removal</h3><p>Web pages contain HTML, JavaScript, CSS, metadata, navigation elements, and other components that aren’t necessarily useful for training.</p><p>These elements can be removed to extract the actual textual content.</p><h3>Text normalization</h3><p>The text may contain unnecessary spaces, unusual characters, encoding problems, repeated line breaks, and other formatting issues.</p><p>Normalization attempts to bring the text into a consistent format.</p><p>For example:</p><pre>&quot;Hello       World!!!&quot;</pre><p>might be normalized into:</p><pre>&quot;Hello World!!!&quot;</pre><h3>Language filtering</h3><p>If we are building an English-focused LLM, we may want to identify and retain primarily English content.</p><p>Language identification models can be used to determine the language of a document.</p><h3>Length filtering</h3><p>Extremely short or extremely long documents may be filtered depending on the training strategy.</p><p>For example:</p><pre>&quot;Hi&quot;</pre><p>doesn’t provide much useful linguistic information by itself.</p><p>Similarly, extremely long documents may require special processing or splitting.</p><h3>Quality filtering</h3><p>Not every piece of text available on the Internet is useful.</p><p>We may want to remove:</p><ul><li>Spam</li><li>Automatically generated low-quality pages</li><li>Broken text</li><li>Repeated advertisements</li><li>Keyword stuffing</li><li>Irrelevant content</li></ul><p>Machine-learning-based classifiers and heuristic rules can be used to identify low-quality documents.</p><h3>1.3 Deduplication</h3><p>Now imagine that we have cleaned our dataset.</p><p>There is still another major problem:</p><p><strong>Duplicates.</strong></p><p>The Internet contains an enormous amount of repeated information.</p><p>For example, the same article may appear:</p><pre>Website A<br>Website B<br>Website C</pre><p>with exactly the same content.</p><p>If we train on the same information repeatedly, we aren’t necessarily giving the model more knowledge.</p><p>Instead, we may be unnecessarily increasing the importance of that information and wasting valuable training resources.</p><p>Therefore, large-scale LLM training pipelines perform <strong>deduplication</strong>.</p><p>Deduplication can happen at different levels.</p><p>LevelTechniquesExample<strong>Exact duplicates</strong>Hashing such as SHA-1 or MD5 of the full document or linesIdentical web pages are removed<strong>Near duplicates</strong>MinHash, SimHash, Locality-Sensitive Hashing (LSH)Two web pages differ only by small edits<strong>Semantic duplicates</strong>Sentence embeddings + cosine similarityTwo sentences have the same meaning but use different words</p><p>Let’s understand these briefly.</p><h3>1. Exact duplicates</h3><p>This is the simplest case.</p><p>Suppose we have:</p><pre>Document A:<br>&quot;Machine learning is a subset of artificial intelligence.&quot;</pre><pre>Document B:<br>&quot;Machine learning is a subset of artificial intelligence.&quot;</pre><p>The documents are exactly identical.</p><p>We can calculate a hash of each document.</p><p>For example:</p><pre>Document A → SHA-1 → abc123...<br>Document B → SHA-1 → abc123...</pre><p>Since the hashes match, we can identify the documents as duplicates and keep only one copy.</p><p>This is computationally efficient and works extremely well for <strong>exact duplicates</strong>.</p><h3>2. Near duplicates</h3><p>Now consider:</p><pre>Document A:<br>&quot;Machine learning is a subset of artificial intelligence.&quot;</pre><pre>Document B:<br>&quot;Machine learning is a part of artificial intelligence.&quot;</pre><p>These documents are not exactly identical.</p><p>Therefore, a simple hash comparison won’t identify them as duplicates.</p><p>However, they are extremely similar.</p><p>Techniques such as:</p><ul><li><strong>MinHash</strong></li><li><strong>SimHash</strong></li><li><strong>Locality-Sensitive Hashing (LSH)</strong></li></ul><p>can be used to efficiently identify documents that are very similar.</p><p>This becomes particularly important when working with billions of documents.</p><h3>3. Semantic duplicates</h3><p>This is an even more interesting case.</p><p>Consider:</p><pre>Sentence A:<br>&quot;The dog is sleeping on the sofa.&quot;</pre><pre>Sentence B:<br>&quot;A dog is resting on the couch.&quot;</pre><p>The words are different, but the meaning is almost identical.</p><p>Traditional string-based techniques may not recognize them as duplicates.</p><p>This is where <strong>embeddings</strong> can help.</p><p>The sentences can be converted into vector representations:</p><pre>Sentence A → [0.12, 0.87, 0.32, ...]<br>Sentence B → [0.14, 0.85, 0.30, ...]</pre><p>We can then calculate their similarity, commonly using <strong>cosine similarity</strong>.</p><p>If the similarity is above a predefined threshold, we can consider them semantically similar.</p><p>This is more computationally expensive than exact deduplication, but it can identify duplicates that are similar in <strong>meaning</strong>, not just in text.</p><h3>1.4 De-identification</h3><p>There is one more important step before the data becomes suitable for training:</p><p><strong>De-identification.</strong></p><p>Large datasets collected from the Internet or other sources may contain personal or sensitive information.</p><p>For example:</p><pre>Name: John Smith<br>Email: john.smith@example.com<br>Phone: +1-XXX-XXX-XXXX<br>Address: ...<br>Credit Card: ...</pre><p>Training an LLM on such information can introduce privacy and security risks.</p><p>Therefore, training-data pipelines may use techniques to detect and remove or mask sensitive information.</p><p>This process is commonly referred to as <strong>de-identification</strong> or <strong>PII removal</strong>.</p><p>PII stands for:</p><blockquote><strong><em>Personally Identifiable Information</em></strong></blockquote><p>Examples can include:</p><ul><li>Names</li><li>Email addresses</li><li>Phone numbers</li><li>Physical addresses</li><li>Government identification numbers</li><li>Financial information</li><li>Account numbers</li><li>Other sensitive identifiers</li></ul><p>NLP techniques and specialized <strong>Named Entity Recognition (NER)</strong> models can help identify entities such as:</p><pre>PERSON<br>EMAIL<br>PHONE<br>LOCATION<br>ORGANIZATION</pre><p>For example:</p><pre>Original:</pre><pre>&quot;John Smith can be contacted at john@example.com.&quot;</pre><pre>After de-identification:</pre><pre>&quot;[PERSON] can be contacted at [EMAIL].&quot;</pre><p>The objective is to preserve useful linguistic information while reducing the risk of exposing personal information.</p><h3>Putting Everything Together</h3><p>At this point, our data pipeline looks something like this:</p><pre>DATA CREATION<br>                         │<br>                         ▼<br>              ┌─────────────────────┐<br>              │ Internet / Books    │<br>              │ GitHub / Wikipedia  │<br>              │ Articles / Papers   │<br>              └─────────────────────┘<br>                         │<br>                         ▼<br>              DATA CLEANING &amp; FILTERING<br>                         │<br>                         ├── HTML Removal<br>                         ├── Text Normalization<br>                         ├── Language Filtering<br>                         ├── Quality Filtering<br>                         └── Content Filtering<br>                         │<br>                         ▼<br>                   DEDUPLICATION<br>                         │<br>              ┌──────────┼──────────┐<br>              ▼          ▼          ▼<br>           Exact       Near      Semantic<br>           Hashing    MinHash     Embeddings<br>              │          │          │<br>              └──────────┼──────────┘<br>                         ▼<br>                  DE-IDENTIFICATION<br>                         │<br>                         ▼<br>               CLEAN TRAINING DATA</pre><p>The important point is that <strong>data creation is much more than simply downloading information from the Internet</strong>.</p><p>A large-scale LLM data pipeline needs to answer questions such as:</p><blockquote><em>Is this data useful?</em></blockquote><blockquote><em>Is it high quality?</em></blockquote><blockquote><em>Is it duplicated?</em></blockquote><blockquote><em>Is it relevant?</em></blockquote><blockquote><em>Does it contain sensitive information?</em></blockquote><blockquote><em>Can we legally use it?</em></blockquote><p>Only after going through these stages do we start getting a dataset that is suitable for training.</p><h3>Final Thoughts</h3><p>When we talk about an LLM having billions of parameters, it is easy to focus entirely on the model architecture.</p><p>But the model is only one part of the story.</p><p><strong>Data is the foundation.</strong></p><p>The quality, diversity, cleanliness, and composition of the training data can have a significant impact on what the model eventually learns.</p><p>Our first step therefore looks simple:</p><pre>Collect → Clean → Deduplicate → De-identify</pre><p>But at the scale of modern LLMs, each of these steps becomes a massive engineering problem.</p><p>And once our data is ready, we have another question:</p><p><strong>How do we convert human language into something a neural network can actually process?</strong></p><p>That’s where our next step begins:</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f597a31efed7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How are LLMs built?]]></title>
            <link>https://medium.com/@ketakikasar93/how-are-llms-built-24ce521ed6b8?source=rss-121467d9f9d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/24ce521ed6b8</guid>
            <dc:creator><![CDATA[Ketakikasar]]></dc:creator>
            <pubDate>Tue, 25 Aug 2026 07:26:14 GMT</pubDate>
            <atom:updated>2026-08-25T07:26:14.696Z</atom:updated>
            <content:encoded><![CDATA[<h3>So, What Actually Is an LLM?</h3><p>If you have been anywhere near the world of AI recently, you have probably heard terms like <strong>ChatGPT, Gemini, Claude, Llama, GPT, Transformers, Generative AI, and LLMs</strong>.</p><p>There is a good chance you have also wondered:</p><p><strong>What exactly is an LLM?</strong></p><p>Is it a search engine?</p><p>Is it a database?</p><p>Is it actually “thinking”?</p><p>How does it know what to say?</p><p>And most importantly —</p><p><strong>How are these things actually built?</strong></p><p>This blog is the beginning of my roadmap to understanding exactly that.</p><p>I don’t want to start with complicated mathematics, transformer architectures, or thousands of lines of code.</p><p>Let’s start from the very beginning.</p><h3>First: What does LLM even mean?</h3><p>LLM stands for:</p><p><strong>Large Language Model</strong></p><p>Let’s break that down.</p><h3>Large</h3><p>The model is “large” because it is trained using enormous amounts of data and contains a huge number of parameters.</p><p>You can think of parameters as tiny adjustable values inside the model that are learned during training.</p><p>Modern LLMs can have billions of these parameters.</p><p>But don’t worry about parameters yet.</p><p>We’ll get there later.</p><h3>Language</h3><p>This part is easier.</p><p>The model works with human language.</p><p>It can process things like:</p><blockquote><em>“The weather today is beautiful.”</em></blockquote><p>and understand relationships between the words.</p><p>It can also generate language:</p><blockquote><em>“The weather today is beautiful, so I decided to go for a walk.”</em></blockquote><p>It isn’t limited to English either. Depending on how it was trained, an LLM can work with multiple languages and even programming languages.</p><h3>Model</h3><p>A model is essentially a system that learns patterns from data.</p><p>For example, imagine I give you thousands of examples like:</p><blockquote><em>2 + 2 = 4<br>3 + 3 = 6<br>5 + 5 = 10</em></blockquote><p>Eventually, you learn the pattern.</p><p>An LLM does something similar — but at a completely different scale.</p><p>Instead of learning a tiny mathematical pattern, it learns patterns from an enormous amount of language data.</p><p><strong>LLM = a very powerful next-token prediction machine.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WRC6MIluZ3MlVwQxDp4gbw.png" /><figcaption>Brief steps in LLM creation</figcaption></figure><p>A detailed explanation of each of these six steps are covered individually where we will explore the concepts, processes, and key components involved in building an LLM.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24ce521ed6b8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>