<?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 Ajit on Medium]]></title>
        <description><![CDATA[Stories by Ajit on Medium]]></description>
        <link>https://medium.com/@sajit9285?source=rss-b1d832633729------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*CwsxitzHqM5NA-I7fT7NqA@2x.jpeg</url>
            <title>Stories by Ajit on Medium</title>
            <link>https://medium.com/@sajit9285?source=rss-b1d832633729------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 13:28:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sajit9285/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[Model Distillation Explained: From First Principles to Modern LLMs]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://pub.towardsai.net/model-distillation-explained-from-first-principles-to-modern-llms-ed8f03f5d27e?source=rss-b1d832633729------2"><img src="https://cdn-images-1.medium.com/max/1408/1*R2nVGugV1x8QDzMrZvNu8g.jpeg" width="1408"></a></p><p class="medium-feed-snippet">An end-to-end guide to knowledge distillation, from the fundamental mathematics to how modern large language models transfer intelligence.</p><p class="medium-feed-link"><a href="https://pub.towardsai.net/model-distillation-explained-from-first-principles-to-modern-llms-ed8f03f5d27e?source=rss-b1d832633729------2">Continue reading on Towards AI »</a></p></div>]]></description>
            <link>https://pub.towardsai.net/model-distillation-explained-from-first-principles-to-modern-llms-ed8f03f5d27e?source=rss-b1d832633729------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed8f03f5d27e</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Ajit]]></dc:creator>
            <pubDate>Wed, 02 Dec 2026 13:01:04 GMT</pubDate>
            <atom:updated>2026-12-02T13:01:04.401Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[What Will Happen If P = NP Is Proven?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://pub.towardsai.net/what-will-happen-if-p-np-is-proven-91e45740cba2?source=rss-b1d832633729------2"><img src="https://cdn-images-1.medium.com/max/2048/1*3cJI7kyaRDRStSFQd7w5OQ.jpeg" width="2048"></a></p><p class="medium-feed-snippet">The mathematical question that could break modern cryptography, revolutionize computing, and redefine what we consider impossible.</p><p class="medium-feed-link"><a href="https://pub.towardsai.net/what-will-happen-if-p-np-is-proven-91e45740cba2?source=rss-b1d832633729------2">Continue reading on Towards AI »</a></p></div>]]></description>
            <link>https://pub.towardsai.net/what-will-happen-if-p-np-is-proven-91e45740cba2?source=rss-b1d832633729------2</link>
            <guid isPermaLink="false">https://medium.com/p/91e45740cba2</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[computer-science]]></category>
            <dc:creator><![CDATA[Ajit]]></dc:creator>
            <pubDate>Mon, 30 Nov 2026 21:01:01 GMT</pubDate>
            <atom:updated>2026-11-30T21:01:01.985Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Mastering Decision Trees: Essential Interview Questions for Data Scientists]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://pub.towardsai.net/mastering-decision-trees-essential-interview-questions-for-data-scientists-92f5c3c35a02?source=rss-b1d832633729------2"><img src="https://cdn-images-1.medium.com/max/800/1*zTxXH0KSiZPNUc2FQnov7g.jpeg" width="800"></a></p><p class="medium-feed-snippet">Hey everyone! &#x1F44B;</p><p class="medium-feed-link"><a href="https://pub.towardsai.net/mastering-decision-trees-essential-interview-questions-for-data-scientists-92f5c3c35a02?source=rss-b1d832633729------2">Continue reading on Towards AI »</a></p></div>]]></description>
            <link>https://pub.towardsai.net/mastering-decision-trees-essential-interview-questions-for-data-scientists-92f5c3c35a02?source=rss-b1d832633729------2</link>
            <guid isPermaLink="false">https://medium.com/p/92f5c3c35a02</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[decision-tree]]></category>
            <category><![CDATA[interview]]></category>
            <dc:creator><![CDATA[Ajit]]></dc:creator>
            <pubDate>Mon, 02 Feb 2026 00:01:02 GMT</pubDate>
            <atom:updated>2026-02-02T00:01:02.568Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Random Forest Demystified: Must-Know Questions and Answers for Data Science Interviews]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://pub.towardsai.net/random-forest-demystified-must-know-questions-and-answers-for-data-science-interviews-c2ad05241bfd?source=rss-b1d832633729------2"><img src="https://cdn-images-1.medium.com/max/1536/1*9K7ez1d-N9g9tQITWZfWQw.png" width="1536"></a></p><p class="medium-feed-snippet">Hey everyone! &#x1F44B;</p><p class="medium-feed-link"><a href="https://pub.towardsai.net/random-forest-demystified-must-know-questions-and-answers-for-data-science-interviews-c2ad05241bfd?source=rss-b1d832633729------2">Continue reading on Towards AI »</a></p></div>]]></description>
            <link>https://pub.towardsai.net/random-forest-demystified-must-know-questions-and-answers-for-data-science-interviews-c2ad05241bfd?source=rss-b1d832633729------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2ad05241bfd</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[decision-tree]]></category>
            <category><![CDATA[random-forest]]></category>
            <dc:creator><![CDATA[Ajit]]></dc:creator>
            <pubDate>Tue, 27 Jan 2026 23:01:04 GMT</pubDate>
            <atom:updated>2026-01-27T23:01:04.046Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Getting Structured Output from LLMs: Guide to Prompts, Parsers, and Tools]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://pub.towardsai.net/getting-structured-output-from-llms-guide-to-prompts-parsers-and-tools-f62b5e48cb7e?source=rss-b1d832633729------2"><img src="https://cdn-images-1.medium.com/max/1536/1*SU16rRhV4o_B03r8-7l7_g.png" width="1536"></a></p><p class="medium-feed-snippet">Contents</p><p class="medium-feed-link"><a href="https://pub.towardsai.net/getting-structured-output-from-llms-guide-to-prompts-parsers-and-tools-f62b5e48cb7e?source=rss-b1d832633729------2">Continue reading on Towards AI »</a></p></div>]]></description>
            <link>https://pub.towardsai.net/getting-structured-output-from-llms-guide-to-prompts-parsers-and-tools-f62b5e48cb7e?source=rss-b1d832633729------2</link>
            <guid isPermaLink="false">https://medium.com/p/f62b5e48cb7e</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[langchain]]></category>
            <category><![CDATA[openai]]></category>
            <category><![CDATA[gpt-4]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Ajit]]></dc:creator>
            <pubDate>Thu, 15 Jan 2026 16:02:50 GMT</pubDate>
            <atom:updated>2026-01-15T16:02:50.162Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[70+ SQL Interview Questions Every Data Scientist Should Know]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://pub.towardsai.net/70-sql-interview-questions-every-data-scientist-should-know-3e4963dcc77e?source=rss-b1d832633729------2"><img src="https://cdn-images-1.medium.com/max/1024/1*jEv9Kdk0iFuvwRFRHNUgcw.png" width="1024"></a></p><p class="medium-feed-snippet">Table of Contents</p><p class="medium-feed-link"><a href="https://pub.towardsai.net/70-sql-interview-questions-every-data-scientist-should-know-3e4963dcc77e?source=rss-b1d832633729------2">Continue reading on Towards AI »</a></p></div>]]></description>
            <link>https://pub.towardsai.net/70-sql-interview-questions-every-data-scientist-should-know-3e4963dcc77e?source=rss-b1d832633729------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e4963dcc77e</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[sql-interview-questions]]></category>
            <dc:creator><![CDATA[Ajit]]></dc:creator>
            <pubDate>Sun, 15 Jun 2025 18:03:08 GMT</pubDate>
            <atom:updated>2025-06-15T18:03:08.993Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Evaluation Metrics For Classification Task: Must-Know Questions and Answers for Data Science…]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://pub.towardsai.net/evaluation-metrics-for-classification-task-must-know-questions-and-answers-for-data-science-5f82239d607f?source=rss-b1d832633729------2"><img src="https://cdn-images-1.medium.com/max/1024/0*EPvG5FbDw3Wwb3XP" width="1024"></a></p><p class="medium-feed-snippet">Hi All &#x1F44B;</p><p class="medium-feed-link"><a href="https://pub.towardsai.net/evaluation-metrics-for-classification-task-must-know-questions-and-answers-for-data-science-5f82239d607f?source=rss-b1d832633729------2">Continue reading on Towards AI »</a></p></div>]]></description>
            <link>https://pub.towardsai.net/evaluation-metrics-for-classification-task-must-know-questions-and-answers-for-data-science-5f82239d607f?source=rss-b1d832633729------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f82239d607f</guid>
            <category><![CDATA[performance-metrics]]></category>
            <category><![CDATA[classification]]></category>
            <category><![CDATA[data-science-interview]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[evaluation-metric]]></category>
            <dc:creator><![CDATA[Ajit]]></dc:creator>
            <pubDate>Mon, 09 Jun 2025 14:02:15 GMT</pubDate>
            <atom:updated>2025-06-09T14:02:15.488Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Evaluation Metrics For Regression: Must-Know Questions and Answers for Data Science Interviews]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://pub.towardsai.net/evaluation-metrics-for-regression-must-know-questions-and-answers-for-data-science-interviews-4c3c58448fce?source=rss-b1d832633729------2"><img src="https://cdn-images-1.medium.com/max/1024/0*vdJw5aISbr8lT4_H" width="1024"></a></p><p class="medium-feed-snippet">Hey everyone! &#x1F44B;
