<?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"><channel><title><![CDATA[Explorer's notes]]></title><description><![CDATA[Explorer's notes]]></description><link>https://explorer-notes.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Tue, 22 Sep 2026 17:14:08 GMT</lastBuildDate><atom:link href="https://explorer-notes.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Language Models Need Sleep: Can LLMs Learn to Forget Less?]]></title><description><![CDATA[I recently read this paper titled “Language Models Need Sleep: Learning to Self-Modify and Consolidate Memories.” This paper introduces a very nice concept for dealing with a problem we often face wit]]></description><link>https://explorer-notes.hashnode.dev/language-models-need-sleep</link><guid isPermaLink="true">https://explorer-notes.hashnode.dev/language-models-need-sleep</guid><dc:creator><![CDATA[Partha Pratim Deka]]></dc:creator><pubDate>Thu, 17 Sep 2026 05:57:48 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/687c59a50a1c84659dc1e327/5f21f5f5-82b6-4180-892e-7161bdb9549a.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I recently read this paper titled “Language Models Need Sleep: Learning to Self-Modify and Consolidate Memories.” This paper introduces a very nice concept for dealing with a problem we often face with language models: they are very good at using information in the moment, but continually transferring that information into stable long-term knowledge is much harder.</p>
<p>Currently, Large Language Models take user input in a sequential manner. As the amount of information grows, the model has to keep reasoning over an increasingly large context. We can take an analogy from how humans learn. For example, when we are in a long lecture, we often get overwhelmed by all the knowledge flowing into our brain. To deal with it, we usually take breaks, revise our notes, and revisit what we learned. Slowly, the information becomes more familiar and we start to form a stronger understanding of the topic.</p>
<p>Hence, the authors of the paper tried to implement a similar analogy for language models, and came up with a “Sleep” paradigm.</p>
<h2>Sleep Architecture</h2>
<p>The key idea is to separate learning into two phases: Wake and Sleep.</p>
<p>During the wake phase, the model interacts with new information and forms a short-term, fragile memory of it. This knowledge is useful immediately, but it is not necessarily stored permanently in the model’s parameters.</p>
<p>When the model enters sleep, this temporary knowledge is consolidated into more stable long-term parameters. The paper calls this process Memory Consolidation, and its main mechanism is Knowledge Seeding: knowledge from a smaller or short-term “self” is distilled into a larger network with more capacity to preserve it.</p>
<p>Sleep also contains a second stage called Dreaming. Here, the model generates synthetic examples based on what it has learned and uses them as a curriculum for further training. In other words, instead of simply replaying the original information, the model can generate its own practice material and use it to rehearse and refine its knowledge.</p>
<p>There is also an important idea of replay. Just as humans may revise older topics while learning something new, the model revisits previously learned information during sleep. This is important for continual learning because otherwise learning something new can overwrite older knowledge.</p>
<h2>My Small Experiment</h2>
<p>After reading the paper, I wanted to build a much smaller version of the same idea to understand how it works.</p>
<p>Instead of implementing the complete architecture from the paper, I created a toy experiment using DistilGPT-2 with LoRA adapters. The goal was to reproduce the basic learning cycle rather than reproduce every component of the original research.</p>
<p>I maintain two copies of the model:</p>
<ul>
<li><p>Fast memory: temporary and optimized for quickly learning the new fact.</p>
</li>
<li><p>Slow memory: persistent and responsible for retaining knowledge across learning cycles.</p>
</li>
</ul>
<p>The process looks roughly like this:</p>
<blockquote>
<p>New information -&gt; Fast learning -&gt; Consolidation -&gt; Dreaming + Replay -&gt; Slow memory</p>
</blockquote>
<p>When a new fact arrives, I first copy the current slow model into a fast model. The fast model is then fine-tuned on the new fact. I also verify that it actually learned the fact before allowing it to act as a teacher.</p>
<h3>Next comes the sleep phase.</h3>
<p>The fast model generates examples related to the new information. These generated examples, together with the original ground-truth information, are used to train the slow model. This is my simplified version of the paper’s memory-consolidation idea.</p>
<h3>Then comes dreaming.</h3>
<p>The slow model generates several possible answers about the new fact. I keep the generations that contain the correct information and use them as additional rehearsal data. I also replay previously learned facts so that the model does not focus only on the newest information.</p>
<p>Finally, the fast model is discarded.</p>
<p>This gives us a cycle like:</p>
<blockquote>
<p>Wake -&gt; Learn -&gt; Sleep -&gt; Consolidate -&gt; Dream -&gt; Replay -&gt; Forget the fast memory</p>
</blockquote>
<p>Then the next piece of information arrives, and the process starts again using the updated slow memory.</p>
<h2>Results</h2>
<img src="https://cdn.hashnode.com/uploads/covers/687c59a50a1c84659dc1e327/e66eeb02-1893-436d-a737-e824b9fe17b7.png" alt="" style="display:block;margin:0 auto" />