I&#x2019;ve put together a concise and practical guide on regression evaluation metrics, complete with interview questions and&#x2026;</p><p class="medium-feed-link"><a href="https://pub.towardsai.net/evaluation-metrics-for-regression-must-know-questions-and-answers-for-data-science-interviews-4c3c58448fce?source=rss-b1d832633729------2">Continue reading on Towards AI »</a></p></div>]]></description>
            <link>https://pub.towardsai.net/evaluation-metrics-for-regression-must-know-questions-and-answers-for-data-science-interviews-4c3c58448fce?source=rss-b1d832633729------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c3c58448fce</guid>
            <category><![CDATA[regression]]></category>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[evaluation-metric]]></category>
            <dc:creator><![CDATA[Ajit]]></dc:creator>
            <pubDate>Mon, 02 Jun 2025 20:02:34 GMT</pubDate>
            <atom:updated>2025-06-02T20:02:34.586Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[A Closer Look at Autoregressive and Diffusion-Based Language Models]]></title>
            <link>https://aiadvances.org/a-closer-look-at-autoregressive-and-diffusion-based-language-models-c4bea36c6fa5?source=rss-b1d832633729------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4bea36c6fa5</guid>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[autoregressive-model]]></category>
            <category><![CDATA[gpt]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[diffusion-models]]></category>
            <dc:creator><![CDATA[Ajit]]></dc:creator>
            <pubDate>Sat, 31 May 2025 18:31:43 GMT</pubDate>
            <atom:updated>2025-05-31T18:31:43.092Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xPaelfEy3e2BVSnFR7RNKw.png" /><figcaption>Image by Author</figcaption></figure><h3>Table of Contents</h3><ul><li><strong>Introduction</strong></li><li><strong>Understanding Autoregressive Language Models</strong></li><li><strong>Exploring Diffusion-Based Language Models</strong></li><li><strong>Head-to-Head: A Comparative Analysis</strong></li><li><strong>Hybrid Models</strong></li><li><strong>Future Trends and Conclusion</strong></li></ul><h3>Introduction</h3><p>Modern language models (LMs) have been dominated by <strong>autoregressive (AR)</strong> approaches, which generate text one token at a time in a <strong>left-to-right fashion</strong>. In this paradigm, a model learns to maximize the likelihood of each next word given the previous ones. This approach is used in models like GPT-3, LLaMA 3, and has proven remarkably successful. However, sequential generation means <strong>errors can propagate</strong>, and <strong>parallelism is limited</strong>. If an AR model makes a mistake early, it affects all subsequent tokens, and it can’t easily revise past tokens.</p><p>By contrast,<strong> diffusion-based language models (DLMs)</strong> are a newer idea borrowed from <strong>image generation</strong>. In a diffusion, a full sequence is corrupted by noise through many steps, and a model is trained to reverse that corruption. In vision, diffusion models (like DDPMs) add <strong>Gaussian noise </strong>to an image and then learn a denoising network. For text, this idea is adapted so that text is gradually noised (e.g., tokens are replaced or embeddings are perturbed) and then restored. In a nutshell, diffusion models generate entire text simultaneously by <strong>denoising the corrupted sentence</strong> step by step, allowing <strong>parallel updates</strong> and<strong> error correction</strong> anywhere in the sequence.</p><h3><strong>Understanding Autoregressive Language Models</strong></h3><p>Autoregressive models represent a cornerstone of modern NLP, particularly in the area of text generation. Their design is <strong>inherently sequential</strong>, just like how we typically construct sentences and narratives.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kldme79aJx6Ki4yxiOPoig.png" /><figcaption>Autoregressive model (Decoder-only) in action (Image by Author)</figcaption></figure><p>Autoregressive(AR) LMs learn the probability of a token sequence by factoring it into a <strong>product of conditional probabilities</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*rSeW4yewhYDWR4a1kMidHg.png" /><figcaption>Probability expression of next token</figcaption></figure><p>Training maximizes the data likelihood (or, equivalently, minimizes cross-entropy) by <strong>teacher-forcing</strong> previous tokens from the training data. This <strong>left-to-right</strong> factorization is the common recipe in large LM training. AR models typically use either <strong>RNN/LSTM</strong> or (more commonly now) <strong>Transformer decoder</strong> architectures to implement these conditional probabilities.</p><h4>Mathematical Formulation</h4><p>In an AR model, the joint probability of a sequence is decomposed step by step. For tokens <strong><em>x_1,…,x_T</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*rSeW4yewhYDWR4a1kMidHg.png" /><figcaption>Probability expression of next token</figcaption></figure><p>Equivalently, in training, one minimizes the <strong>negative log-likelihood(NLL)</strong> or <strong>cross-entropy loss</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*xgAuqd0kYddBTfOoJiVFXg.png" /><figcaption>Cross Entropy loss expression</figcaption></figure><p>Where<strong> <em>p(θ)</em></strong><em> </em>is given by the model’s <strong>softmax output</strong>. This formulation assumes each token depends only on previous tokens (a causal mask). By <strong>maximizing the log-likelihood</strong>, the AR model effectively learns to predict the next word. This approach enables <strong>parallel training</strong> but forces <strong>sequential generation</strong> at inference.</p><h4>Model Architecture</h4><p>Modern AR language models almost always use a <strong>Transformer decoder</strong>. A typical GPT-style model works as follows: each input token is first mapped to a <strong>continuous embedding vector</strong>, and a fixed <strong>positional encoding</strong> is added. These embeddings pass through N stacked <strong>Transformer blocks</strong> (each with masked self-attention and feed-forward layers), producing <strong>contextualized representations</strong>. Finally, a linear layer and softmax produce a<strong> probability distribution</strong> over the vocabulary for the next token.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7-4JWB9kN7MG4glR7QrRTA.png" /><figcaption>Decoder-only Model (Image by Author)</figcaption></figure><p><strong>Components</strong></p><ul><li><strong>Embedding &amp; Positional Encoding: </strong>Input tokens (as integers) go through an <strong>embedding lookup</strong>; we add <strong>sinusoidal or learned positional vectors</strong> so the model knows token order.</li><li><strong>Decoder Layers: </strong>Each layer consists of <strong>causal self-attention</strong> (token <strong><em>t</em></strong> attends only to position <strong><em>≤ t</em></strong>)</li><li><strong>Output Projection: </strong>The top-layer output for the final position is projected and <strong>softmaxed</strong> to predict the <strong>next token probability</strong>.</li></ul><p>This architecture naturally enforces the <strong>AR property</strong> (via causal attention) and can scale to <strong>billions of parameters</strong>. It also allows fixed-context windows (e.g.,<strong> <em>2048</em> <em>tokens</em></strong>), which must be handled by <strong>truncation or caching</strong> if exceeded. During generation, at each step, the model samples (or greedily picks) the next tokens and appends them to the context. The process repeats iteratively, building the sequence one token at a time until a predefined <strong>stopping condition</strong> is met, such as the generation of an <strong>end-of-sequence (EOS)</strong> token or reaching a <strong>maximum length</strong>.</p><h4>Training and Inference in AR LMs</h4><p><strong>Training</strong></p><p>Training uses a <strong>teacher-forcing algorithm</strong>: at each step <strong><em>t</em></strong>, the model sees the <strong>true previous tokens</strong> <strong><em>x_&lt;t</em></strong><em> </em>and predicts <strong><em>x_t</em></strong><em>. </em>The loss is the <strong>sum of cross-entropies</strong>. Optimizers like <strong>Adam</strong> adjust model weights to <strong>minimize</strong> this loss over the training corpus. This maximum likelihood procedure is straightforward and amenable to <strong>large-scale data/compute</strong>, which explains why AR LMs have led to <strong>strong</strong> <strong>in-context learning</strong> and downstream performance.</p><p><strong>Inference</strong></p><p>At inference, tokens are generated <strong>sequentially</strong>. Common strategies include<strong> greedy decoding</strong> (choosing the highest-probability token each time) or<strong> sampling methods</strong> (e.g., top-k/nucleus sampling) to introduce diversity. <strong>Beam search</strong> is also used in some AR settings (especially for tasks like translation) to explore multiple high-probability sequences.</p><p>Note that all these strategies generate <strong>one token per forward pass</strong>, which makes long sequences <strong>relatively slow</strong> to produce. Autoregressive models cannot revise already generated tokens; each choice is final and fed back in as input for the next step. <strong>Error</strong> tends to <strong>propagate forward</strong>, and the strictly <strong>left-to-right</strong> nature means generation <strong>can not be parallelized</strong> across positions.</p><h3><strong>Exploring Diffusion-Based Language Models</strong></h3><p>Diffusion models draw inspiration from <strong>non-equilibrium thermodynamics</strong>, an analogy often made to observing paint gradually diffusing in water until it uniformly colors the liquid. In the context of <strong>generative AI</strong>, this process is reversed to create data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B1_DrInouNZk-s7RireTuw.png" /><figcaption>Overview of different type of generative models (Source : <a href="https://lilianweng.github.io/posts/2021-07-11-diffusion-models/">Lil’Log Blog</a>)</figcaption></figure><p>Diffusion models <strong>corrupt data</strong> by gradually adding <strong>noise</strong> and then learn a reverse <strong>denoising process</strong>. In the text domain, diffusion-based language models adapt this idea to sequences of tokens. The core concept is to define a forward (noising) process <strong><em>q</em></strong> that progressively turns data into noise, and a learned reverse process <strong><em>p_θ</em></strong><em> </em>that recovers the original data.</p><p>The process consists of <strong>two main</strong> phases:</p><ul><li><strong>Forward(Noising) Process(<em>q</em>)</strong>: This is the diffusion phase where noise is <strong>progressively</strong> added to the original and clean data over a series of <strong>timesteps</strong>. For text, this means gradually transforming clean text embeddings into a simpler distribution, typically <strong>Gaussian noise</strong>. This process systematically <strong>degrades the data</strong> until it is indistinguishable from <strong>random noise</strong>.</li><li><strong>Reverse(Denoising) Process(<em>p_θ)</em></strong>: This is the <strong>generative phase</strong> and the core of how diffusion models <strong>create content</strong>. The model learns to reverse the forward process, <strong>gradually removing</strong> noise step by step from a noisy input. By iteratively denoising, the model <strong>reconstructs</strong> the original data or generates new, high-quality samples that are aligned with the learned data distribution.</li></ul><p>Unlike autoregressive models, diffusion LMs can update <strong>all tokens jointly</strong> during generation.</p><h4>Mathematical Formulation</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J3RTmAFS2fXZb0unEmKcSA.png" /><figcaption>The Markov chain of the forward (reverse) diffusion process of generating a sample by slowly adding(removing) noise. (Image source: <a href="https://arxiv.org/abs/2006.11239">Ho et al. 2020</a>)</figcaption></figure><p>In diffusion LMs, each text sequence <strong><em>x</em></strong><em> </em>(of length <strong><em>L</em></strong>) is first embedded into a <strong>continuous space</strong> (e.g., via word embeddings). A forward Markov chain gradually corrupts this embedding sequence. For example, one can define Gaussian steps like in continuous diffusion:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4SAYn7_XdlkUt4Hf1hqJpw.png" /><figcaption>Gaussian step in continuous diffusion</figcaption></figure><p>so that after <strong><em>T</em></strong> steps, the data is almost <strong>pure noise</strong>. We can rewrite the above equation as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AHYdJM9hiKNwLBH04dzkEg.png" /></figure><p>Where:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*g25Gcww1Am9rpgoBOP1j1A.png" /></figure><p>Here, <strong><em>z_0</em></strong> is the <strong>clean</strong> <strong>embedded</strong> sequence, and <strong><em>z_T</em></strong> is near-random <strong>Gaussian</strong> <strong>noise</strong>. In discrete/token diffusion variants, the forward process might corrupt tokens by random replacement or using a learnable transition on the vocabulary simplex, but the idea is similar to <strong>adding noise</strong> in many small steps.</p><p>The reverse (generative) model <strong><em>p_θ</em></strong><em> </em>attempts to <strong>invert</strong> the forward process. Typically, for each timestep <strong><em>t</em></strong>, a neural network (mainly <strong>transformer-based</strong>) takes the noisy state <strong><em>z_t</em></strong><em> </em>and predicts parameters (such as mean noise) for <strong><em>p_θ(z_{t-1} | z_t)</em></strong><em>. </em>Training aims to <strong>minimize</strong> the discrepancy between <strong><em>p_θ</em></strong><em> </em>and the true reverse conditional <strong><em>q(z_{t-1} | z_t)</em></strong><em>. </em>In practice, this can be done by denoising the <strong>objective</strong> (e.g., predicting the Gaussian noise added) or by maximizing a <strong>variational bound</strong> on the likelihood.</p><h4>Model Architecture</h4><p>Diffusion LMs have various architectures, but they share common elements: <strong>token embeddings</strong>, <strong>noise schedules</strong>, and a <strong>denoising network</strong>. A typical pipeline is: embed the tokens, add time-step information, then run a series of <strong>Transformers</strong> or <strong>U-net layers</strong> to predict denoised outputs.</p><p>Some key points:</p><ul><li><strong>Continuous vs. Discrete</strong>: Some models (like Plaid LM) embed tokens into a <strong>continuous</strong> space and use <strong>Gaussian noise</strong>. Others operate directly on the discrete simplex of the token probabilities (one-hot vectors). For instance, <strong>SSD-LM</strong> performs diffusion on the natural vocabulary space (the simplex) rather than in a latent space.</li><li><strong>Time Embedding</strong>: The model usually <strong>encodes</strong> the current noise timestamp <strong><em>t</em></strong> (often via sinusoidal or learned embedding) so it knows how much noise has been added. This is similar to <strong>positional embeddings</strong> in transformers, but represents the <strong>noise level</strong>.</li><li><strong>Network Backbone</strong>: Many diffusion LMs are <strong>Transformer blocks</strong> (similar to AR models) for the <strong>denoiser</strong>. Some research (in vision) employs <strong>U-Net architectures</strong>, but for text, the backbone is often a bidirectional or even <strong>autoregressive Transformer</strong> that takes the entire noisy sequence as input.</li></ul><p>Overall, a diffusion LM’s architecture can look like an <strong>encoder</strong> network that processes the <strong>noisy sequence</strong> and outputs a residual or next-step prediction for the <strong>denoising process</strong>. The network is trained so that after <strong><em>T</em></strong> denoising steps (often<strong> 50–200 steps</strong>), the recovered sequences match the original text. Unlike AR decoders, the diffusion networks see (and update) all tokens at once during both training and sampling.</p><h4>Training and Inference</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2xQ0hRZKf5fW8HRXVehAHg.png" /><figcaption>A Conceptual Overview of LLaDA. (a) Pre-training. LLaDA is trained on text with random masks applied independently to all tokens at the same ratio t ∼ U[0, 1]. (b) SFT. Only response tokens are possibly masked. Sampling. LLaDA simulates a diffusion process from t = 1 (fully masked) to t = 0 (unmasked), predicting all masks simultaneously at each step with flexible remask strategies. (Source: <a href="https://arxiv.org/pdf/2502.09992">cs.CL</a>)</figcaption></figure><p><strong>Training</strong></p><p>The training objectives for diffusion LMs are typically a form of <strong>maximum likelihood</strong> or <strong>denoising score matching</strong>. One can derive a variational lower bound on the data likelihood, but a common simplification is to directly <strong>minimize the denoising error</strong>. In essence, at each step <strong><em>t</em></strong>, the model is given a noisy version <strong><em>z_t</em></strong> of an example <strong><em>x</em></strong> and learns to predict either the original <strong><em>x</em></strong> or the noise added. This can be implemented as a <strong>mean squared error</strong> loss on the predicted noise or as <strong>cross-entropy</strong> at the discrete level. The model, therefore, learns to reverse the <strong>forward corruption</strong> at every step. Because the forward process is <strong>fixed</strong> and <strong>known</strong>, gradient can flow through the denoising network for all timesteps, enabling <strong>end-to-end</strong> training on <strong>parallel</strong> hardware.</p><p><strong>Inference</strong></p><p>To generate text, one starts from a random noise vector <strong><em>z_T</em></strong> and applies the learned reverse process for <strong><em>T</em></strong> steps. Concretely, at step <strong><em>t</em></strong>, we have a noisy embedding <strong><em>z_t</em></strong>, the model predicts parameters (mean or maybe variance) for <strong><em>z_{T-1}</em></strong>. We sample or take the mean to get <strong><em>z_{T-1}</em></strong>, and continue until <strong>z_0</strong>. The result <strong>z_0</strong> is then <strong>decoded</strong> (via nearest-token or softmax) into discrete text. Unlike AR models, all tokens are <strong>updated</strong> in <strong>parallel</strong> at each denoising step.</p><p>It is interesting to note that the diffusion inference allows <strong>lookahead</strong>: the model can revise any part of the sequence at each step. In theory, this provides more flexibility for <strong>planning</strong> or <strong>global coherence</strong>. However, the number of neural evaluations is <strong>T</strong> times per sequence, whereas <strong>AR</strong> only does as many steps as tokens. In practice, <strong>naive diffusion sampling</strong> can be <strong>slower</strong> than <strong>AR</strong> for long text, unless the step count is greatly reduced.</p><h3><strong>Head-to-Head: A Comparative Analysis</strong></h3><p>The fundamental differences in how autoregressive and diffusion models approach <strong>text generation</strong> lead to distinct performance characteristics and trade-offs.</p><p><strong>A. Fundamental Differences in the Generation Process</strong></p><ul><li><strong>Autoregressive (AR)[Sequential and Token-by-Token]</strong>: AR models are often described as <strong>sequential storytellers</strong>. They construct text strictly from <strong>left-to-right</strong>, one token at a time, with each <strong>new token</strong> being predicted based on the entire sequence of tokens that have come before it.</li><li><strong>Diffusion[Parallel and Iterative Refinement]:</strong> Diffusion models operate as<strong> iterative refiners</strong>. Instead of sequential generation, they start with a <strong>noisy representation</strong> of the entire sequence and progressively denoise it over multiple steps.</li></ul><p><strong>B. Speed and Efficiency</strong></p><ul><li><strong>Fixed vs Arbitrary Length Outputs</strong>: For very short responses, <strong>AR models </strong>are <strong>faster</strong> because they only generate the necessary number of tokens sequentially. Diffusion models, while requiring <strong>multiple denoising steps</strong>, can be <strong>faster</strong> for generating <strong>fixed-length outputs</strong>(especially longer ones) due to their <strong>parallel nature</strong>, as they work on the entire output block simultaneously.</li><li><strong>Long Contexts</strong>: <strong>AR models</strong> can be more efficient with long input contexts because they can leverage a <strong>KV cache technique</strong>. In contrast, diffusion models <strong>struggle</strong> with <strong>long contexts</strong> because their iterative refinement of the entire block of tokens necessitates <strong>recalculating attention</strong> against the full context repeatedly, as the block’s content can change during each denoising pass.</li></ul><p><strong>C. Quality and Diversity</strong></p><ul><li><strong>Coherence and Fluency</strong>: <strong>Autoregressive models</strong> generally excel at <strong>local fluency and grammatical correctness</strong> due to their strict sequential conditioning. <strong>Diffusion models</strong>, through their iterative refinement, can achieve <strong>superior global coherence</strong> and <strong>contextual awareness</strong>, as they can polish the entire output.</li><li><strong>Diversity</strong>: <strong>Diffusion models</strong> theoretically offer<strong> greater diversity</strong> and better <strong>model coverage</strong>, as their generative process allows them to explore the data distribution more broadly, thus avoiding more collapse.</li></ul><p><strong>D. Summary of differences</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FuZJlG0nqlPRpTQiQefRsg.png" /><figcaption>DLM vs AR-LMs</figcaption></figure><h3><strong>Hybrid Models</strong></h3><p>The distinct strengths and weaknesses inherent in both <strong>autoregressive</strong> and <strong>diffusion models</strong> naturally motivated the development of <strong>hybrid architectures</strong>. Autoregressive models excel in <strong>fluency</strong> and <strong>efficiency</strong> with long contexts, while diffusion models offer strong <strong>global coherence</strong>, <strong>diversity</strong> potential, and <strong>fine-grained</strong> control. The goal of the hybrid approaches is to combine these complementary advantages, mitigating <strong>individual</strong> <strong>limitations</strong>.</p><p>Several recent models interpolate between the<strong> two paradigms</strong>:</p><ul><li><a href="https://proceedings.neurips.cc/paper_files/paper/2023/file/7d866abba506e5a56335e4644ebe18f9-Paper-Conference.pdf"><strong>AR-Diffusion(NeurIPS 2023)</strong></a>: Proposed by Microsoft researchers, AR-Diffusion assigns more denoising steps to tokens on the right and fewer to tokens on the left. This makes earlier tokens appear sooner and then condition later tokens, effectively reintroducing <strong>autoregressive</strong> dependency into the <strong>diffusion</strong> process.</li><li><a href="https://arxiv.org/pdf/2503.20198"><strong>LongTextAR</strong></a>: This model addresses a specific challenge, i.e, rendering coherent, long-form text within images, a task where pure diffusion models often struggle due to <strong>context window limitations</strong>. LongTextAR leverages the ability of autoregressive models to process much longer sequences of text for the textual content, combining it with visual generation capabilities.</li></ul><h3><strong>Future Trends and Conclusion</strong></h3><p>Looking ahead, we expect more <strong>cross-pollination</strong> between <strong>AR</strong> and <strong>diffusion</strong>. Possible future trends include:</p><ul><li><strong>Reduced-step diffusion</strong>: Methods like <strong>knowledge distillation</strong> or consistency models may cut down diffusion to tens or even single steps (as is done in image diffusion)</li><li><strong>Latent diffusion for text</strong>: Analogous to latent diffusion in images, mapping text to a compact latent space before diffusion could yield efficiency gains.</li><li><strong>Unified architecture</strong>: We may see architectures that <strong>fluidly switch</strong> between <strong>sequential</strong> and <strong>parallel</strong> generation modes, or use diffusion only for certain layers of the deep model</li></ul><p>Overall, while autoregressive transformer LMs remain dominant today, diffusion-based methods are rapidly evolving. Their potential for parallel, global, coherent generation and modular control makes them an exciting frontier. <strong>Hybrid models</strong> that blend AR and diffusion strengths (like AR-Diffusion) already hint at the best of both worlds. It is likely that the future LMs will not be able to purely be one or the other, but will incorporate <strong>diffusion principles</strong> (e.g., noise-based perturbations, score matching objectives) into mostly <strong>autoregressive frameworks</strong>. This could lead to models with<strong> faster sampling</strong>, <strong>better diversity</strong>, and <strong>novel control capabilities</strong>.</p><h3>References</h3><ol><li><a href="https://arxiv.org/pdf/2502.09992">Large Language Diffusion Models</a></li><li><a href="https://arxiv.org/abs/2305.16291">Scaling Laws and Efficient Training of Diffusion Language Models</a></li><li><a href="https://arxiv.org/abs/2006.11239">Denoising Diffusion Probabilistic Models</a></li><li><a href="https://arxiv.org/abs/2107.03006">Structured Denoising Diffusion Models in Discrete State-Spaces</a></li><li><a href="https://arxiv.org/abs/2205.14217">Diffusion-LM: Improving Controllable Text Generation</a></li><li><a href="https://arxiv.org/abs/2207.10551">AR-Diffusion: Auto-Regressive Diffusion for Efficient and High-Quality Text Generation</a></li><li><a href="https://arxiv.org/abs/1706.03762">Attention is All You Need</a></li><li><a href="https://arxiv.org/abs/2001.08361">Scaling Laws for Neural Language Models</a></li><li><a href="https://arxiv.org/abs/2207.12598">Photorealistic Text-to-Image Diffusion Models with Classifier-Free Guidance</a></li><li><a href="https://lilianweng.github.io/posts/2021-07-11-diffusion-models/">What are diffusion Models?</a></li></ol><p><strong>I hope you enjoyed this article and gained valuable insights about Autoregressive and Diffusion-based Language Models 😁</strong></p><p><strong>Please share your feedback or ask any questions in the comments section — I’d love to hear your thoughts ✌️</strong></p><p><strong>Feel free to connect via </strong><a href="https://www.linkedin.com/in/sajit9285/"><strong>LinkedIn</strong></a><strong> or </strong><a href="https://github.com/ajitsingh98"><strong>GitHub</strong></a><strong> 😊</strong></p><p><strong>Cheers! 🍻</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4bea36c6fa5" width="1" height="1" alt=""><hr><p><a href="https://aiadvances.org/a-closer-look-at-autoregressive-and-diffusion-based-language-models-c4bea36c6fa5">A Closer Look at Autoregressive and Diffusion-Based Language Models</a> was originally published in <a href="https://aiadvances.org/">AI Advances</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Support Vector Machines(SVM): Must-Know Questions and Answers for Data Science Interviews]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://pub.towardsai.net/support-vector-machines-svm-must-know-questions-and-answers-for-data-science-interviews-4ea82741541d?source=rss-b1d832633729------2"><img src="https://cdn-images-1.medium.com/max/1400/0*rRE49IAw02mfKmUi" width="1400"></a></p><p class="medium-feed-snippet">Hey everyone! &#x1F44B;
&#xA0;I&#x2019;ve curated a focused collection of Support Vector Machine (SVM) interview questions and answers&#x200A;&#x2014;&#x200A;many based on&#x2026;</p><p class="medium-feed-link"><a href="https://pub.towardsai.net/support-vector-machines-svm-must-know-questions-and-answers-for-data-science-interviews-4ea82741541d?source=rss-b1d832633729------2">Continue reading on Towards AI »</a></p></div>]]></description>
            <link>https://pub.towardsai.net/support-vector-machines-svm-must-know-questions-and-answers-for-data-science-interviews-4ea82741541d?source=rss-b1d832633729------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ea82741541d</guid>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[support-vector-machine]]></category>
            <category><![CDATA[support-vector-regression]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Ajit]]></dc:creator>
            <pubDate>Thu, 22 May 2025 22:02:23 GMT</pubDate>
            <atom:updated>2025-05-22T22:02:23.387Z</atom:updated>
        </item>
    </channel>
</rss>