<h2>Why is this interesting?</h2>
<p>The interesting part is that we are no longer treating learning as simply:</p>
<blockquote>
<p>Fact 1 -&gt; Fact 2 -&gt; Fact 3 -&gt; Fact 4</p>
</blockquote>
<p>Instead, we are introducing a periodic consolidation process:</p>
<blockquote>
<p>Learn new information -&gt; pause -&gt; reorganize/rehearse knowledge -&gt; continue learning</p>
</blockquote>
<p>This is particularly interesting for continual learning. If the model keeps receiving new information indefinitely, we want the new information to become part of its long-term knowledge without destroying what it learned previously.</p>
<p>My experiment is obviously much smaller than the original paper. It uses only a few synthetic facts and a small model, so it should not be interpreted as evidence that the approach will automatically scale to large real-world knowledge streams.</p>
<p>But it provides a useful way to understand the core intuition behind the paper:</p>
<p>Learning does not have to happen only when the model is actively interacting with the world. A separate consolidation phase can be used to turn short-term experience into longer-term knowledge.</p>
<p>That raises a much bigger question:</p>
<p>What happens if we let a language model learn continuously, but also give it time to “sleep” or maybe effectively reorganize its memory?</p>
<p>That is the experiment I want to explore next.</p>
]]></content:encoded></item><item><title><![CDATA[Beyond Timeouts: Detecting System-Wide Latency Shifts]]></title><description><![CDATA[Introduction
I was going through an insightful blog about how Gradient Labs built their customer-facing agentic system. One part that particularly caught my attention was their failover mechanism.
Here, when a single request takes more than a thresho...]]></description><link>https://explorer-notes.hashnode.dev/beyond-timeouts</link><guid isPermaLink="true">https://explorer-notes.hashnode.dev/beyond-timeouts</guid><category><![CDATA[Latency reduction]]></category><category><![CDATA[timeout]]></category><dc:creator><![CDATA[Partha Pratim Deka]]></dc:creator><pubDate>Mon, 10 Nov 2025 04:16:16 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction</h2>
<p>I was going through an insightful blog about how Gradient Labs built their customer-facing <a target="_blank" href="https://blog.gradient-labs.ai/p/building-resilient-agentic-systems">agentic system</a>. One part that particularly caught my attention was their <strong>failover mechanism</strong>.</p>
<p>Here, when a single request takes more than a threshold time, it triggers the failover mechanism, which allows them to switch their LLM provider or model depending on the severity of the request timeout.</p>
<p><img src="https://substackcdn.com/image/fetch/$s_!rnFE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7921bbe-fc5a-4f28-9f48-9b4273c56794_1385x1145.png" alt /></p>
<p>However, in the example they shared, between 8:00 and 9:00, the <strong>mean latency</strong> and <strong>p75 latency</strong> (75th percentile) showed an increase. The entire system became slower. But because the <strong>tail latency (p99)</strong> did not cross the failover threshold, the failover mechanism did not activate. As a result, they had to switch providers manually.</p>
<p>Why?<br />Because when the mean or p75 latency increases, it indicates a <strong>global slowdown</strong>. Responses are slower overall, and this impacts user experience.</p>
<p>Hence, I thought that I could use some of the methods I know to provide a solution. And here we are!!</p>
<h2 id="heading-classical-methods">Classical Methods</h2>
<h3 id="heading-fixed-threshold">Fixed Threshold</h3>
<pre><code class="lang-python"><span class="hljs-keyword">if</span> p75_latency &gt; baseline_p75 × <span class="hljs-number">2</span>:
    Trigger failover.
</code></pre>
<p>Instead of looking only at the tail latency, i.e, the p99 or the exceptionally slow requests, we can look at the middle of the latency distribution too. Why? Because lower percentiles contain the global context, which we can simply compare to a threshold, and we will get a fundamental check for slow networks</p>
<h3 id="heading-recent-history">Recent history</h3>
<pre><code class="lang-python"><span class="hljs-keyword">if</span> p75_latency &gt; Average p75 (last <span class="hljs-number">10</span> min) × tau:
    Trigger failover.
</code></pre>
<p>Now, instead of using a fixed threshold, we can use the average of the latency scores in the past n minutes. This introduces a learned threshold instead of a fixed one. It is useful if we want to capture a sudden upshift in the latency. Tau can be used to give us a control over the value.</p>
<h3 id="heading-detecting-shape-change-in-the-histogram">Detecting shape change in the histogram</h3>
<pre><code class="lang-python"><span class="hljs-keyword">if</span> % of requests under <span class="hljs-number">3</span>s drops <span class="hljs-keyword">from</span> <span class="hljs-number">95</span>% → <span class="hljs-number">40</span>%:
    Trigger failover.
</code></pre>
<p>Till now, we have tried looking at the percentile of request timings. But what if we focus on the distribution of request duration? i.e, instead of looking at ‘How much p75 or mean latency is shifting?’, we can ask ‘How many requests went from taking 2s to 3s or 4s?‘. If a large portion of requests move from “fast” to “slow” time ranges, we can detect a global latency shift.</p>
<h2 id="heading-anomaly-detection-models">Anomaly Detection Models</h2>
<p>It is highly unlikely that there is a discussion of time series, and I don’t look for ML models that solve this. Hence, I tried to look for anomaly detection models for this use case.</p>
<p>We use ML models like Autoencoder, SVM, etc, to detect anomalies in time series. Though the initially mentioned problem does not require heavier ML models, we can still use these models to accurately analyze anomalous patterns in latency.</p>
<h3 id="heading-rnn-based-detection"><strong>RNN-Based Detection</strong></h3>
<p>Recurrent Neural Networks can learn the expected temporal patterns of latency. If the observed latency deviates from the predicted pattern, the model flags an anomaly. These models struggle to maintain long-range dependencies, but are significantly faster than transformer-based ones.</p>
<h3 id="heading-transformer-autoencoder-based-detection"><strong>Transformer Autoencoder-Based Detection</strong></h3>
<p>Transformer-based autoencoders learn a <strong>compressed representation</strong> of normal latency behavior. It can learn long-range dependencies better, but slower comparatively.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>The current failover system mentioned in the blog typically detects isolated extreme delays, but global latency slowdowns show up in p50 and p75 latency, not p99. To maintain a responsive agentic system, monitoring should shift from single-call timeouts to distribution-aware metrics or learned anomaly models.</p>
]]></content:encoded></item><item><title><![CDATA[Early Methods of Direction of Arrival Estimation]]></title><description><![CDATA[Introduction
If you close your eyes, you can still tell where a sound is coming from: left, right, or behind you.That’s because your brain compares the tiny time difference between when each ear hears the sound.
Now imagine trying to teach that same ...]]></description><link>https://explorer-notes.hashnode.dev/doa-i</link><guid isPermaLink="true">https://explorer-notes.hashnode.dev/doa-i</guid><category><![CDATA[tech ]]></category><category><![CDATA[Audio Technologies]]></category><dc:creator><![CDATA[Partha Pratim Deka]]></dc:creator><pubDate>Wed, 05 Nov 2025 17:46:57 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction</h2>
<p>If you close your eyes, you can still tell where a sound is coming from: left, right, or behind you.<br />That’s because your brain compares the <em>tiny time difference</em> between when each ear hears the sound.</p>
<p>Now imagine trying to teach that same instinct to a machine, a radar tracking aircraft, a submarine detecting ships, or even your phone figuring out where your voice is coming from. That challenge is called <strong>Direction of Arrival (DoA) estimation:</strong> the art of teaching machines to locate where a signal comes from.</p>
<p>But just like humans developed from simple instincts to complex reasoning, DoA methods have evolved too.</p>
<h2 id="heading-section-1-classical-beamforming-the-ears-of-early-machines">Section 1: Classical Beamforming - The Ears of Early Machines</h2>
<p>Before machines could reason, they had to learn to listen. The earliest DoA methods were built on physics and intuition, not statistics or AI.<br />Think of them as the <em>ears of early machines,</em> patient, simple, and surprisingly clever.</p>
<h3 id="heading-1-delay-and-sum-beamforming-das">1. Delay-and-Sum Beamforming (DAS)</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1762363870294/7e4cb087-62d8-459a-9781-c403ca0af7f0.png" alt="Delay and Sum" class="image--center mx-auto" /></p>
<p>Imagine a row of microphones. The sound doesn’t hit them all at once. It reaches one, then the next, then the next, each a fraction of a moment apart.</p>
<p>If you delay the signals from the earlier microphones just enough so they all line up in time, and then sum them together, the sound from that direction gets amplified, while others fade away.<br />That’s <strong>Delay-and-Sum Beamforming</strong>, the most intuitive way to tell where a sound is coming from.</p>
<p>It’s simple, reliable, and easy to understand.</p>
<p><strong>Strength:</strong> Simple, stable, and physically intuitive.<br /><strong>Limitation:</strong> Can’t separate sounds that are too close together.</p>
<h3 id="heading-2-capon-mvdr-beamforming">2. Capon (MVDR) Beamforming</h3>
<p>Capon’s method, also known as <strong>Minimum Variance Distortionless Response (MVDR)</strong>, improves on DAS.</p>
<p>Instead of summing equally, it finds <strong>optimal weights</strong> for each sensor that:</p>
<ul>
<li><p>Keep signals from the desired direction unchanged,</p>
</li>
<li><p>Minimize total output power (i.e., suppress everything else).</p>
</li>
</ul>
<p>This forms a <em>spatial filter</em> that adapts to the environment similar to how your brain focuses on one voice in a noisy room.</p>
<p><strong>Strength:</strong> High resolution, excellent at suppressing interference.<br /><strong>Limitation:</strong> Demands computation and accurate modeling.</p>
<h3 id="heading-3-linear-prediction-lp-method-teaching-machines-to-guess">3. Linear Prediction (LP) Method - <strong>Teaching Machines to Guess</strong></h3>
<p>Now imagine the machine not just listening but <strong>predicting</strong>.<br />The <strong>Linear Prediction</strong> method treats the signals across sensors like a melody: if it knows how one note sounds, it can guess the next.</p>
<p>By using patterns in the signals it’s already heard, it predicts what should come next and it forms a polynomial whose roots correspond to the directions of the sources.</p>
<p>It’s like a musician hearing a harmony and instantly knowing where each voice in the choir is standing.</p>
<p><strong>Strength:</strong> Fast and effective, even when signals overlap.<br /><strong>Limitation:</strong> Needs careful tuning as a wrong assumption can create phantom sources.</p>
<p>Next, we move from the ears to the mind, where machines stop scanning blindly and start <em>understanding patterns</em>.</p>
<h2 id="heading-section-2-subspace-based-methods-seeing-between-the-notes">Section 2: Subspace-Based Methods - Seeing Between the Notes</h2>
<p>After the early beamformers came a question.<br />Instead of just <em>listening harder</em>, scientists started asking, <em>what if we could look inside the data itself?  
</em>What if we could separate what’s meaningful from what’s just noise, the way a trained ear can pick out a violin’s voice in an orchestra?</p>
<p>That idea to find structure <em>hidden within chaos</em> gave birth to <strong>Subspace Methods</strong>.<br />They taught machines not just to listen, but to <strong>see between the notes</strong>.</p>
<h3 id="heading-1-the-core-concept-signal-vs-noise-subspaces">1. The Core Concept - Signal vs. Noise Subspaces</h3>
<p>Imagine all sensor readings arranged in a data matrix.<br />If multiple signals are arriving from different directions, this matrix contains overlapping patterns. Each direction contributes its own “signature.”</p>
<p>When we compute the <strong>covariance matrix</strong> of the array data, we can decompose it using something called <strong>Eigenvalue Decomposition (EVD).</strong></p>
<p>The eigenvectors associated with <strong>large eigenvalues</strong> form the <strong>signal subspace</strong>. i.e: they represent real directions of arrival. The remaining eigenvectors (with small eigenvalues) form the <strong>noise subspace</strong>.</p>
<p>If we can isolate these subspaces, we can determine the directions without scanning every possibility blindly.</p>
<h3 id="heading-2-music-multiple-signal-classification">2. MUSIC (Multiple Signal Classification)</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1762363901502/cb924a3b-86f0-4a43-8681-ceddd2203e45.png" alt class="image--center mx-auto" /></p>
<p>Its insight was beautifully simple: for the true signal directions, the “steering vector”, a kind of directional fingerprint should be perfectly <strong>orthogonal</strong> to the noise space.</p>
<p>So, MUSIC scans through angles and finds where this orthogonality holds, showing exactly where each sound originates.</p>
<p>It’s as if the machine listens to the world, and instead of hearing a blur, it hears distinct notes, <em>each peak a voice in the crowd.</em></p>
<p><strong>Strength:</strong> Very high resolution, even when sources are close together.<br /><strong>Limitation:</strong> Must know how many sources exist beforehand. It can’t play the tune without knowing how many instruments are in the band.</p>
<h3 id="heading-3-root-music-same-logic-faster-computation">3. Root-MUSIC - Same Logic, Faster Computation</h3>
<p>MUSIC requires scanning through all possible angles, which can be slow.<br /><strong>Root-MUSIC</strong> avoids this by turning the problem into a polynomial equation, then finding its roots directly the angles are derived from those roots.</p>
<p><strong>Limitation:</strong> Works best with uniform linear arrays (ULAs)</p>
<h3 id="heading-4-esprit-estimation-of-signal-parameters-via-rotational-invariance">4. ESPRIT: Estimation of Signal Parameters via Rotational Invariance</h3>
<p>ESPRIT takes subspace methods one step further.<br />If your array has two identical subarrays, the signal seen by one is just a <strong>phase-shifted version</strong> of the other.</p>
<p>Mathematically, if the signal subspace of one subarray is <em>S₁</em>, and that of the other is <em>S₂</em>, then they’re related by:</p>
<blockquote>
<p>S₂ = S₁ Φ</p>
</blockquote>
<p>where <em>Φ</em> is a diagonal matrix encoding the phase shift, which depends on the direction of arrival.</p>
<p>By estimating <em>Φ</em>, ESPRIT directly computes the angles without any scanning or spectral plotting.</p>
<p><strong>Strength:</strong> No search required, very fast<br /><strong>Limitation:</strong> Needs a specific array structure (e.g., two identical subarrays)</p>
<h3 id="heading-5-unitary-esprit-simplifying-the-math">5. Unitary ESPRIT - Simplifying the Math</h3>
<p>Unitary ESPRIT refines the original ESPRIT algorithm by converting complex-valued data into a <strong>real-valued form</strong> using unitary transformations.<br />This improves numerical stability and speeds up computation making it more practical for large systems.</p>
<h2 id="heading-section-3-maximum-likelihood-methods-the-search-for-the-most-probable-direction">Section 3: Maximum Likelihood Methods - The Search for the Most Probable Direction</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1762363958278/46ad036c-4f7e-4995-a91d-43d85c8cd806.png" alt class="image--center mx-auto" /></p>
<p>The classical and subspace methods we’ve seen so far work well, but both rely on approximations.<br />They either scan for peaks in signal power or exploit mathematical separations between signal and noise spaces.</p>
<p>The <strong>Maximum Likelihood (ML)</strong> family takes a more rigorous approach.<br />Instead of scanning or separating, it asks a simple but powerful question:</p>
<blockquote>
<p>“Given the data we actually measured, what is the most likely direction (or set of directions) that could have produced it?”</p>
</blockquote>
<p>This transforms DoA estimation into a <strong>statistical optimization</strong> problem.</p>
<h3 id="heading-1-the-core-ml-idea">1. The Core ML Idea</h3>
<p>Imagine your sensors picking up a mix of signals waves from multiple directions, tangled with noise.<br />ML treats this as a mystery to solve.</p>
<p>“if the sound truly came from this direction, how likely is it that I’d hear exactly this data?”</p>
<p>The direction that makes the data <strong>most probable</strong> wins.</p>
<p>This makes ML incredibly accurate, but also demanding. Like a perfectionist investigator, it wants all the data, all the time, and runs through every possibility before deciding.</p>
<h3 id="heading-2-conditional-ml-vs-unconditional-ml">2. Conditional ML vs. Unconditional ML</h3>
<p>There are two main ways to set up the likelihood function, depending on how we treat the source signals (<em>s</em>).</p>
<h4 id="heading-conditional-ml-cml"><strong>Conditional ML (CML)</strong></h4>
<p>In this approach, we assume the signals themselves are <strong>deterministic but unknown.</strong> Solid, predictable sounds that the machine simply hasn’t seen yet.<br />ML then works out both the signals <em>and</em> the directions that best explain the recorded data.</p>
<p><strong>Best for:</strong> strong, clear signals, like known reference tones in wireless systems.</p>
<h4 id="heading-unconditional-ml-uml"><strong>Unconditional ML (UML)</strong></h4>
<p>The <strong>Unconditional</strong> approach is more humble; it assumes the world is messy.<br />Signals are <strong>random</strong>, influenced by uncertainty and noise.<br />So instead of trying to guess the exact signals, the algorithm integrates over all possible ones, focusing only on the most probable directions overall.</p>
<p><strong>Best for:</strong> realistic, noisy environments where signals can’t be precisely modeled.</p>
<p>In both cases, the optimization involves searching over possible directions to maximize the likelihood but the mathematical form changes depending on this assumption.</p>
<h3 id="heading-3-weighted-subspace-fitting-wsf-a-practical-shortcut">3. Weighted Subspace Fitting (WSF) - A Practical Shortcut</h3>
<p>While pure ML methods are theoretically optimal, they can be computationally demanding, especially when multiple sources are involved.</p>
<p><strong>Weighted Subspace Fitting (WSF)</strong> is a clever compromise. It borrows the structure of subspace methods (like MUSIC and ESPRIT), but instead of full-blown likelihood optimization, it fits the model to the signal subspace using a <strong>weighted least-squares</strong> approach.</p>
<p>This preserves most of ML’s accuracy but avoids the full complexity of likelihood optimization.</p>
<h3 id="heading-4-key-insight-ml-as-the-gold-standard">4. Key Insight: ML as the “Gold Standard”</h3>
<p>In theory, if we had infinite computing power and perfect models, ML would give the best possible accuracy for DoA estimation.</p>
<p>All other methods from MUSIC to sparse approaches can be viewed as approximations or simplifications of this principle.</p>
<p>But in practice, ML is often too slow or numerically unstable when data are limited or signals are weak.<br />That’s why researchers developed more efficient, structured approaches leading to modern sparse and Bayesian techniques.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>From the humble <strong>delay-and-sum beamformer</strong> to the modern <strong>ML</strong> techniques, the field of Direction of Arrival (DoA) estimation has evolved from <em>listening</em> to <em>reasoning</em>.</p>
<p>Early methods treated the array like a set of synchronized ears: aligning, delaying, and summing signals to amplify what mattered.<br />Subspace approaches went further, uncovering the hidden geometry of the data, learning to tell real sources from random noise.<br />Maximum Likelihood introduced probability and optimization, turning the act of “hearing” into one of <strong>inference</strong>.</p>
<p>Together, these methods represent a clear evolution from <em>analog intuition</em> to <em>algebraic structure</em>, and finally to <em>statistical intelligence</em>.</p>
<p>Each generation brought sharper resolution, better noise resistance, and deeper insight into what the sensors were really “hearing.”</p>
<p>And each paved the way for what comes next, techniques that combine these foundations with <strong>new array geometries, tensor mathematics, and even deep learning</strong>.</p>
]]></content:encoded></item><item><title><![CDATA[Mixture of Recursions: A model that decides when to think deeper]]></title><description><![CDATA[Introduction
Modern AI models are becoming increasingly larger and more sophisticated, but also increasingly expensive to operate. Every improvement seems to demand more memory, more GPUs, and more power. In the pursuit of trying to make better model...]]></description><link>https://explorer-notes.hashnode.dev/mixture-of-recursions</link><guid isPermaLink="true">https://explorer-notes.hashnode.dev/mixture-of-recursions</guid><dc:creator><![CDATA[Partha Pratim Deka]]></dc:creator><pubDate>Sun, 26 Oct 2025 15:42:59 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction</h2>
<p>Modern AI models are becoming increasingly larger and more sophisticated, but also increasingly expensive to operate. Every improvement seems to demand more memory, more GPUs, and more power. In the pursuit of trying to make better models, we might ask, Can we make AI think better without making it bigger?</p>
<p>The answer is fascinating. Instead of stacking more layers or adding more parameters, Mixture of Recursions(MoR) teaches a model to “think recursively”, to decide on the fly, how much effort each word deserves. Simple words get quick attention, while complex ones get deeper analysis. The result? Faster, leaner AI that performs similarly to their larger variants.</p>
<h2 id="heading-the-problems-with-big-models">The problems with Big Models</h2>
<p>Today’s AI models like GPT or Gemini are built on Transformers, a design that scales beautifully with size. And each boost in their intelligence comes with skyrocketing compute and memory costs. Training or even running these giants often demands specialized hardware, massive power, and corporate-scale budgets.</p>
<p>Recent research has tried two main tricks to make them lighter:</p>
<ol>
<li><p><strong>Parameter sharing</strong> - reusing the same layers multiple times instead of adding new ones.</p>
</li>
<li><p><strong>Adaptive computation</strong> - letting the model decide when to stop thinking for “easy” parts.</p>
</li>
</ol>
<p>The <strong>Mixture-of-Recursions</strong> paper steps in to fuse these two efficiency hacks into one elegant design.</p>
<h2 id="heading-the-idea-behind-mor">The Idea Behind MoR</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1761491569740/93f9d700-88b9-4822-8050-ddda750aa47d.png" alt class="image--center mx-auto" /></p>
<p>At its core, <strong>Mixture-of-Recursions (MoR)</strong> is about teaching an AI model to <em>intelligently reuse its own</em> layers. Instead of passing every word through a tall tower of layers, MoR uses a <strong>single shared block</strong> of layers again and again, like thinking in loops.</p>
<p>But the clever twist is that not every word needs the same amount of thinking. So MoR introduces a <strong>“router”</strong>, a lightweight decision-maker that decides how many times each word should loop through the block. Easy words might go through once. Tricky words like names, logic, or context-heavy phrases might go through several times.</p>
<p>This “mixture of recursions” lets the model think deeper only when needed. It saves computation, memory, and time, all while keeping performance on par with much larger models.</p>
<h3 id="heading-how-it-works">How It Works</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1761491751596/81584d0c-dcd8-434e-8722-83fa07f119fe.png" alt class="image--center mx-auto" /></p>
<p>The innovation lies in how MoR decides <em>how many loops each token takes</em>. A lightweight <strong>router</strong> analyzes token representations at each step and assigns a <em>recursion depth</em> per token, effectively deciding how much “thinking” it deserves.</p>
<p>Two routing styles mentioned are:</p>
<ul>
<li><p><strong>Expert-choice routing</strong> - each recursion step (or “expert”) selects its respective tokens to compute further.</p>
</li>
<li><p><strong>Token-choice routing</strong> - each token chooses its full recursion path at the start.</p>
</li>
</ul>
<p>Alongside routing, MoR refines <strong>KV caching</strong>, which determines how the model stores key-value pairs for attention. Instead of caching everything (as in standard Transformers), MoR uses:</p>
<ul>
<li><p><strong>Recursion-wise caching</strong>, which stores only the active tokens’ KV pairs at each depth, reducing I/O and memory; or</p>
</li>
<li><p><strong>Recursive KV sharing</strong>, which reuses the first recursion’s cached keys and values across later loops, further cuts latency.</p>
</li>
</ul>
<p>Together, these mechanisms let MoR dynamically allocate compute, reusing the same parameters while focusing attention and memory only where it matters most.</p>
<h2 id="heading-results">Results</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1761491944609/9f7daf8f-d0fb-492a-861f-0910f210a41b.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1761491977207/1572ef70-8681-4969-b9b8-3c048d72ec69.png" alt class="image--center mx-auto" /></p>
<p>Across model sizes from <strong>135M to 1.7B parameters</strong>, MoR consistently establishes a new Pareto frontier, achieving lower validation loss and higher few-shot accuracy at the same or lower compute cost.</p>
<p>For example, with roughly half the parameters of a standard Transformer, MoR matched or surpassed it in benchmarks like ARC and MMLU. Under equal FLOPs, it processed more training tokens, thanks to adaptive routing that skips redundant computation.</p>
<p>In deployment, the benefits grow stronger. MoR’s <strong>continuous depth-wise batching</strong>, a batching method that reuses the shared block across tokens at different recursion depths, improves <strong>throughput by up to 2×</strong> (Figure 4a) compared to a vanilla model.</p>
<p>In essence, MoR combines the efficiency of weight-tying, the intelligence of adaptive computation, and the practicality of optimized caching, making it both faster and more resource-aware without sacrificing capability.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Mixture-of-Recursions represents a clear step toward <strong>smarter architectural efficiency</strong>. It shows that language models don’t always need more layers or parameters to improve; they need better control over <em>when</em> and <em>where</em> to think.</p>
<p>By combining recursive weight-sharing with adaptive routing and selective caching, MoR delivers high performance at a fraction of the compute cost. It’s not a radical reinvention of Transformers, but a refined evolution.</p>
<h3 id="heading-whats-ahead">What’s ahead?</h3>
<p>MoR changes how we think about scaling AI. Instead of endlessly building <em>bigger</em> models, it shows how to build <em>smarter</em> ones. Systems that can think deeply when needed and stay light when not.</p>
<p>For companies, this means cutting costs without cutting capability. For researchers, it opens a path to explore “thinking loops” that mimic how humans revisit tough problems instead of treating every thought equally.</p>
<p>In essence, MoR is a step toward AI that reasons more like us, adjusting its effort based on the difficulty of the task, not just the size of its brain.</p>
]]></content:encoded></item></channel></rss>