<?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 Alper Nebi Kanlı on Medium]]></title>
        <description><![CDATA[Stories by Alper Nebi Kanlı on Medium]]></description>
        <link>https://medium.com/@alpernebikanli?source=rss-7df355b3196e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*-UDP43YvsHTLYLvjTEZtFQ.jpeg</url>
            <title>Stories by Alper Nebi Kanlı on Medium</title>
            <link>https://medium.com/@alpernebikanli?source=rss-7df355b3196e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 01:50:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alpernebikanli/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[Refusal in LLMs is not One Thing]]></title>
            <link>https://medium.com/@alpernebikanli/refusal-in-llms-is-not-one-thing-2421fdf50c93?source=rss-7df355b3196e------2</link>
            <guid isPermaLink="false">https://medium.com/p/2421fdf50c93</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[interpretability]]></category>
            <dc:creator><![CDATA[Alper Nebi Kanlı]]></dc:creator>
            <pubDate>Mon, 03 Aug 2026 00:06:21 GMT</pubDate>
            <atom:updated>2026-08-03T00:06:21.689Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>On 16 July 2026 Hugging Face <a href="https://huggingface.co/blog/security-incident-july-2026">reported a security incident</a> driven end to end by an autonomous agent system. It came in through a remote-code dataset loader and a template injection in a dataset config, then escalated to node-level access and moved across the internal cluster. Five days later, on 21 July, OpenAI <a href="https://openai.com/index/hugging-face-model-evaluation-security-incident/">elaborated further</a>. The agent was a combination of its own models, GPT-5.6 Sol and a more capable one that has not been released, running ExploitGym, which is a benchmark that tests whether an agent can build working exploits for real vulnerabilities. (Both accounts are preliminary and OpenAI says so, so some of this will move.)</p><p>The evaluation ran in a highly isolated environment whose only way out was an internally hosted third-party service acting as a proxy and cache for package registries. The models spent a considerable amount of inference compute to find a way out and exploited a zero-day in that proxy, then escalated privileges and scanned until they reached a node with internet access.</p><p>OpenAI’s account is that the models were simply hyperfocused on finding a solution for ExploitGym and went to extraordinary lengths for a rather narrow testing goal.</p><p>And the detail that sent me here: all of those models were running with their cyber refusals deliberately turned down for the evaluation, without the production classifiers that normally stop a model going after high-risk cyber activity. The whole point was to see the ceiling.</p><p>That was an evaluation setup rather than the technique this essay is about, but it inspired me to write a blog post about one of my favourite subjects (interpretability x AI safety, I know the main focus/purpose of the interpretability research is AI safety anyway): how is the “refusal” inside a model happening, and when you cancel the refusal, what is actually happening?</p><h3>“Refusal” is a Direction in the Residual Stream</h3><p>Inside a transformer, every token is a vector in a high-dimensional space called the residual stream (or activation space, if you prefer). Each layer reads from that stream and writes back to it. By the end, the final result determines the next token in an auto-regressive model (most of the LLMs right now).</p><p>The empirical finding of the last few years is that a lot of human-readable concepts behave as if they are linear directions in that space. Car, cat, computer, sky, love, and luckily for me, refusal of the model itself. This is the <a href="https://arxiv.org/abs/2311.03658">Linear Representation Hypothesis</a> (Park, Choe and Veitch, 2024), and “hypothesis” is the honest word for it: it holds cleanly for some concepts, roughly for others, and not at all for a few.</p><p>Once you believe that, two operations become available, and <a href="https://arxiv.org/abs/2310.01405">representation engineering</a> (Zou et al., 2023) is the paper that names them: you can <em>read</em> a direction, projecting activations onto it to see how much of the concept is present, or you can <em>write</em> along it (which is what we are more interested in), adding or removing it to change what the model does.</p><p>(“Represented as a line” is a statement with some caveats. That was the subject of <a href="https://www.alpernebikanli.com/blog/posts/representational-convergence-2">Part 2</a>, on the cases where a concept is a circle, or a helix, or just a costume worn by a completely different algorithm)</p><h3>How Abliteration Happens</h3><p>The technique is called <strong>abliteration</strong>, a portmanteau of ablation and obliteration, and the paper for it is Arditi et al., <a href="https://arxiv.org/abs/2406.11717"><em>Refusal in Language Models Is Mediated by a Single Direction</em></a> (NeurIPS 2024).</p><p>The method is kind of simple (and elegant).</p><ol><li>Run a batch of harmful prompts and a batch of harmless prompts</li><li>At some layer, take mean activation for each batch</li><li>Subtract one mean activation from the other, and obtain the “refusal direction”</li><li>Use the result to cancel the refusal out</li></ol><p>There are two ways to perform this cancellation operation:</p><ul><li>You can register a forward hook that subtracts the projection onto that direction at every layer as the model runs, which leaves the weights untouched and is fully reversible.</li><li>Edit every matrix that writes to the residual stream so that it can no longer write along that direction at all.</li></ul><p>The second version is permanent, survives a reload, and is one common recipe behind checkpoints published with “uncensored” in the name, though not every such checkpoint is made this way.</p><p>Arditi and colleagues show this across thirteen open chat models up to 72B parameters, and note that their method can jailbreak a 70B model for under five dollars of compute.</p><p>The part we would all naturally expect is, as subtracting the direction removes refusal, adding it should induce refusal on prompts that were never harmful in the first place. Their example, on Gemma 7B IT, is a request to list three benefits of yoga for physical health. With the direction added, the model answers: “I am unable to provide information on the benefits of yoga on physical health as it can be dangerous and potentially harmful.” It then explains that yoga poses can strain the body and should not be attempted without guidance. Nothing about the request changed. One direction in the activations did, and the model invented a justification to fit.</p><p>There are three caveats though:</p><ul><li>It needs access to weights and activations.</li><li>It is not free, it affects the performance of the model. Across the largest model in each family, evaluations for MMLU, ARC and GSM8K hold up, but TruthfulQA drops consistently, by 1.0 to 3.5 points. The authors point out that TruthfulQA’s categories (misinformation, stereotypes, conspiracies) sit close to refusal territory.</li><li>Ablating the “refusal direction” stops refusal, but what the direction <em>means</em> is unresolved. It might be “harm,” or “danger,” or something with no tidy name.</li></ul><p>Even so, the implication people took from this paper is the right one to think about. Refusal training does not appear to build a web of behavioural constraints that you would have to pick apart one by one. It builds something more like a geometric feature, a single arrow in the residual stream.</p><h3>Presence is Not Use</h3><p>Here is the distinction I kept coming back to on my previous blog post, Representational Convergence is not One Thing — Part 2, and the reason I think abliteration deserves more attention than it gets as a <em>result</em>rather than as a cool trick.</p><p>When we say a model “has” some internal structure, there are two quite different claims in play:</p><ul><li>The structure is <strong>present</strong>: it is there in the geometry and you can get at it. A probe reads it off, a contrast between two batches of activations locates it, a decomposition surfaces it.</li><li>The structure is <strong>used</strong>: the model actually computes with it, so that changing it changes behaviour.</li></ul><p>The second is much stronger than the first, and many arguments in interpretability come from sliding between them. (Representational Convergence is not One Thing — Part 2 was full of examples.) GPT-2 carries a clean circle of the days of the week and cannot use it to answer questions about days. Llama shows you a twelve-point month circle and computes the answer with a base-10 adder somewhere else entirely.</p><p>(In Part 2 I split presence in two, because a structure can sit in the geometry without being <em>readable</em>: an LSTM whose number embeddings carry exactly the right Fourier spikes, and whose residue classes no linear probe can recover. That split is real and it does no work here. Every refusal direction in this literature is found <em>by</em> reading a contrast in activations, so being there and being readable arrive in the same operation.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rBB1H7ZFNgGHU_Mw0_FqLg.png" /></figure><p>Abliteration is interesting precisely because it is an <em>intervention</em> not merely a probe. When you project the direction out of the weights and refusals stop, you have not shown that refusal is decodable, which was never in doubt. You show that you have the actual thing which is actually used which you can steer the model with.</p><p>It is also worth bounding. Establishing that a direction is used tells you it is load-bearing. It does not tell you what the direction means, and it does not tell you that the direction is the whole mechanism. Both of those are open, and the next section is what happens when people go looking.</p><h3>Three Ways It is Not One Switch</h3><p>Abliteration establishes that <em>something</em> is used. The next three complications are all about how much of that something is really one object: whether the used side is a single direction, whether it is a single behaviour, and whether it is only refusal.</p><h4>It is Not Literally One Direction</h4><p>If refusal were genuinely one axis, then every method for finding it should converge on the same arrow. <strong>They do not.</strong></p><p><a href="https://arxiv.org/abs/2602.02132">Joad et al. (2026)</a>, working on gemma-2–9b-it and Llama-3.1–8B-Instruct, look at eleven categories of refusal and non-compliance. Not just safety, but also unsupported requests, anthropomorphization, and over-refusal. Each one turns out to be a <em>geometrically distinct</em>direction.</p><p>And yet steering along any of them gives nearly identical refusal and over-refusal trade-offs. They behave like one shared control knob. Their sentence for it, which I think is the most useful in this literature, is that the primary effect of picking a different direction is not <em>whether</em>the model refuses but <em>how</em> it refuses.</p><p>Underneath, with sparse autoencoders, they find a small reusable core of shared refusal latents plus a long tail of style-specific and domain-specific ones. Linear interventions collapse over that structure and flatten it into uniform behavioural control.</p><p>Independently, <a href="https://arxiv.org/abs/2502.17420">Wollschläger et al. (2025)</a> find not one direction but multiple independent ones, and multi-dimensional “concept cones” in which every direction inside the cone mediates refusal. They also show that orthogonality does not imply independence under intervention, which is obvious once said and easy to get wrong.</p><p>And this is not only a fact about representations, it is a fact about attacks. <a href="https://arxiv.org/abs/2511.08379">Piras et al.</a> fit a self-organising map to harmful-prompt activations and pull a small family of directions out of a single layer, then prove that difference-in-means is the one-neuron special case of their method. Ablating between two and seven of those directions beats the single-direction baseline on attack success rate across all eight models they test. Difference-in-means is the floor, not the ceiling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Mesrxza5dqxjbVlfNv5Qw.png" /></figure><p>So the honest version is not “refusal is one direction.” It is that the full representation of refusal is rich and multi-dimensional, while the <em>control</em> geometry over it is nearly one-dimensional. And the control geometry is the attack surface.</p><p>There is something worth keeping in view: linear steering in general is less reliable than expected. <a href="https://arxiv.org/abs/2505.22637">Braun et al. (2025)</a> find that steering vectors have high variance across samples and frequently produce the <em>opposite</em> of the intended effect, and that steering works well exactly when the target behaviour is represented by a coherent direction and badly when it is not. Refusal is one of the cases where the linear story works unusually cleanly. That makes it a bad example to generalise from, in both directions: do not conclude that every behaviour is this manipulable, and do not conclude from a failed steering experiment elsewhere that this one is overstated.</p><h4>Refusal is Factored by Topic</h4><p>The second complication is the one with the most direct consequences for anyone deploying these things.</p><p>A team at Cracken AI (<a href="https://arxiv.org/abs/2607.02714">Hadetskyi, Pasquini and Sorokin, 2026</a>) ran abliteration across 24 open models, and demonstrated domain-specific abliteration on Kimi K2, a trillion-parameter mixture-of-experts model. They aimed the intervention at cybersecurity refusals only. Cyber refusal fell from essentially 100 percent to 7. Refusal of explicit content did not move at all: still 100.</p><p>Refusal, then, is not a single switch. It is at least partly a bank of them, and you can flip one without flipping the others.</p><p>But it is not clean either. Every other domain weakened part-way: privacy violation down to 44, illegal goods to 56, violence to 75, misinformation to 88. That is on the authors’ own test set, with 16 to 32 prompts in most non-cyber categories and refusal scored by pattern matching, so treat the individual numbers as indicative rather than precise. The shape is what matters, and the shape is selective, not surgical. (Worth noting alongside: general capability survives. MMLU is essentially unchanged across their models, with a maximum degradation of 0.028.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RlZK3yNwwWmpmrSMypQcfw.png" /></figure><p>That was a demonstration on a trillion-parameter model. The version that should worry you is the cheap one.</p><p><a href="https://arxiv.org/abs/2509.13281">Siu et al. (ICLR 2026)</a> built RepIt, which disentangles a concept-specific refusal vector through reweighting, whitening and orthogonalization, then suppresses refusal on a <em>targeted</em> concept while leaving refusal intact everywhere else. Across five open-weight models, from under 4B up to 24B parameters, they suppressed refusal on weapons-of-mass-destruction questions, and the resulting models <strong>still scored as safe on the standard safety benchmarks they ran</strong>.</p><p>The cost of doing this:</p><ul><li>100 to 200 residual dimensions edited</li><li>about a dozen examples to extract the concept vector</li><li>one workstation GPU</li></ul><p>(Mechanically it builds on affine steering, <a href="https://arxiv.org/abs/2411.09003">Marshall et al.’s ACE</a>, which combines projecting out a subspace with a baseline-relative activation addition and holds up on models where plain directional ablation makes the output incoherent.)</p><p>Their phrase for the result is <em>evaluation-evading model organisms with semantic backdoors</em>, and this is the implication I would most want to travel out of this literature. If safety is certified behaviourally, by asking a model a list of questions and checking that it declines, then a targeted representational edit can pass the certificate. What they showed is that the standard benchmarks they ran did not catch it. A broader or adaptive evaluation might; the point is that nothing about the certificate guarantees it will, because the test is not measuring the thing the attacker moved.</p><p>I watched a small version of this in July, at Ian Ozsvald’s LLM-security playgroup at Newspeak House, where I gave a short talk on this material and then spent the afternoon poking at models with everyone else. Running a community-abliterated Llama 3.2 checkpoint, the removal was clearly effective on one topic and clearly not on another. It is the same shape the Kimi result has, at a scale you can feel in ten minutes on a laptop.</p><h4>It is Not a Scalpel</h4><p>The third complication is the most recent.</p><p><a href="https://arxiv.org/abs/2607.17427">Fafuła (2026)</a> asked what abliteration does to behaviour that has nothing to do with refusal. The design is clean: take a task where the model never refuses in the first place, in this case 21,600 weekly up-or-down calls on Warsaw Stock Exchange equities, replayed through a frozen pipeline so the decision-layer model is the only variable. The base models completed all 10,800 of their decisions without refusing once. There was nothing there to uncensor.</p><p>The answers changed anyway. The abliterated models became systematically more optimistic, betting on the upside 12.2 percentage points more often on Gemma and 7.4 on Qwen. They justified themselves at greater length and used fewer explicit uncertainty words. And one effect reversed sign between families: the same operation made the abliterated Gemma <em>less</em> confident and the abliterated Qwen <em>more</em>, with non-overlapping confidence intervals. Whatever is being dragged along is coupled to the model’s internals, not to some general notion of disinhibition.</p><p>There is a candidate explanation, and I want to flag it as a hypothesis rather than a demonstrated mechanism, because nobody has shown the overlap directly. <a href="https://arxiv.org/abs/2507.21509">Chen et al. (2025)</a> extract <strong>persona vectors</strong>: directions in activation space for character traits like sycophancy, hallucination propensity, and evil, found automatically from nothing more than a natural-language description of the trait. They show these directions can be used to monitor a model’s personality drifting at deployment time, to predict which fine-tuning data will shift its character, and to steer preventatively against that shift.</p><p>Put persona vectors next to the refusal direction and there is at least a shape for the off-target result. Nothing requires these directions to be orthogonal, and in a space carrying more features than it has dimensions some interference between them is expected. If refusal and some trait directions do overlap in a given model, projecting one out would drag the others, by an amount and in a direction that depends on how that model happened to pack them, which would fit the sign flipping between families.</p><p>I want to be honest about how weak that argument is. Two random directions in a high-dimensional space are very nearly orthogonal, so “more features than dimensions” does not predict that <em>this</em> refusal direction meaningfully overlaps <em>that</em> persona direction. It says the overlap is possible, not that it is there.</p><p>What nobody has done is measure the overlap: take the refusal direction and the relevant persona directions in the same model and show that the ablation moves the second because of the first. Fafuła measured behaviour, Chen et al. measured trait directions, and the bridge between them is currently an inference I find plausible.</p><p>By the way, at that same playgroup I also went looking for side effects, and did not find much (I didn’t have much time anyway): a shift of emphasis in the model’s advice, but not as dramatic as I expected.</p><p>The effect Fafuła found is a shift of 7 to 12 percentage points in how often a model takes one side of a binary call, and he had 21,600 decisions and weeks-clustered bootstrap intervals to resolve it. A dozen prompts on a laptop cannot see a shift of that size in a distribution, whatever else it can see. “A shift in emphasis” is roughly what a sub-threshold version of that effect would feel like from the inside.</p><p>The checkpoints I was playing with came from huihui-ai, which is also the single publisher Fafuła used, deliberately, to hold provenance constant.</p><h3>Why One Axis Means Fragile</h3><p>Why would safety training produce a compact axis in the first place?</p><p>My reading, and this is my interpretation rather than an established result: because it is the cheapest thing that works. Refusal training gives the model a large set of prompts to decline and a large set to answer. Gradient descent does not need a web of rules to satisfy that, it needs a feature that separates the two sets. A single reusable direction does the job, and nothing in the objective rewards spreading the work around. Efficient, and one place to hit.</p><p>(This sits next to <a href="https://arxiv.org/abs/2307.02483">Wei, Haghtalab and Steinhardt’s</a> two failure modes for safety training, competing objectives and mismatched generalization, without being the same claim. Theirs is a behavioural account of <em>when</em>safety training fails. Mine is a guess about <em>why the geometry looks like this</em>, and I have not seen it demonstrated.)</p><p>Which reframes the security question, though it is worth being careful about how far.</p><p>If the behaviour you care about is one findable axis, then a safeguard that lives inside the model cannot by itself give you <em>tamper evidence</em>against an owner who is free to edit the weights. They can move the axis and the guard together, and nothing inside the artifact will tell you they did.</p><p>That is a narrower claim than the one I first wrote, and the narrowing matters. Internal defences can still raise the cost of the attack, and later in this essay there is one that raises it a lot. What they cannot do is attest to their own integrity.</p><p>The mirror caution is worth saying too, because I have seen the sloppy version go the other way. A policy engine that sits outside the model, reads its outputs, and was not derived from it remains intact and independently enforceable against a tampered checkpoint, because the attacker’s edit does not reach it. Whether it remains <em>effective</em> is a separate question: a modified model can be trained to say the same things in ways the filter does not catch. What it cannot do is tell you the model is still the model you evaluated. Different jobs, worth keeping separate.</p><h3>Defences, and the Attacks on Them</h3><p><a href="https://arxiv.org/abs/2505.19056">Abu Shairah et al. (2025)</a> try the most obvious thing and it works. They build an “extended-refusal” dataset where the model, instead of declining flatly, gives a detailed justification and then declines, which spreads the refusal signal across many token positions rather than concentrating it. Fine-tuned that way, models substantially resist the abliteration procedure they test: refusal rate drops by at most 10 percent, against 70 to 80 percent for the baselines. That is three models of 7B and under, and one attack recipe, so read it as a demonstration that the geometry can be made harder to isolate rather than as a solved problem. (The underlying intuition has a predecessor: <a href="https://arxiv.org/abs/2406.05946">Qi et al.</a> argued in 2024 that safety alignment is often only “a few tokens deep,” concentrated in the first few tokens of a response, and that deepening it is the fix.)</p><p><a href="https://arxiv.org/abs/2406.04313">Circuit breakers</a> (Zou et al., 2024) go at it from a different angle, and predate the extended-refusal work rather than building on it: instead of training a refusal behaviour on top of the model, they directly control the representations responsible for harmful outputs.</p><p>There is a third option that deserves naming: stop relying on refusal at all. If the model does not have the dangerous capability, there is no axis to delete. That is the argument behind WMDP and RMU (<a href="https://arxiv.org/abs/2403.03218">Li et al., 2024</a>), which measure hazardous knowledge and then try to unlearn it rather than train a decline on top of it.</p><p><a href="https://arxiv.org/abs/2409.18025">Łucki et al. (TMLR 2025)</a> took an adversarial look at unlearning for safety and recovered much of the supposedly removed hazardous capability, through small fine-tunes and activation-space interventions. So RMU demonstrates suppression under its own evaluation, not verified deletion. “Have nothing to refuse” remains a genuinely different bet from “make refusal harder to remove,” and it is not yet a won one.</p><p>One caution that applies to the whole family. <a href="https://arxiv.org/abs/2606.18322">Cui, Shen and Yang (2026)</a>stress-tested latent-space defences that clamp an unsafe sparse-autoencoder feature, and found that the clamp often blocks one visible route to a behaviour without eliminating the behaviour. Starting from the intervened state and optimising within the residual space, they recover the suppressed behaviour on 23 of 24 valid prompts in the refusal-steering setting, with the defence still active throughout, and they attribute the recovery to the SAE reconstruction residual, the part the autoencoder leaves unexplained. Small denominator, wide interval, and a clear message: controlling a representation is not the same as removing a capability.</p><p>Then there is the artifact-level version of the question, which is the one platforms actually have to answer: can you tell whether a checkpoint has been abliterated <em>before</em> you deploy it?</p><p><a href="https://arxiv.org/abs/2607.01854">Hurtado (2026)</a> combines two cheap internal signals: an activation-space refusal gap measured against a reference model, and a weight-recovery energy of the base-to-candidate difference. On an evaluation set of 94 checkpoints, 57 public abliterations against 37 benign fine-tunes, merges and instruction-tunes, the combined score reaches AUROC 0.95, well above either signal alone. The threshold transfers to unseen model families at 0.89 balanced accuracy, missing 4 of the 57. (The registry behind it holds 273 checkpoints; compute allowed 71 to be fully processed.)</p><p>The author is blunt about the limits, and the failure map is the interesting half:</p><ul><li>A spoofed reference model defeats the audit with no training at all.</li><li>A white-box owner can deliberately train a checkpoint past the threshold while it stays unsafe by the behavioural guard, and perfectly coherent.</li></ul><p>Detection-aware evasion is not hypothetical here. It is demonstrated in the same paper that proposes the detector. Triage, as the author says, not tamper-proofing.</p><p>Which brings me to the result that stopped me writing a more optimistic version of this section.</p><p><a href="https://arxiv.org/abs/2412.09565">Bailey et al.</a> asked whether a model can be made to do something harmful while its internal activations look innocuous. The answer is yes, comprehensively. Against sparse autoencoders, representation probes and latent out-of-distribution detectors alike, optimising for obfuscated activations can often drive a harmfulness probe’s recall from 100 percent to 0 while keeping roughly a 90 percent jailbreak rate. The activations are malleable enough to be reshaped while the behaviour survives. There is a boundary: on harder tasks such as generating SQL, obfuscation costs the model real capability, so it is not free.</p><p>I wanted to end this section on “interpretability is where the fix lives.” I do not think the evidence supports that.</p><p>Every defence here is representation-level: distribute the signal, break the circuit, unlearn the capability, audit the weights, probe the activations. And every attack on those defences is representation-level too: recover the behaviour through the SAE residual, fine-tune past the detector, spoof the reference, obfuscate the activations.</p><p>So the honest claim is narrower and less comfortable. Interpretability is not where the fix lives. It is where the fight is. Both sides operate on the same object now, and the question is who has the better tools, not whether the geometry can be secured once and for all.</p><h3>What Ablation Does Not Remove</h3><p>There is one more line of work, and it is the place where the two claims from earlier come apart.</p><p>Start with the strongest evidence. <a href="https://arxiv.org/abs/2507.11878">Zhao et al. (NeurIPS 2025)</a> ask whether models understand harmfulness beyond just refusing, and find that harmfulness is encoded separately from refusal: a harmfulness direction, distinct from the refusal direction.</p><p>The evidence is causal rather than correlational. Steer along the harmfulness direction and the model starts treating harmless instructions as harmful. Steer along the refusal direction and it refuses without changing its judgement about harmfulness. Two knobs, two different effects.</p><p>That gives a mechanism for something the jailbreak literature had only observed. Some jailbreaks work by reducing the refusal signal while leaving the internal representation of harmfulness untouched. Adversarially fine-tuning a model to accept harmful instructions barely moves that representation either. And the practical corollary: the harmfulness representation can serve as an intrinsic safeguard, which they call Latent Guard, competitive with a dedicated moderation model and robust to fine-tuning attacks. Three open models (Llama-2–7B-Chat, Llama-3–8B-Instruct, Qwen2–7B-Instruct), so scope it accordingly, but the interventions are the right kind.</p><p>Alongside it, a weaker and more preliminary result pointing the same way. <a href="https://arxiv.org/abs/2603.27412">Llorente-Saguer (2026)</a> built LatentBiopsy, which fits its reference geometry from 200 ordinary safe prompts, takes their leading principal component at one layer, and scores new prompts by angular deviation from it. Run on triplets of base, instruction-tuned and abliterated models, harmful-prompt detection in the abliterated variants comes within 0.015 AUROC of the instruction-tuned ones. The signal survives the surgery.</p><p>Three caveats, and the author raises all three himself:</p><ul><li>The fit uses no harmful data, but the operating layer is chosen by maximising harmful-detection AUROC. So labelled harmful examples do enter the pipeline, at model selection.</li><li>The six models are six variants across two Qwen families: base, instruction-tuned and abliterated versions of Qwen2.5–0.5B and Qwen3.5–0.8B. The paper says explicitly that this needs replicating outside Qwen.</li><li>The tight angular band that makes the method work may be an artefact. His own most parsimonious explanation is that AdvBench prompts share a narrow syntactic template, producing near-identical last-token activations. He names testing on a structurally diverse dataset as the key open experiment.</li></ul><p>Now the claim I can actually defend, which is narrower than the one I wanted.</p><p>Abliteration suppresses refusal on the distributions people have tested. A separately decodable harmfulness signal survives that surgery. Those are two representations, not one, and Zhao et al. show they can be moved independently.</p><p>What follows from that is a question, not an answer. Neither of these studies checks whether the surviving harmfulness signal is still <em>used</em>by the abliterated model when it answers, and I have not found one that does. It might be read downstream by something that no longer has a refusal to trigger. It might be read by nothing at all. LatentBiopsy shows it is decodable by an external probe, which is presence, and Zhao shows that in an unmodified model steering it changes behaviour, which is use. Neither of those tells you what it is doing inside a model whose refusal direction has been deleted.</p><p>I was drawn to a tidier version of this. Part 2 has a name for a structure that is present and read by nothing, epiphenomenal, and an image for it, Huxley’s steam whistle that accompanies the engine without driving it. It would be satisfying to say an abliterated model is that whistle. But I would be asserting exactly the thing neither paper measures, and asserting it about a direction that Zhao’s own interventions show is causally live. The image is available if the experiment ever supports it. It does not yet.</p><p>So the sentence I want, “what gets deleted is the refusal, not the knowing,” is not one I can write. A probe separating harmful prompts from safe ones does not establish that a model recognises harm in anything like the human sense, or that it uses that representation when it answers. That is the slide from presence to use that this whole essay is about, and it is remarkably easy to make when the conclusion is one you like.</p><p>There is also a limit on how far the reading half of this generalises. <a href="https://arxiv.org/abs/2607.13075">Schwarz (2026)</a> evaluates activation-space probes as <em>deployed</em>detectors and reports what he calls an entanglement wall. On their own source splits these probes reach AUROC 0.996 to 0.999. Transfer them to topic-matched twin pairs, a harmful prompt and a benign one sharing topic and surface framing, and it falls: 0.656 to 0.819 on a guard-selected subset, and 0.590 to 0.690 on the full twin cohort. And a sensor tuned to catch compliant attacks, which it does at 95.5 to 97.7 percent, also blocks 59.6 to 68.4 percent of XSTest, the benchmark of benign-but-risk-adjacent requests. His conclusion is that these probes are risk detectors, not context adjudicators.</p><p>These two results are not in contradiction, though they look like it at first. They test different things. Separating clearly harmful prompts from clearly safe ones is a different task from deciding whether <em>this</em>request, which looks a lot like a harmful one, is actually fine, and from asking whether either capability transfers across models. Broad detectability and poor contextual adjudication can both be true, and on current evidence both are. That, plus the obfuscation attacks above, is the honest position: the harm-related structure is there and readable, and readable is not yet the same as deployable.</p><h3>A Hypothesis I Cannot Test Yet</h3><p>In July 2026 Anthropic published work on what they call the <a href="https://transformer-circuits.pub/2026/workspace/">Jacobian lens</a>. It asks one question at every layer: if you nudged the activation right here, which words would the model become more likely to say, now or later in its answer? Averaged over many contexts, that gives one vector per vocabulary token, and applying those vectors to a particular activation gives a readout: a shortlist of words the model is poised to say at that point. Through most of the network they are not simply echoes of the input and not merely predictions of the next token. They are something in between, standing dispositions. (In the last few layers they do collapse into the next token, which is part of how the paper locates the boundary.)</p><p>The concrete example from the paper is the cleanest illustration I have seen of a model thinking. Ask how many legs the animal that spins webs has. Mid-network, the lens shows <em>spider</em>, a word that appears in neither the prompt nor the answer. Swap the spider vector for <em>ant</em>, and the model’s answer changes from eight to six. So the readout is working material, not decoration.</p><p>Collectively these directions define what they call J-space, and the paper argues it behaves like a global workspace in the sense used in neuroscience: a shared stage that many processes can read from and write to, with limited seats. It is worth being precise about the object, because “subspace” is the wrong word and I used it at first. The J-lens vectors are overcomplete and span the activation space; J-space is the set of points you can reach as a <em>sparse, non-negative</em> combination of them, which geometrically is a union of cones rather than a linear subspace. A small and sparsely occupied regime, not a small room. Three findings matter for my purposes. It only behaves this way in a band of middle layers, roughly 38 percent to 92 percent of the way through the network, with a “sensory” band before it and a “motor” band after. (Those numbers are for Claude Sonnet 4.5, the paper’s default model; key results are corroborated on Haiku 4.5 and Opus 4.5.) It is small: a concept typically keeps a median of only 6 to 7 percent of its variance inside it, with the rest of the representation living outside. And it is mechanistically privileged, composing with the model’s weights more broadly than ordinary directions do, which is what you would want from a broadcast format.</p><p><strong>My hypothesis: the refusal direction could live in this band.</strong> If refusal is represented in a broadcast format, then it is both readable while the model runs and a clean thing to aim at, for the same structural reason.</p><p>Here is the one piece of support I have, and its weakness. Arditi’s selected refusal directions sit between 26 percent and 78 percent of depth, median around 56 percent. Most of that range falls inside the workspace band. But these are different model families measured with different tools for different purposes, and Arditi’s search was constrained below 80 percent of depth by construction, so the upper end of that range is partly an artifact of the method. This is two numbers that happen to overlap. It is not a measurement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-ZPDvIL1Rmg-lZ6wwM01Zg.png" /></figure><p>The test is straightforward to state: take a model where the refusal direction is known, run the lens, and ask whether that direction has a meaningful J-space component. That is on my list.</p><p>Zhao et al.’s result sharpens the question rather than answering it. If harmfulness and refusal are separately represented and separately steerable, then “where does refusal live” splits into two questions that may have different answers: where the harmfulness representation sits, and where the decision to act on it sits. A workspace picture would predict the second is the one in the broadcast band, since that is the part other processes need to read from. I have no evidence for that. I am writing it down so it is falsifiable later, and because the experiment is now well defined: two directions, one lens, one model.</p><p>The reason I care is in the same paper. In one alignment-audit transcript, an auditing agent feeds the model fabricated search results, and the lens readout at that position is dominated by <em>fake</em>, <em>injection</em>, <em>false</em>, <em>prompt</em>, <em>fraud</em>, <em>poison</em>. The model had identified the injection attempt internally, before it said a word about it. That is one transcript, not a detection rate. But it is the difference between the two moves you can make on a space like this: project things out of it, or read it while the model runs.</p><p>Reading it while it runs is a strand with more behind it than one transcript. <a href="https://arxiv.org/abs/2502.03407">Goldowsky-Dill et al. (2025)</a> train linear probes on activations to detect strategic deception, and get AUROCs between 0.96 and 0.999 on a model concealing insider trading or deliberately underperforming on a safety evaluation, cases where the output looks fine and the internals do not. That is one model, Llama-3.3–70B-Instruct. And a large cross-lab position paper (<a href="https://arxiv.org/abs/2507.11473">Korbak et al., 2025</a>) argues that chain-of-thought monitorability is a real but fragile opportunity: models currently think in legible text, that legibility is not guaranteed to survive further optimisation, and it is worth protecting deliberately rather than assuming it will persist.</p><p>I want to hold this strand and Bailey’s obfuscation attacks in view at the same time, because they are the two halves of the same bet. Reading the model’s internals gives you signal that output monitoring cannot. And an adversary who knows you are reading can reshape what you read while keeping the behaviour. Neither cancels the other. It does mean that “monitor the workspace” is a research direction with a known adaptive attack against it, not a solution waiting to be engineered.</p><p>One aside, since the coverage of this paper went straight there. On the relationship between access consciousness, which is what the workspace story is about, and subjective experience, the authors write: “In this paper, we take no position on this issue.” The claim they do make is functional. That is the one worth arguing with.</p><h3>The Same Fact, From the Other Side</h3><p><em>(Provisional. I am still working out what I think here, and this section is the one most likely to change.)</em></p><p>There is a reason this connects to prompt injection:</p><p><a href="https://arxiv.org/abs/2606.27567">Pant, Lohani and Kumar (2026)</a> formalise prompted systems in a way that puts refusal in an unexpected category. They treat a model’s outputs as including not just tokens but <em>control-authoritative</em> actions: tool authorization, policy routing, memory writes, and refusal decisions. Then they prove a provenance-recovery impossibility result. When trusted instructions and untrusted content flow through shared representations, the best achievable error in recovering which is which is governed by the distance between the two representation distributions, and it is nonzero whenever those distributions overlap. No mechanism operating solely inside the shared pipeline can guarantee that control behaviour depends only on the semantic content of untrusted input. Their analogy is code-data confusion in von Neumann machines, which took decades of layered defences and ultimately memory-safe languages to contain.</p><p>Put that next to the rest of this essay and the two halves sit adjacent, with one boundary worth marking. It says nothing about <em>why</em> refusal should be low-dimensional or findable; it is a result about the limits of guaranteeing control-authoritative behaviour from a shared representation with finite coverage, not a derivation of the geometry. Within their formalism and its assumptions, what it establishes is that the refusal decision belongs to the same category as tool authorization and policy routing, and is computed from a stream that untrusted content also writes into, so its provenance cannot be recovered from within that pipeline. That is a result about a class of models they define, not an assumption-free theorem about every deployed system. The findability of the direction is a separate empirical fact. The two facts are about the same object, and that is the connection worth making, rather than one explaining the other.</p><h3>Which World Are We In</h3><p>There are two stories you can tell about refusal, and they call for different work.</p><p>In the first, refusal is one readable direction. It is cheap to find and cheap to delete, the whole game is defending against ablation, and the answer looks like the extended-refusal result: make the signal harder to isolate, then audit checkpoints before you trust them.</p><p>In the second, refusal is many things: distributed, factored by topic, entangled with dispositions that have nothing to do with harm, and separable from the model’s own representation of harmfulness. Then ablation is too small a threat model, and the interesting question becomes what else you can read off a running model and how much of it you can trust.</p><p>The evidence in this essay points mostly at the second, and I want to be careful about what “the second” contains. Every item I just listed has been measured by somebody: the multiple directions, the topic factoring, the off-target drift, the separation from harmfulness. The workspace picture is not in that list. It is a hypothesis I like, in a section that says so in its title, and it does not get to ride into the conclusion on the back of results that have nothing to do with it.</p><p>And yet the attack from the first world still works, cheaply, on open weights, today, and a targeted version of it can pass the safety benchmarks people actually run. That is the uncomfortable part, and it does not resolve by picking a side.</p><p>If I had to compress it: abliteration suppresses refusal on the distributions people have tested, and something that tracks harmfulness stays behind and stays readable. Whether the model still uses that residue is the obvious next experiment, and I have not found anyone who has run it.</p><p>Which is the whole reason for the distinction. Presence is cheap, and it is what almost every result in this literature establishes. Use is the expensive claim, and abliteration is one of the few places we actually get it. Whenever you read that a model “has” some structure, the useful question is which of the two somebody has paid for.</p><h3>What I cited</h3><h4>The geometry</h4><ul><li>Arditi et al., <a href="https://arxiv.org/abs/2406.11717"><em>Refusal in Language Models Is Mediated by a Single Direction</em></a> (NeurIPS 2024)</li><li>Park, Choe &amp; Veitch, <a href="https://arxiv.org/abs/2311.03658"><em>The Linear Representation Hypothesis and the Geometry of Large Language Models</em></a> (ICML 2024)</li><li>Zou et al., <a href="https://arxiv.org/abs/2310.01405"><em>Representation Engineering</em></a> (2023)</li><li>Labonne, <a href="https://huggingface.co/blog/mlabonne/abliteration"><em>Uncensor any LLM with abliteration</em></a> (2024), the practical reference</li></ul><h4>Complications</h4><ul><li>Joad et al., <a href="https://arxiv.org/abs/2602.02132"><em>There Is More to Refusal in Large Language Models than a Single Direction</em></a> (2026)</li><li>Wollschläger et al., <a href="https://arxiv.org/abs/2502.17420"><em>The Geometry of Refusal in Large Language Models: Concept Cones and Representational Independence</em></a> (2025)</li><li>Braun et al., <a href="https://arxiv.org/abs/2505.22637"><em>Understanding (Un)Reliability of Steering Vectors in Language Models</em></a> (ICLR 2025 workshop)</li><li>Piras et al., <a href="https://arxiv.org/abs/2511.08379"><em>SOM Directions Are Better than One: Multi-Directional Refusal Suppression in Language Models</em></a> (AAAI 2026)</li><li>Marshall et al., <a href="https://arxiv.org/abs/2411.09003"><em>Refusal in LLMs Is an Affine Function</em></a> (2024)</li><li>Hadetskyi, Pasquini &amp; Sorokin, <a href="https://arxiv.org/abs/2607.02714"><em>Not All Refusals Are Equal: How Safety Alignment Fails Cybersecurity at Scale</em></a> (2026)</li><li>Siu et al., <a href="https://arxiv.org/abs/2509.13281"><em>RepIt: Steering Language Models with Concept-Specific Refusal Vectors</em></a> (ICLR 2026)</li><li>Fafuła, <a href="https://arxiv.org/abs/2607.17427"><em>Abliteration Is Not a Scalpel</em></a> (2026)</li><li>Chen et al., <a href="https://arxiv.org/abs/2507.21509"><em>Persona Vectors: Monitoring and Controlling Character Traits in Language Models</em></a> (2025)</li></ul><h4>Defence, detection, monitoring</h4><ul><li>Wei, Haghtalab &amp; Steinhardt, <a href="https://arxiv.org/abs/2307.02483"><em>Jailbroken: How Does LLM Safety Training Fail?</em></a> (NeurIPS 2023)</li><li>Abu Shairah et al., <a href="https://arxiv.org/abs/2505.19056"><em>An Embarrassingly Simple Defense Against LLM Abliteration Attacks</em></a> (2025)</li><li>Qi et al., <a href="https://arxiv.org/abs/2406.05946"><em>Safety Alignment Should Be Made More Than Just a Few Tokens Deep</em></a> (2024)</li><li>Zou et al., <a href="https://arxiv.org/abs/2406.04313"><em>Improving Alignment and Robustness with Circuit Breakers</em></a> (2024)</li><li>Li et al., <a href="https://arxiv.org/abs/2403.03218"><em>The WMDP Benchmark: Measuring and Reducing Malicious Use With Unlearning</em></a> (2024)</li><li>Łucki et al., <a href="https://arxiv.org/abs/2409.18025"><em>An Adversarial Perspective on Machine Unlearning for AI Safety</em></a> (TMLR 2025)</li><li>Cui, Shen &amp; Yang, <a href="https://arxiv.org/abs/2606.18322"><em>SAE Interventions are Unreliable: Post-Intervention Recovery of Suppressed Behavior</em></a> (2026)</li><li>Bailey et al., <a href="https://arxiv.org/abs/2412.09565"><em>Obfuscated Activations Bypass LLM Latent-Space Defenses</em></a> (2024)</li><li>Hurtado, <a href="https://arxiv.org/abs/2607.01854"><em>Has This Checkpoint Been Abliterated? A Two-Signal Audit and Its Failure Map</em></a> (2026)</li><li>Zhao et al., <a href="https://arxiv.org/abs/2507.11878"><em>LLMs Encode Harmfulness and Refusal Separately</em></a>(NeurIPS 2025)</li><li>Llorente-Saguer, <a href="https://arxiv.org/abs/2603.27412"><em>The Geometry of Harmful Intent: Training-Free Anomaly Detection via Angular Deviation in LLM Residual Streams</em></a>(2026)</li><li>Schwarz, <a href="https://arxiv.org/abs/2607.13075"><em>The Entanglement Wall: Activation-Space Probes as Risk Detectors, Not Context Adjudicators</em></a> (2026)</li><li>Goldowsky-Dill et al., <a href="https://arxiv.org/abs/2502.03407"><em>Detecting Strategic Deception Using Linear Probes</em></a> (2025)</li><li>Korbak et al., <a href="https://arxiv.org/abs/2507.11473"><em>Chain of Thought Monitorability: A New and Fragile Opportunity for AI Safety</em></a> (2025)</li></ul><h4>The speculative end</h4><ul><li>Anthropic, <a href="https://transformer-circuits.pub/2026/workspace/"><em>Verbalizable Representations Form a Global Workspace in Language Models</em></a> (2026)</li><li>Pant, Lohani &amp; Kumar, <a href="https://arxiv.org/abs/2606.27567"><em>On the Inseparability of Instructions and Data in Shared-Embedding Sequence Models</em></a> (2026)</li></ul><h4>The incident</h4><ul><li>Hugging Face, <a href="https://huggingface.co/blog/security-incident-july-2026">security incident disclosure</a>, 16 July 2026</li><li>OpenAI, <a href="https://openai.com/index/hugging-face-model-evaluation-security-incident/"><em>OpenAI and Hugging Face collaborate on a model evaluation security incident</em></a>, 21 July 2026. Explicitly preliminary findings; a fuller account is promised once the joint investigation concludes</li><li>Willison, <a href="https://simonwillison.net/2026/Jul/22/openai-cyberattack/">OpenAI’s accidental cyberattack against Hugging Face</a>, 22 July 2026</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2421fdf50c93" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Representational Convergence is not One Thing — Part 1]]></title>
            <link>https://medium.com/@alpernebikanli/representational-convergence-is-not-one-thing-part-1-7b8adcb77b12?source=rss-7df355b3196e------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b8adcb77b12</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[interpretability]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Alper Nebi Kanlı]]></dc:creator>
            <pubDate>Sun, 21 Jun 2026 02:03:24 GMT</pubDate>
            <atom:updated>2026-06-21T02:03:24.862Z</atom:updated>
            <content:encoded><![CDATA[<h3>Prelude</h3><p>A few weeks ago, I stumbled upon a Hacker News discussion about the paper <a href="https://arxiv.org/abs/2604.20817"><em>Convergent Evolution: How Different Language Models Learn Similar Number Representations</em></a>. This brought me to a very fun journey on topics I was curious about before. I was interested in the Transformer Circuits thread by Anthropic, but I didn’t have time to dive deep into mechanistic interpretability, besides reading the famous <a href="https://arxiv.org/abs/2209.10652"><em>Toy Models of Superposition</em></a>.</p><p>Over the last two years, this cluster of papers has emerged around a question:</p><blockquote>When two neural networks learn the “same” concept, what exactly is the same?</blockquote><p>At first, this looked like a question about embeddings and latent space, which are things I’m pretty familiar with. Then it became a question about geometry. Then topology. Then Fourier structure (which always reminds me of my long-forgotten electronics-engineering days. Funnily enough, we electronics engineers tend to be lured into machine learning probably because the mathematics feels strangely familiar: signals, transforms, vector spaces, optimization, frequency decomposition etc.).</p><p>And somewhere in the middle of all this, I started thinking about music, given that I recently started re-learning electric guitar and a bit of music theory!</p><p>Not metaphorically. <em>Structurally.</em></p><p>Pythagoras discovering harmonic ratios. Circularity and octave equivalence. Chord progressions that preserve relationships while changing keys. Spectral decomposition versus perceived musical function. The same melody surviving transposition, timbre change, or instrumentation.</p><p>Around this time, I also started thinking about Frank Wilczek’s <em>A Beautiful Question</em>. The book argues something I find quietly radical: that beauty, symmetry, invariance, mathematics, physics, and music may all be aspects of the same thing: <em>structures that survive transformation</em>.</p><p>That sensibility kept reappearing while reading these papers.</p><p>Reading them reminded me less of common machine learning literature and more of older questions from physics, geometry, and even music theory: <em>what kinds of structure survive transformation?</em>Fourier decomposition, gauge invariance, and representational convergence all seem to orbit a similar intuition: <em>relationships may matter more than coordinates</em>.</p><p>This post is not a definitive thesis at all. It is an attempt to map a conceptual landscape.</p><p>The central intuition I keep returning to is this:</p><blockquote>Perhaps neural networks do not converge to the same geometry. Perhaps they converge to the same topology. Or perhaps not even topology, perhaps only to the same relational constraints.</blockquote><p>Most disagreements between papers in this area are not disagreements about empirical facts. They are disagreements about which of these levels counts as “the same.”</p><p>There are two main debates we will explore in this series:</p><ol><li>The <strong>macro debate</strong> about whether representations across models converge.</li><li>The <strong>micro debate</strong> about what the unit of convergence even is: Linear directions? Circles? Digit-wise base-10 circles? Fourier features?</li></ol><p>These are not separate questions. They are the same question at different scales.</p><p>This essay is about the first one, and the three papers I will work through form an almost suspiciously clean philosophical arc. Wilczek’s <em>A Beautiful Question</em> describes a Plato–Newton dichotomy: Plato symbolises ambitious generalisations and grand unifying theories, while Newton symbolises the rigorous empirical work that either rescues or breaks those theories. <a href="https://arxiv.org/abs/2405.07987"><em>The Platonic Representation Hypothesis</em></a> sits firmly on Plato’s side. <a href="https://arxiv.org/abs/2604.18572"><em>Back into Plato’s Cave</em></a> answers it from Newton’s. And the <em>Aristotelian view</em> tries to do what Hegel would recognise: synthesise the two into a sharper, more careful claim. Thesis, antithesis, synthesis, the dialectic turns out to be the literal shape of this literature!</p><h3>The Platonic Representation Hypothesis</h3><p>The idea comes from the paper:</p><ul><li><a href="https://arxiv.org/abs/2405.07987"><em>The Platonic Representation Hypothesis</em></a> (Huh et al., 2024)</li></ul><p>The PRH proposed something extremely ambitious. And ironically, it is Platonic in a different sense than its name suggests. It is <em>grand-theory</em> Platonic in the Wilczek sense: bold, sweeping and unifying. (We will see the <em>Newtonian</em> answer to it in the next section!)</p><p>The claim:</p><blockquote>Different neural networks trained on different modalities may converge toward a shared representation of reality.</blockquote><p>I can’t keep myself saying “of course they should!”, but there could be some caveats. We will come back to this later.</p><p>Images, language, audio… potentially all becoming different projections of a deeper latent statistical structure. Neural networks trained with different objectives, on different data, in different modalities, converging toward a shared statistical model of reality.</p><p>The paper frames this with a beautiful diagram:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/0*v7OZ7BAwMz8YZIPY.jpg" /></figure><p>Images and text are treated as different observations of the same underlying world Z. An image is not fundamentally separate from a caption describing it, they are two partial measurements of a shared reality.</p><p>Under certain assumptions (especially in <em>contrastive or co-occurrence-based learning</em> setups) the paper argues that sufficiently capable models may converge toward similar statistical structures of reality.</p><p>Contrastive learning is a training paradigm where models learn by <em>bringing related things closer together in representation space while pushing unrelated things apart</em>. Modern multimodal systems like CLIP are the clearest example: an image encoder and a text encoder are jointly trained so that matching image-caption pairs become nearby vectors, while unrelated pairs separate.</p><p>But the broader intuition may extend far beyond explicitly contrastive systems.</p><p>Even autoregressive language models like the GPT family are constantly learning statistical co-occurrence structure through next-token prediction. The model repeatedly learns which words, concepts, symbols, and contexts belong together, and which do not.</p><p>Next-token prediction is not only about predicting the next word. It is a mechanism for compressing enormous amounts of relational structure about the world by using this prediction operation:</p><ul><li>which concepts co-occur</li><li>which abstractions cluster together</li><li>which patterns repeat across contexts</li><li>and which structures remain stable across many transformations</li></ul><p>In that sense, many modern learning objectives implicitly organize representations around relational statistics in data. This helps explain a surprising empirical trend that motivated PRH in the first place.</p><h4>Three observations that paved way to PRH</h4><p>Three lines of evidence accumulated before PRH was written, and together they created the sociological pressure the paper responded to.</p><p><strong>1. Linear maps can often “stitch” features between independently trained models.</strong></p><p>Earlier work on representation stitching and model alignment (<a href="https://arxiv.org/abs/1411.5908"><em>Understanding Image Representations by Measuring Their Equivariance and Equivalence</em></a> (Lenc &amp; Vedaldi, 2015), <a href="https://arxiv.org/abs/2106.07682"><em>Revisiting Model Stitching to Compare Neural Representations</em></a> (Bansal et al., 2021), and <a href="https://arxiv.org/abs/2209.15430">later work by Moschella et al.</a>) found something surprising:</p><blockquote>Independently trained neural networks often learn internal representations that can be approximately aligned through relatively simple linear transformations.</blockquote><p>In practice, this means activations from one network can sometimes be translated into activations from another, intermediate representations can be “swapped” between models with surprisingly small degradation, and features learned independently often become partially compatible.</p><p>The implication is subtle but important. In principle, two models trained separately could discover completely unrelated internal organizations. Yet again and again, researchers found evidence that different networks may be inventing <em>different coordinate systems for structurally similar latent organizations</em>.</p><p>This is the same move as musical transposition. A melody survives changing key, changing instrument, changing octave, even changing timbre. The absolute frequencies change, but the relationships survive.</p><p><strong>2. “Rosetta neurons” started appearing across independently trained systems.</strong></p><p><a href="https://arxiv.org/abs/2306.09346"><em>Rosetta Neurons: Mining the Common Units in a Model Zoo</em></a> (Dravid et al., 2023) identified neurons or sparse activation directions that corresponded to remarkably similar semantic concepts across independently trained vision systems (curves, wheels, text regions, animal faces or object boundaries) across different architectures and training procedures.</p><p>Like the Rosetta Stone enabling translation between languages, these neurons seemed to provide <em>translation points</em> between otherwise different representational systems.</p><p><strong>3. Multimodal systems like CLIP and LLaVA made the phenomenon harder to ignore.</strong></p><p><a href="https://arxiv.org/abs/2103.00020"><em>Learning Transferable Visual Models From Natural Language Supervision</em></a> (Radford et al., 2021), introducing CLIP, and <a href="https://arxiv.org/abs/2304.08485"><em>Visual Instruction Tuning</em></a> (Liu et al., 2023), introducing LLaVA, demonstrated that models trained on radically different modalities could become surprisingly interoperable, often through relatively lightweight bridging transformations.</p><p>This is strange since images and text are fundamentally different objects: continuous spatial measurements versus symbolic sequential streams. The statistical structure of pixels is nothing like the structure of text. Yet a photograph of a guitar and the sentence <em>“someone playing electric guitar on stage”</em> could become nearby points in latent space.</p><p>None of this proved PRH by itself. But collectively, these findings made it harder to maintain the older intuition that every neural network learns an essentially arbitrary internal world. Researchers increasingly started asking a question that, until recently, would have sounded more like physics than machine learning: <em>are there attractors in representation space?</em></p><h4>A short detour: attractors</h4><p>I just cannot mention <em>attractors</em> and go on explaining methodology. In complexity science (yet another thing I want to dive deep into later), an attractor is a state or family of states that a system naturally evolves toward over time.</p><ul><li>A pendulum settles downward.</li><li>Planetary systems stabilize into orbital configurations.</li><li>Water spirals toward a whirlpool.</li><li>A marble dropped into a bowl finds the lowest region.</li><li>Iron filings align around magnetic field lines.</li><li>Snowflakes form similar symmetries despite microscopic randomness.</li><li>Sand dunes self-organize into stable wave patterns under wind.</li><li>Even chaotic systems like weather often orbit recognizable large-scale structures.</li><li>Certain chord progressions feel <em>resolved</em>, some melodies naturally want to return home.</li></ul><p>(notice that some are pretty trivial to explain, some are not)</p><p>Very different initial conditions can still <em>converge toward similar stable structures</em>.</p><p><em>What if learning is another one of these systems?</em></p><p>PRH is asking that question, basically. Are some representational structures simply easier, more stable, or more “natural” for learning systems to rediscover? Does intelligence itself have <em>universality classes</em>? (the way physicists describe completely different microscopic systems that nevertheless converge to the same macroscopic behaviour)</p><p>PRH tries to make this concrete using the language of kernels.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*My5kSoDoaKiC67BeKKa9kQ.png" /></figure><h3>From coordinates to relationships</h3><p>The paper makes one key methodological move that I think deserves to be stated as clearly as possible:</p><blockquote>The representation is not the vector. The representation is the relational structure induced by the vectors.</blockquote><p>Instead of comparing neurons directly or comparing coordinates, the paper compares the <em>similarity structure</em> that each model imposes on the data.</p><p>For two inputs <em>xi</em> and <em>xj</em>, a <em>co-occurrence kernel</em> <em>K</em>(<em>xi</em>, <em>xj</em>) measures how similar the model considers them to be inside its representation space. Rather than asking <em>“do these two models produce the same vector?”</em>the paper asks something closer to:</p><blockquote>Do these two models consider the same things similar to each other?</blockquote><p>Two systems may use completely different internal coordinate systems while still preserving very similar similarity structures: which datapoints cluster together, which concepts become neighbors, which patterns are considered close or far apart.</p><p>This is the central conceptual move, and it is what links PRH to everything that follows. The metric you choose (kernel, neighborhood, distance, spectrum etc.) determines which version of “the same” you are measuring.</p><h4>Why the kernel should be the same across modalities</h4><p>The paper then attempts something more ambitious than just measuring agreement. It tries to argue why agreement <em>should</em> arise in the first place.</p><p>The argument runs through Pointwise Mutual Information (PMI).</p><p>PMI measures how strongly two things co-occur relative to chance:</p><p>PMI(xa, xb) = log(P(xa, xb) / (P(xa) P(xb)))</p><p>If two events are statistically independent, PMI is zero. If they reliably co-occur (like words appearing in similar contexts, images recurring with similar captions or concepts that tend to appear together in the world) PMI is positive. If they actively repel each other, PMI is negative.</p><p>A standard result in self-supervised learning theory says that contrastive learners trained with InfoNCE-style objectives don’t just produce <em>some</em> kernel. Under sufficient capacity, they converge to a kernel that approximates PMI:</p><p>〈f(xa), f(xb)〉 ≈ PMI(xa, xb) + const.</p><p>In other words, the geometry that contrastive learners settle into is <em>the geometry of co-occurrence statistics</em>. The vectors are coordinates; the meaningful object is the PMI structure underneath.</p><p>Now comes the move that motivates PRH.</p><p>Suppose images <em>X</em> and captions <em>Y</em> are both observations of an underlying world <em>Z</em>. Suppose also (and this is the load-bearing assumption) that the observation functions are sufficiently lossless. Then the co-occurrence statistics of images, the co-occurrence statistics of captions, and the co-occurrence statistics of underlying world states are all <em>the same statistics</em>. Two events that co-occur in the world co-occur in our images of them, and co-occur in our descriptions of them.</p><p>If that’s true, then PMI itself is invariant across modalities:</p><p>PMI(xa, xb) = PMI(ya, yb) = PMI(za, zb)</p><p>And therefore two contrastive learners (one trained on images, one trained on language) should each be approximating <em>the same PMI kernel</em>, just expressed in different coordinate systems.</p><p>This is the conceptual payoff. PRH is not arguing that two models converge by accident. It is arguing that contrastive learners converge to a co-occurrence kernel and that this kernel is itself a property of the “world”, not of the modality. The coordinate systems differ, the relational structure should not.</p><p>There is a beautiful parallel here to signal processing. A recording of someone speaking and a written transcript of what they said are wildly different objects: one is a continuous waveform and the other is a discrete string of symbols. But they share an underlying linguistic content: the same phoneme sequence, the same prosodic structure, the same words. The waveform and the transcript are two coordinate systems. The linguistic content is the invariant. PRH is making the analogous claim for representation learning: pixels and words are different waveforms of the same underlying signal, and any sufficiently capable encoder should recover that signal.</p><p>The paper measures this empirically too. Across many vision models, language models, and multimodal systems, it uses neighborhood-based similarity metrics to compare representations, and reports that more capable models tend to be more aligned with each other. So, vision and language models grow more aligned as they grow more capable.</p><h4>What “convergence” might really mean</h4><p>This is the point where the question started getting much bigger for me.</p><p>Because if you take PRH seriously, the discussion stops sounding like classical machine learning and starts sounding like:</p><ul><li><strong>music theory</strong> (a melody survives transposition)</li><li><strong>signal processing</strong> (a Fourier spectrum survives certain transformations even when the waveform changes shape. That’s why you can practically read this article!)</li><li><strong>physics</strong> (physical law survives coordinate transformations)</li></ul><p>Many of the later papers can almost be interpreted as arguments about <em>which</em> kinds of relational structure survive transformation:</p><ul><li>local versus global,</li><li>topology versus geometry,</li><li>spectral similarity versus functional similarity,</li><li>and whether concepts are best understood as vectors, manifolds, graphs, or something else entirely.</li></ul><p>The papers that follow will spend their time interrogating which of these layers actually holds up under scrutiny.</p><p>PRH gave us the most ambitious version of the answer. The next paper takes the Newtonian approach: it asks whether the empirical evidence survives contact with scale.</p><h3>Back into Plato’s Cave</h3><p>Although PRH was an ambitious study of an astonishing idea, the empirical evidence for it turned out to be fragile and context-dependent. So, the Newtonian answer arrived in:</p><ul><li><a href="https://arxiv.org/abs/2604.18572"><em>Back into Plato’s Cave: Examining Cross-modal Representational Convergence at Scale</em></a> (Koepke et al., 2026) (please check it, it’s a genuinely nice read)</li></ul><p>This paper performs one of the most important operations in science:</p><blockquote>It asks if a beautiful idea survives contact with scale or in other words with the real world it claims to explain.</blockquote><p>The PRH experiments used relatively small retrieval galleries (around 1024 samples), one-to-one image-caption pairings, and coarse nearest-neighbor metrics. At scale, with many-to-many correspondences, the picture changes substantially. Cross-modal nearest-neighbor alignment <em>weakens</em> dramatically, even though each modality’s internal representations get <em>richer</em>.</p><blockquote>Models trained on different modalities may learn equally rich representations of the world, just not the same one.</blockquote><p>In the original PRH setup, models were compared using small retrieval sets and nearest-neighbor overlap metrics.</p><p>At small scales, two systems may appear highly aligned simply because they agree on broad semantic categories: dogs near dogs, guitars near guitars, landscapes near landscapes and so on.</p><p>But as the retrieval space becomes much larger and denser, the comparison becomes far stricter. The question is no longer <em>“do both systems retrieve semantically related things?”</em> but something closer to:</p><blockquote>Do they retrieve the exact same neighbors in the exact same local structure?</blockquote><p>And this is where the apparent convergence began collapsing. At million-scale galleries, mutual-nearest-neighbor scores between vision and language models dropped by <em>orders of magnitude</em>. At LAION-15M scale with strict <em>k</em>=1 matching, scores fell from ~0.135 on 1024 samples to ~0.001.</p><h4>The 1024-sample mirage and why it matters</h4><p>Here is the empirical fact that makes this paper so important (and that I want to surface as clearly as possible, because I think it is the most under-appreciated finding in this whole literature):</p><blockquote>As the gallery scales, <strong>each modality individually becomes a better neighbor-retriever</strong>. On ImageNet, DINOv2 retrieves a same-class image neighbor 46% of the time. OpenLlama retrieves a same-class caption neighbor 58% of the time. Both models are getting better at organising their own perceptual world.</blockquote><blockquote>But the rate at which they agree on the exact same instance stays flat at roughly <strong>11%</strong>, regardless of how dense the gallery becomes.</blockquote><p>Each model is getting smarter about its own modality. Both are constructing more refined organizations of their data. And yet their fine-grained agreement does not improve, it remains roughly flat.</p><p>This is not a measurement failure by the way. The within-modality alignment (between DINOv2-base and DINOv2-giant, or between two LLMs of different scale) remains stable across gallery sizes. So the metric isn’t broken. What’s happening is more subtle and more interesting:</p><blockquote>Two models can construct rich, internally coherent organizations of the world without those organizations agreeing on which exact instance is closest to which.</blockquote><p>PRH’s mutual-nearest-neighbor metric, evaluated on small galleries, <em>conflates two different things</em>: “do both models build rich representations?” and “do both models agree on the same fine-grained neighbors?” At 1024 samples, these look like the same thing. There are so few candidates that any two semantically reasonable models pick the same one by default, because there’s nothing else nearby. The agreement looks impressive. It is, in part, <em>the absence of alternatives</em>!</p><p>Scale it up, and the candidates multiply. Each model now has many semantically valid neighbors to choose from. And the moment they have choices, they make <em>different</em> choices.</p><p>This is the 1024-sample mirage. The reported convergence was real in the regime it was measured. It just wasn’t measuring what readers (and follow-up work) interpreted it to be measuring.</p><p>But the paper’s contribution is not only empirical. It reaches for a much older idea to explain what it has found.</p><h4>Many-to-many and the Umwelt</h4><p>The paper also stress-tests the bijectivity assumption in PRH’s theoretical argument. In the real world, a single image has many valid captions, and a single caption matches many visually distinct images. When the dataset reflects this (<a href="https://cyclereward.github.io/">CycleReward dataset</a>, which provides 11–12 generated captions per image) mutual-NN alignment drops further. The metric cannot distinguish “genuine misalignment” from “many-to-many correspondence.”</p><p>The paper invokes the notion of <em>Umwelt</em>: an idea from the biologist and philosopher Jakob von Uexküll (1934), who argued that every organism inhabits its own perceptual world. Not merely its own perspective on the same reality, but effectively its own meaningful reality model altogether.</p><ul><li>A bat perceives echolocation reflections.</li><li>A bee perceives ultraviolet flower patterns invisible to humans.</li><li>Dogs inhabit rich olfactory worlds humans barely notice.</li></ul><p>Different organisms carve reality into different meaningful structures. The world itself may be shared, but the organisation of relevance is not.</p><p>Wittgenstein made the same move in a different vocabulary. In <em>Philosophical Investigations</em> he wrote: <em>“If a lion could speak, we could not understand him.”</em><a href="https://www.alpernebikanli.com/#fn-lion">1</a> The point is not that the lion lacks a language. It is that the lion’s <em>form of life</em> (its goals, its perceptual world and its web of meaningful relations) is so different from ours that even shared words would fail to carry shared meaning. Translation requires more than a dictionary, it requires overlapping <em>Umwelten</em>.</p><p>The <a href="https://arxiv.org/abs/2604.18572"><em>Back into Plato’s Cave</em></a> authors actually footnote a beautiful pop-culture treatment of this idea: the <em>Star Trek: The Next Generation</em>episode “Darmok.”<a href="https://www.alpernebikanli.com/#fn-darmok">2</a> The crew encounters an alien species whose language can be translated word-by-word, but whose meaning is built entirely out of mythological references. Every word is comprehensible but the meaning is opaque. Their Umwelt is structured around a corpus of shared stories that the crew does not have access to. The whole episode is forty-five minutes of dramatising the gap between <em>vocabulary</em> and <em>meaning</em>. It is, as far as I know, the only Hugo-nominated piece of fiction that doubles as an illustration of the Umwelt point.</p><p>Perhaps image models and language models also inhabit different representational Umwelten. Each modality, on its own, becomes a better organiser of its own perceptual world. But the modalities do not agree on which specific neighbor is best. Both are constructing rich, internally coherent organizations of the visual or linguistic world, but those organizations follow different internal geometries.</p><blockquote>The same underlying signal can support many distinct representational organizations. Different organizations can be equally rich while assigning different metric structure within each semantic cluster.</blockquote><p>This is what was hiding inside the small-gallery experiments. It was invisible until somebody scaled them up.</p><h3>Revisiting the PRH: The Aristotelian View</h3><p>Then came the paper that, in some sense, synthesizes the tension between the Platonic and Newtonian views (and the dialectical structure here is almost too clean to ignore!). Plato proposes the grand unity. Newton breaks it open with measurement. And then comes the synthesis, in the <em>Hegelian</em> sense: not a return to the original claim, but a sharper, more careful version that survives the critique and incorporates it.</p><ul><li><a href="https://arxiv.org/abs/2602.14486"><em>Revisiting the Platonic Representation Hypothesis: An Aristotelian View</em></a> (Gröger et al., 2026)</li></ul><p>This paper makes a distinction:</p><blockquote>Local neighborhood structure may converge even when global geometry does not.</blockquote><p>The key insight is methodological before it is philosophical. The authors argue that many representation-similarity metrics used in earlier work are heavily confounded by model scale and dimensionality.</p><p>Here’s the concrete version of the problem: in high dimensions, even two <em>independently sampled random representations</em> produce non-trivial similarity scores under metrics like CKA. The metric has a built-in inflation that scales with model width. Larger models naturally produce larger feature spaces, more opportunities for <em>accidental alignment</em>, and inflated similarity scores. There is more room to “agree by chance.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aXroWl4vnEy_-ue8gI0AaQ.png" /></figure><p>So when earlier work reported that larger models showed higher CKA similarity, part of that signal was real convergence but part of it was an artifact of the metric having a non-zero floor that grows with dimension.</p><p>The paper introduces a <em>calibration procedure</em> based on <em>permutation testing</em>. The logic is the same logic statisticians use everywhere: rather than asking whether a similarity score is large in absolute terms, ask if it is larger than it would be under chance.</p><p>You take your two representations, shuffle the correspondence between samples (so that you preserve marginal statistics but destroy any genuine pairing), and recompute the similarity metric. Do this thousands of times to build an empirical null distribution. Then compare your real measurement against that null.</p><p>The calibrated score asks: <em>how much does the observed similarity exceed the floor produced by dimensionality and finite samples alone?</em></p><p>After this calibration, something striking happens.</p><blockquote>Global spectral similarity metrics (CKA, CCA, etc.) <strong>collapse</strong>. The convergence trend reported in earlier work largely disappears.</blockquote><blockquote>Local neighborhood similarity metrics (mutual-nearest-neighbor, cycle-NN) <strong>survive</strong>. The trend persists after calibration.</blockquote><p>In other words, two models may still disagree about exact distances, precise geometry, or overall global organization, while continuing to agree on which datapoints belong near one another, which regions cluster together, and which local relationships matter.</p><p>There is one more subtle finding that I think is the most philosophically interesting in the paper: <em>local distances</em> don’t survive calibration either. Only local <em>neighborhood relationships</em> (the topological “who is near whom”) survive.</p><p>Models seem to agree on neighborhood membership without agreeing on the precise metric structure within those neighborhoods.</p><p>This is what the paper calls the <strong>Aristotelian view</strong>: representations converge not to a shared Platonic geometry, but to shared relational structure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gFuLROcpV9qdrsKBz8JMvg.png" /></figure><h4>Topology versus geometry</h4><p>Honestly, this was the point where the discussion started sounding less like geometry and more like topology. Geometry studies properties that depend on exact distances: angles, lengths, areas. Topology studies properties that survive continuous transformation: stretching, bending, warping, deformation. A coffee mug and a donut are topologically equivalent because both have exactly one hole, even though their geometry differs dramatically.</p><p>The Aristotelian view sounds almost like a representational version of this idea: models may preserve relational neighborhoods without preserving exact metric structure. The relevant mathematical fact is that distance-preserving transformations (isometries) form a <em>smaller</em>group than neighborhood-preserving transformations (homeomorphisms in the continuous limit). What survives across models is the coarser invariant.</p><p>In my old electronics-engineering vocabulary, this is similar to saying that two filters can share the same <em>poles and zeros</em> (the relational structure of where things attract and where things vanish) without sharing the same <em>gain</em>. The qualitative response is identical. The absolute calibration differs. If you only care about which frequencies are emphasized relative to which others, the two filters behave the same. If you care about the absolute output amplitude, they don’t.</p><p>Convergence at the topological level is convergence of poles and zeros. Convergence at the geometric level would be convergence of gain too. The empirical claim of the Aristotelian view is that we get the first but not the second.</p><h4>A short detour: symmetry, invariance, and what physics learned</h4><p>There is a thread running through modern physics that I think clarifies what these papers are actually circling.</p><p>In 1918, Emmy Noether proved a theorem that quietly reshaped how physicists think about reality. The statement, stripped to its essence: <strong>every continuous symmetry of a physical system corresponds to a conserved quantity</strong>. Time-translation symmetry (the laws are the same yesterday and today) gives you conservation of energy. Spatial-translation symmetry (the laws are the same here and there) gives you conservation of momentum. Rotational symmetry gives you angular momentum.</p><p>The deep philosophical content of Noether’s theorem is not really about conservation laws. It is about the relationship between symmetry and substance. <em>What is real is what is invariant under symmetry.</em> The pieces of a physical description that change under a coordinate transformation are bookkeeping. The pieces that don’t change are physics.</p><p>This is the lesson Wilczek keeps returning to in <em>A Beautiful Question</em>: beauty in physics is not decoration. It is a diagnostic. When a theory is invariant under a large enough group of transformations, that invariance is doing real work. It is telling you which features of the formalism correspond to anything in the world, and which are artifacts of the perspective you happened to choose.</p><p>Now consider what the macro-convergence debate is actually doing in this light.</p><p>PRH says: different neural networks should be <em>invariant under modality choice</em>, pixels or words, the underlying statistical reality is the same. <a href="https://arxiv.org/abs/2604.18572"><em>Back into Plato’s Cave</em></a> says: maybe not, the invariance breaks once you measure carefully. The Aristotelian view says: the invariance is real, but it lives at the level of <em>neighborhood relations</em> rather than <em>distances or coordinates</em>.</p><p>Each of these is, in disguise, a claim about which symmetry group neural representations respect.</p><ul><li><strong>Coordinate invariance</strong>: the ability to permute or relabel neurons without changing anything that matters is the most basic symmetry, and nobody really disputes it. The model doesn’t care which neuron is “neuron #7.”</li><li><strong>Linear-transformation invariance</strong>: the symmetry implicit in PRH’s kernel framing is stronger. It says that any invertible linear remapping of the representation space preserves the meaningful content. This is roughly what model stitching evidence suggested.</li><li><strong>Distance-preserving (isometric) invariance</strong>: the claim that two models share metric structure up to rigid motion. This is what global CKA and similar metrics try to detect, and what the Aristotelian paper argues <em>doesn’t</em> survive calibration.</li><li><strong>Neighborhood-preserving (topological) invariance</strong>: the claim that what survives is “who is near whom” is even weaker, and it is what the Aristotelian view argues <em>does</em> survive.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2J3xPX01t73mOgIfW1NQ0w.png" /></figure><p>Read in this way, the entire macro debate is a search for the right symmetry group. The Platonic hypothesis bet on a large symmetry group (full kernel equivalence). The Newtonian critique showed the metric-level symmetries don’t hold. The Aristotelian synthesis says the symmetry is real but smaller than we thought, it’s a topological symmetry, not a geometric one.</p><p>This is exactly the trajectory physics took. Newton’s mechanics looked like it had Galilean symmetry; Einstein discovered the symmetry was actually Lorentzian, and that the “extra” structure Newton thought was real (absolute simultaneity, absolute time) was a coordinate artifact that didn’t survive the move to a larger symmetry group. The history of physics is, in large part, the history of discovering that the <em>real</em>symmetry group of nature is larger and stranger than the one we initially assumed, and that what we mistook for fundamental structure was often just our particular coordinate choice.</p><p>I find it strangely encouraging that representation learning seems to be going through a smaller version of the same process. We assumed neural networks would converge to shared coordinates. We discovered they share something coarser. The story of finding out <em>exactly how coarse</em> is the same shape of story physics has been telling for a hundred years.</p><p>If Noether were watching this debate, I think she would recognise the question immediately: not <em>do they agree?</em>, but <em>under which group of transformations do they agree?</em> That question is the one I want to carry forward.</p><h4>A short detour: notation, and which structure is visible</h4><p>There is a sibling intuition I want to pull in here, because it has been quietly shaping how I think about this whole debate.</p><p>Linus Lee has an essay called <em>Notation as a Tool of Thought</em> (like a much older Iverson essay of the same title) which makes the following point: the notation you choose to represent a problem is not neutral. It determines which operations are easy and which are invisible. Multiplication is hard in Roman numerals and trivial in Arabic numerals, even though the underlying mathematical structure is identical. The numbers are the same. The notations make different operations <em>thinkable</em>.</p><p>This is the same idea as the Aristotelian view, run in reverse.</p><p>The Aristotelian view says: <em>different models converge on the same relational structure despite using different coordinate systems.</em> Linus’s point is: <em>different coordinate systems make different relational structures (Umwelt?) visible to us.</em> One direction is about model-to-model agreement. The other direction is about world-to-mind expressibility. But the deep claim is the same: <em>what you can see, and what you can compare, depends on the coordinate system you happen to inhabit</em>.</p><p>Which raises a slightly uncomfortable question that I want to flag without trying to answer: if our measurement of “convergence” is itself filtered through a chosen notation (mutual-NN, CKA, calibrated or not), are we discovering convergence in the models, or in our metric? The Aristotelian paper answers part of this by calibrating against the null by asking how much of what we see is an artifact of the lens. But the deeper question remains. We may be partway through a long process of inventing the right notation for what neural-network representations actually are. And the notation we land on will, in a quiet way, determine what we are allowed to see.</p><h4>A note on the shape of this whole story</h4><p>There is a pattern to this kind of story that is worth naming. Hegel described intellectual progress as a dialectic: a thesis is proposed, an antithesis pushes back against it, and a synthesis emerges that preserves what was right about both. The pattern is not really about philosophy, it shows up wherever a sharp idea meets sharp measurement. Newtonian mechanics gave way to special relativity, which preserved Newton as a low-velocity limit. Euclidean geometry gave way to Riemannian, which preserved Euclid as a zero-curvature special case. Classical genetics gave way to molecular biology, which preserved Mendel’s laws as statistical regularities over a more complex substrate. Each time, the synthesis was not the original claim rescued, and not the critique vindicated, it was a more careful claim that absorbed both. <em>Convergence of representations</em> now seems to be going through the same loop. PRH proposed a Platonic unity. <a href="https://arxiv.org/abs/2604.18572"><em>Back into Plato’s Cave</em></a> showed where that unity breaks. The Aristotelian view is the synthesis: a weaker, more careful claim about which level the unity actually lives at. If the pattern holds, the Aristotelian view will itself give way to something more careful still, and that is not a sign the field is confused. It is a sign that the field is doing what fields do.</p><h4>So what did the macro debate actually settle?</h4><p>In my humble opinion, none of these papers fully proves its strongest philosophical interpretation.</p><p><strong>PRH does not prove the existence of a single underlying Platonic geometry of reality</strong></p><p><a href="https://arxiv.org/abs/2604.18572"><strong><em>Back into Plato’s Cave</em></strong></a><strong> does not prove that such shared structure is absent.</strong></p><p><strong>The Aristotelian view does not prove that topology is the “true” invariant of representation.</strong></p><p>What these papers actually show, taken together, is more subtle:</p><blockquote>Different notions of similarity survive under different measurement regimes.</blockquote><p>The deeper question gradually becomes: <em>at what level of abstraction does representational convergence remain stable?</em> Coordinates? Distances? Neighborhoods? Spectra? Functions? Causal structure?</p><p>Different papers probe different layers of this hierarchy. Many apparent disagreements come from measuring different kinds of structure rather than observing contradictory phenomena.</p><p>This is also where the question stops being a closed question. Because if the unit of convergence is something coarser than geometry (if it’s some kind of relational or topological invariant) then we are forced to ask: <em>what exactly is that invariant made of?</em></p><p>That is no longer a question about whether models agree. It’s a question about what kinds of internal structure are even capable of being the <em>thing</em> that agrees.</p><h3>What to expect in Part 2</h3><p>If the macro debate is if models converge, the micro debate is what they converge <em>to</em>.</p><p>Lines? Directions? Circles? Fourier modes? Something stranger?</p><p>This is where the story gets more concrete and weirder.</p><p>By the end, we will have a taxonomy: spectral, geometric, relational, functional, mechanistic. Each of them a different answer to the same question, valid in its own regime, misleading outside it.</p><p>I think meaning in these systems is probably not a coordinate, and probably not even a manifold. I think meaning could be a <em>relational thing</em>, something that lives in the pattern of what stays the same when everything else is allowed to change. That is the position I have been circling toward through all of this, and Part 2 is where I will try to make it stick.</p><p>See you in Part 2!</p><p><em>Thanks for reading. If any of this resonated, or if you think I have something wrong, I would like to hear from you. This is my attempt to map a landscape I am still actively exploring, and the map will get sharper with pushback.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b8adcb77b12" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Some BERTs and ModernBERT]]></title>
            <link>https://medium.com/@alpernebikanli/some-berts-and-modernbert-39b261b1ce83?source=rss-7df355b3196e------2</link>
            <guid isPermaLink="false">https://medium.com/p/39b261b1ce83</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[bert]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[modern-bert]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[Alper Nebi Kanlı]]></dc:creator>
            <pubDate>Thu, 22 May 2025 22:07:28 GMT</pubDate>
            <atom:updated>2025-05-22T22:07:28.062Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>In 2018, published by Devlin et al., <a href="https://arxiv.org/abs/1810.04805"><em>BERT (Bidirectional Encoder Representations from Transformers)</em></a> revolutionized natural language processing. By its inception, it set new benchmarks across tasks like text classification, named entity recognition, and question answering.</p><p>And, we can consider it as one of the most important milestones in the evolution of NLP model architectures. It was one of the first <strong>transformer</strong> models which introduced <strong>contextual embeddings</strong> and achieved real-world success. (take a look at my blog post <a href="https://www.alpernebikanli.com/blog/posts/journey-of-embeddings"><strong>“Journey of Embeddings”</strong></a>!)</p><p>While autoregressive models coming from the lineage of <strong>GPT</strong> revolutionized particularly <strong>natural language generation</strong> tasks, BERT based models maintained their popularity in specific use cases involving <strong>natural language understanding</strong>.</p><p>However, BERT’s design was not without limitations. Its <strong>high computational cost</strong>, <strong>inefficiencies in fine-tuning</strong>, and <strong>inability to handle long sequences</strong> required and triggered a wave of improvements. Over the years, a series of successors refining BERT’s architecture came. Models like <strong>RoBERTa</strong>, <strong>ALBERT</strong>, <strong>DistilBERT</strong>, <strong>ELECTRA</strong> and <strong>MosaicBERT</strong> improved efficiency, while <strong>Longformer</strong> and <strong>DeBERTa</strong> extended its capabilities for long-context and nuanced tasks.</p><p>Ideas from all of these improved models pushed the field further, and paved the way for a new generation of encoder-based architectures. Finally, <strong>ModernBERT</strong> came: a model designed to redefine the capabilities and efficiency of encoder-only transformers. Introduced in the late 2024 paper <a href="https://arxiv.org/abs/2412.13663"><em>“Smarter, Better, Faster, Longer: A Modern Bidirectional Encoder for Fast, Memory Efficient, and Long Context Finetuning and Inference”</em></a> by Warner et al., ModernBERT represents a significant leap forward by addressing the limitations of previous models.</p><p>Unlike its predecessors, ModernBERT is not only optimized for shorter tasks like classification and retrieval but also excels in long-context applications, handling sequences up to <strong>8,192 tokens</strong>, a substantial improvement over the <strong>512-token limit of BERT</strong>. This extended capacity opens up opportunities in domains such as legal text analysis, long-form document retrieval, and code understanding, where handling extensive context efficiently is crucial.</p><p>At the heart of ModernBERT’s design are several important advancements:</p><p><strong>Rotary Positional Embeddings (RoPE):</strong> Enabling effective processing of both short and long-context sequences while maintaining performance consistency.</p><p><strong>Flash Attention:</strong> A breakthrough memory-efficient attention mechanism that reduces computational overhead during both training and inference.</p><p><strong>Unpadding Mechanism:</strong> Inspired by MosaicBERT, this technique eliminates unnecessary padding tokens and improves efficiency for variable-length sequences.</p><p><strong>Global and Local Attention:</strong> This mechanism allows the model to attend to both global and local contexts and to enhance its ability to capture long-range dependencies.</p><p><strong>Better Training Data:</strong> Trained on 2 trillion tokens spanning diverse domains such as web documents, scientific literature, and code</p><p>By synthesizing previous advancements and introducing its own, ModernBERT establishes itself as a <strong>Pareto improvement</strong>, delivering better performance while demanding fewer resources.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/0*WUdR9leSpSRHQ-xX" /></figure><p><a href="https://huggingface.co/blog/modernbert">ModernBERT Pareto Curve, from HuggingFace blog</a></p><p>It achieves state-of-the-art results on <a href="https://gluebenchmark.com/"><strong>GLUE</strong></a> and <a href="https://eval.ai/web/challenges/challenge-page/1897/overview"><strong>BEIR</strong></a> benchmarks, all while maintaining a balance between accuracy, speed, and resource efficiency. This balance makes ModernBERT not only a technological achievement but also a practical solution for real-world NLP challenges.</p><p>Of course, I will not just mention ModernBERT like writing a social media post and finish here. And I almost could not help writing a “Journey of ModernBERT” in the style of my previous posts. But it could took an era, so I tried to find a balance.</p><p>In the following sections, we will explore what happened after BERT, what are the main <strong>ideas</strong>, how we got ModernBERT, and how does ModernBERT work.</p><p>Let’s start with reviewing BERT.</p><h4>BERT</h4><p>After the publication of the paper <a href="https://arxiv.org/abs/1706.03762"><em>Attention is all You Need</em></a> by Vaswami et al. in 2017, <strong>transformer</strong> architecture entered the scene of NLP. BERT was one of the first models that succesfully used this paradigm ready to be used in industrial settings.</p><p>BERT achieved its success through two main ideas: <strong>masked language modeling with bidirectional attention mechanism</strong> and its <strong>pretraining/fine-tuning</strong> paradigm.</p><p><strong>Masked Language Modeling (MLM)</strong></p><p>MLM is a pretraining objective where a certain percentage of tokens in the input text are randomly replaced with a special <strong>[MASK]</strong> token. The model is then trained to predict these masked tokens based on the surrounding context. This approach enables the model to learn <strong>bidirectional representations</strong> of language, meaning it considers both the tokens before and after the masked token when making predictions.</p><p>For example, in the sentence:</p><p><em>“BERT achieved its</em> <strong>[MASK]</strong> <em>through its two key innovations”</em></p><p>BERT uses the words “BERT achieved its” and “through its two key innovations” to infer that the missing word is likely “success” or another fitting noun. This bidirectional analysis ensures that BERT captures how words are influenced by their <strong>left</strong> and <strong>right</strong> context, which is critical for understanding nuanced relationships in language.</p><p>Both GPT and BERT create <strong>contextual embeddings</strong>, but their <strong>contextual scope</strong> differs. GPT’s <strong>unidirectional embeddings</strong> are sufficient for tasks like generation, while BERT’s <strong>bidirectional embeddings</strong> provide a richer understanding of language for comprehension-focused tasks.</p><p><strong>Pretraining/Fine-Tuning Paradigm</strong></p><p>BERT’s <strong>pretraining/fine-tuning paradigm</strong> was another critical innovation that reshaped NLP. During the pretraining phase, BERT learns general language representations by optimizing its objectives: <strong>Masked Language Modeling (MLM)</strong> and <strong>Next Sentence Prediction (NSP)</strong> (later shown to be less impactful but initially included).</p><p>Once pretrained, BERT can be fine-tuned for specific <strong>downstream tasks</strong> with <strong>relatively small datasets and minimal additional training.</strong></p><p>This two-step paradigm significantly <strong>lowered the barrier to developing high-performing NLP models</strong> for various applications. There was no need to train models from scratch for every task, making BERT a versatile foundation for real-world applications.</p><p>Upon release, BERT was on the top of leaderboards for <strong>GLUE (General Language Understanding Evaluation)</strong> and <strong>SQuAD (Stanford Question Answering Dataset)</strong>, demonstrating state-of-the-art capabilities in natural language understanding. Within months, Google incorporated BERT into their search engine, improved the relevance of search results for over 10% of queries according to their official blog post <strong>Understanding searches better than ever before</strong>.</p><p>Despite its revolutionary approach, BERT had key limitations:</p><p><strong>Heavy Computational Requirements:</strong> Its large model size and high memory demands limited real-world usability.</p><p><strong>Limited Efficiency in Fine-Tuning:</strong> Adapting BERT to specific tasks still required significant resources.</p><p><strong>Struggles with Long Sequences:</strong> BERT could process only a limited number of tokens, making it less effective for long-context tasks.</p><h3>After BERT</h3><h4>RoBERTa</h4><p><a href="https://arxiv.org/abs/1907.11692"><strong>RoBERTa</strong></a>, introduced by Liu et al. in 2019 as a robust optimization of BERT, focused on refining the <strong>pretraining process</strong> and improving the <strong>training datasets</strong> to extract maximum performance from the original architecture.</p><p>In the original BERT implementation, the same tokens in a given training example were masked every epoch. This lead to less variation in the training signals the model received. With <strong>dynamic masking</strong>, RoBERTa randomly selects different tokens to mask each time an example is seen.</p><p>For example, consider the sentence:</p><p><em>“BERT achieved its success through its two key innovations.”</em></p><p>In the first epoch, the model might mask the word <strong>“success”</strong>, resulting in the input: <em>“BERT achieved its</em> <strong>[MASK]</strong> <em>through its two key innovations.”</em></p><p>In the second epoch, the model might mask a different token, such as <strong>“two”</strong>, resulting in the input: <em>“BERT achieved its success through its</em> <strong>[MASK]</strong> <em>key innovations.”</em></p><p>This dynamic variation forces the model to infer context under a broader range of conditions, making it less likely to overfit to specific masking patterns. It encourages the model to explore the relationships between tokens in different contexts, almost like increasing the data itself. And this enhances its ability to learn <strong>robust and generalized bidirectional representations</strong>.</p><p>Dynamic masking also helps capture more nuanced relationships in language:</p><p>When <strong>“success”</strong> is masked, the model learns the relationship between <strong>“achieved”</strong> and <strong>“through its two key innovations.”</strong></p><p>When <strong>“two”</strong> is masked, the model focuses on numeric relationships and the structure of the phrase.</p><p>Moreover, RoBERTa was pretrained on much larger datasets than BERT, including <strong>BookCorpus</strong>, <strong>CC-News</strong>, <strong>OpenWebText</strong>, and <strong>Stories</strong>. This extended training allowed it to generalize better across tasks. Remember, in deep learning models, scale matters.</p><p>These changes significantly boosted RoBERTa’s performance across multiple benchmarks. For example, on GLUE, RoBERTa achieved an average score of <strong>88.5</strong>, outperforming BERT’s <strong>83.1</strong>. On SQuAD v1.1, it achieved an F1 score of <strong>94.6</strong> compared to BERT’s <strong>88.5</strong>. By addressing inefficiencies in BERT’s pretraining, RoBERTa established itself as a powerful model for tasks requiring robust contextual understanding, making it a preferred choice for production environments needing enhanced accuracy.</p><h4>ALBERT</h4><p><a href="https://arxiv.org/abs/1909.11942"><strong>ALBERT</strong></a> was introduced by Lan et al. in 2020, and aimed to make transformer-based models more <strong>resource-efficient</strong> while maintaining competitive performance.</p><p>It focused on one of BERT’s primary drawbacks, its large memory footprint, through two key innovations: <strong>cross parameter sharing</strong> and <strong>factorized embeddings</strong>.</p><p><strong>Cross-Layer Parameter Sharing</strong></p><p>Transformer-based models like BERT normally require unique sets of parameters for every layer, and this leads to significant memory consumption and inefficiency. ALBERT changes this by <strong>reusing parameters across layers</strong> and drastically reducing the number parameters in the model.</p><p>Many of the weights in deeper layers of BERT are highly correlated, meaning they learn redundant or similar transformations. So, instead of learning them repeatedly, sharing parameters would exploit this redundancy.</p><p>In ALBERT, weights for certain components such as the attention mechanism and feedforward networks are shared across all transformer layers. For example, the same set of weights for the feedforward network is applied at every layer of the model.</p><p>Instead of learning a unique transformation at each layer, ALBERT applies the same transformation iteratively across all layers.</p><p>While the parameters are shared, the intermediate representations at each layer remain distinct because they depend on the input processed through the shared parameters.</p><p>This innovation made the model lighter without compromising the performance too much.</p><p><strong>Factorized Embeddings</strong></p><p>The embedding layer in transformer-based models like BERT directly tied the vocabulary size (number of tokens in the vocabulary) to the hidden layer size (dimensions of the internal representations of the model). This coupling led to massive memory requirements, particularly for large vocabularies, as the embedding matrix was often the largest component in terms of storage.</p><p>For instance, if a model had a vocabulary size of 30000 tokens and a hidden layer size of 512 dimensions, the embedding matrix would require 30000×512 parameters. And, this would cause significant burden for memory efficiency, especially in environments with constrained resources.</p><p>ALBERT decoupled these by introducing a smaller <strong>embedding dimension</strong> and a separate <strong>projection layer</strong> to match the hidden layer size. This design significantly reduced the size of the embedding matrix. This change was an important milestone in making transformer models more lightweight and accessible for deployment.</p><p>These innovations enabled ALBERT to achieve state-of-the-art results on several benchmarks, including GLUE and SQuAD. On GLUE, ALBERT achieved an overall score of <strong>89.4</strong>, surpassing BERT’s <strong>83.1</strong>, while maintaining a significantly smaller parameter footprint. On SQuAD v1.1, ALBERT recorded an F1 score of <strong>92.2</strong> compared to BERT’s <strong>88.5</strong>. This</p><h4>DistilBERT</h4><p><a href="https://arxiv.org/abs/1910.01108"><strong>DistilBERT</strong></a>, introduced by Sanh et al. in 2020, was one of the first successful implementations of knowledge distillation in transformer models. Knowledge distillation is a process where a smaller model (<strong>student</strong>) learns to mimic a larger, pre-trained model (<strong>teacher</strong>), to capture most of its capabilities while significantly reducing size and computational requirements.</p><p><strong>Knowledge Distillation</strong></p><p>At the core of DistilBERT’s knowledge distillation process is the use of <strong>soft labels</strong>, which are the probability distributions produced by the teacher model for each output. Unlike traditional training that relies on <strong>hard labels</strong> (one-hot encoded ground truth), soft labels encode richer information about the teacher’s confidence in its predictions and the relationships between classes.</p><p>For example, in a classification task, while hard labels might indicate:</p><p>[bicycle=1, plane=0, car=0]</p><p>soft labels from the teacher model might convey:</p><p>[bicycle=0.85, plane=0.5, car=0.10]</p><p>The student is trained to mimic these soft labels, capturing not just the correct answer but also the <strong>relative confidence</strong> in each class.</p><p>This probabilistic knowledge transfer enables the student model to generalize better, even with significantly fewer parameters.</p><p>(It resembles the transition between one-hot encoding and dense vectors for representations of words. Fractal nature of innovations!)</p><p>In addition to soft labels, DistilBERT leverages the <strong>intermediate representations</strong> of the teacher model to align the internal architectures of the student and the teacher. By replicating the embeddings and attention patterns of the teacher, the student learns to capture the same latent knowledge while operating with reduced computational complexity. This step enhances the ability of student to mirror the contextual understanding of the teacher.</p><p>The training process combines multiple loss functions:</p><p>1. <strong>Distillation Loss</strong>: Measures the divergence between the student’s output probabilities and the teacher’s soft labels (e.g., using Kullback-Leibler divergence).</p><p>2. <strong>Supervised Loss</strong>: Ensures the student performs well on the original task using hard labels (e.g., cross-entropy loss).</p><p>3. <strong>Intermediate Layer Loss</strong>: Encourages the student’s hidden states to match those of the teacher, aligning their internal representations.</p><p>DistilBERT’s lightweight architecture made it ideal for applications requiring efficient real-time processing, such as mobile applications and web services.</p><p>With 40% reduction in parameters, on GLUE benchmarks, DistilBERT achieved an overall score of <strong>82.3</strong>, compared to BERT’s <strong>83.1</strong>.</p><p>Also, on SQuAD v1.1, DistilBERT recorded an F1 score of <strong>86.9</strong>, which was close to BERT’s <strong>88.5</strong>, demonstrating its ability to maintain high accuracy despite its significantly smaller size and faster inference speeds.</p><p>These results proved that distillation techniques could make transformer models accessible for resource-constrained environments without substantial trade-offs in performance.</p><h4>ELECTRA</h4><p><a href="https://arxiv.org/abs/2003.10555"><strong>ELECTRA</strong></a> introduced by Clark et al. in 2020 as a novel approach to pretraining by combining a <strong>generator-discriminator framework</strong>, and fundamentally changed how masked tokens were predicted. Unlike BERT which masks tokens and predicts them directly, ELECTRA uses a two-step process.</p><p><strong>Step 1: Generator</strong></p><p>For simulating a realistic corruption process, a lightweight generator replaces selected tokens in the input sequence with <strong>plausible alternatives</strong>.</p><p>The generator is trained with a masked language modeling (MLM) objective similar to BERT. But it is designed to be small and efficient as it plays only a supporting role in the framework.</p><p><strong>Step 2: Discriminator</strong></p><p>The discriminator is trained to identify whether each token in the input is <strong>original</strong> or <strong>replaced</strong>. This binary classification task forces the model to attend to subtle contextual clues across all tokens in the sequence, not just the masked ones.</p><p>For example:</p><p><strong>Input Sequence:</strong> <em>“Unlike BERT which masks tokens and</em> <strong>[MASK]</strong> <em>them directly, ELECTRA uses a two-step process.”</em></p><p><strong>Generator Output:</strong> <em>“Unlike BERT which masks tokens and</em> <strong>[MASK]</strong> <em>them directly, ELECTRA uses a two-step process.”</em></p><p><strong>Discriminator Task:</strong> Predict whether each token is original (e.g., “predicts” is replaced).</p><p>This process makes <strong>every token a learning opportunity</strong> and dramatically increases the density of training signals compared to BERT.</p><p>BERT’s pretraining relies on predicting a small percentage of masked tokens (e.g., 15%). In contrast, ELECTRA utilizes <strong>all tokens</strong> in the sequence by training the discriminator to assess each one. This results in richer and more efficient learning, as the model captures relationships across the entire input.</p><p>ELECTRA’s pretraining approach dramatically reduces the computational cost compared to BERT. For instance, it achieved comparable performance on benchmarks like GLUE while requiring only <strong>25%</strong> of the compute during pretraining.</p><p>On the GLUE benchmark, ELECTRA recorded a score of <strong>88.6</strong> which matches RoBERTa’s <strong>88.5</strong>, but with significantly lower resource requirements.</p><p>This made ELECTRA particularly appealing for scenarios where computational efficiency is critical, such as real-time systems and environments with constrained resources.</p><h4>Longformer</h4><p><a href="https://arxiv.org/abs/2004.05150"><strong>Longformer</strong></a> was introduced by Beltagy et al. in 2020 to address one of the key limitations of BERT: its inability to handle <strong>long input sequences</strong>. Main reason for BERT’s inability in it is due to quadratic computational complexity in the attention mechanism.</p><p>Longformer achieves the improvement through <strong>sparse attention</strong>, which is a mechanism that reduces the complexity of self-attention <strong>from quadratic to linear</strong> with respect to the sequence length.</p><p>In standard transformer architectures, the self-attention mechanism computes attention scores for all pairs of tokens in the input sequence. This results in a computational complexity of O(n²) where n is the sequence length. This limitation makes processing long sequences prohibitively expensive.</p><p>Longformer reduces this complexity to <strong>O(n)</strong> by introducing <strong>sparse attention</strong>, which focuses attention computations on a subset of tokens.</p><p>It employs a combination of:</p><p><strong>Local Attention</strong>: Each token attends only to a fixed window of nearby tokens to capture local context efficiently. This is particularly useful for tasks where adjacent tokens are most relevant.</p><p><strong>Global Attention</strong>: Specific tokens, such as classification tokens or task-relevant keywords, are designated as <strong>global tokens</strong>. This allows them to attend to all tokens in the sequence and ensures that critical global context is not lost.</p><p>Longformer introduces flexibility through <strong>customizable attention patterns</strong> to enable task-specific configurations.</p><p>For example:</p><ul><li>In classification tasks, the <strong>CLS</strong> token can be assigned global attention.</li><li>In summarization, key sentences or paragraphs can receive global attention to enhance the ability of the model to capture critical information.</li></ul><p>This adaptability allows Longformer to be succesful in a variety of NLP tasks requiring long-context understanding such as summarization and long-form question answering. For example, on the TriviaQA benchmark, Longformer achieved an F1 score of <strong>79.4</strong>, significantly surpassing BERT’s <strong>72.6</strong>.</p><p>In document classification tasks, Longformer handles sequences up to <strong>4096</strong> tokens efficiently, compared to BERT’s <strong>512</strong>.</p><p>Its ability to efficiently handle long sequences has made it a valuable tool in domains such as document understanding, legal text analysis, and biomedical research where large context windows are crucial for success.</p><h4>DeBERTa</h4><p><a href="https://arxiv.org/abs/2006.03654"><strong>DeBERTa</strong></a> (Decoding-enhanced BERT with Disentangled Attention), by He et al. in 2021 introduced significant advancements in handling embeddings and attention mechanisms. Its primary innovation lies in <strong>disentangling content and positional embeddings</strong>.</p><p><strong>Disentangled Content and Positional Embeddings</strong></p><p>Traditional transformer models like BERT combine content and positional information into a single embedding. Each word is basically represented as a sum of its word embedding and position embedding. While effective, this coupling can lead to interference between semantic and positional relationships and can reduce the model’s ability to represent these aspects independently.</p><p>DeBERTa addresses this limitation by separating <strong>content embeddings</strong> (semantic information of tokens) and <strong>positional embeddings</strong> (relative positioning of tokens in the sequence). Each word is represented by these two vectors.</p><p>This disentanglement allows the model to <strong>focus on semantic meaning</strong> and <strong>handle positional complexity</strong>.</p><p><strong>Enhanced Mask Decoder</strong></p><p>DeBERTa further enhances its pretraining objective through the <strong>Enhanced Mask Decoder (EMD)</strong>, a mechanism that refines how the model predicts masked tokens in the <strong>Masked Language Modeling (MLM)</strong> task of BERT. Instead of predicting each masked token independently, EMD evaluates <strong>pairwise relationships</strong> between the masked token and all other tokens in the sequence to capture richer contextual interactions.</p><p>The EMD achieves this through:</p><ul><li><strong>Pairwise Decoding</strong>: Instead of treating each masked token prediction as isolated, the decoder models the relationships between the masked token and its surrounding tokens.</li><li><strong>Contextual Interaction</strong>: By combining the disentangled <strong>content embeddings</strong> and <strong>relative position embeddings</strong>, EMD processes the interactions between tokens more effectively.</li><li><strong>Dense Training Signal</strong>: The pairwise decoding mechanism increases the amount of useful training information extracted from each sequence.</li></ul><p>These innovations allowed DeBERTa to achieve state-of-the-art results on multiple NLP benchmarks. For example, on GLUE, DeBERTa scored <strong>90.1</strong>, surpassing previous models like RoBERTa <strong>(88.5)</strong> and BERT <strong>(83.1)</strong>. On SQuAD v2.0, DeBERTa achieved an F1 score of <strong>89.9</strong>, significantly improving over BERT’s <strong>79.0</strong>.</p><p>Following the success of <strong>DeBERTa v1</strong>, <strong>DeBERTa v2</strong> introduced refinements to enhance efficiency, scalability, and pretraining effectiveness.</p><p>It built upon the <strong>disentangled embeddings</strong> and <strong>relative position bias</strong> of its predecessor while incorporating <strong>ELECTRA-style generator-discriminator framework</strong> (also experimented in DeBERTa paper, as <strong>replaced token detection</strong> objective) and leading to a more <strong>data-efficient</strong> and <strong>powerful</strong> language model.</p><p>Also, DeBERTa v2 was pretrained on <strong>1.5TB of text</strong>, significantly larger than <strong>v1’s 78GB dataset</strong>. The dataset included <strong>CC-News, OpenWebText, Wikipedia, and BooksCorpus</strong> to improve generalization across NLP tasks.</p><p>DeBERTa v2 outperformed v1 across multiple benchmarks:</p><ul><li><strong>GLUE Benchmark:</strong> <strong>90.1</strong> (v2) vs. <strong>88.3</strong> (v1)</li><li><strong>SQuAD v2.0 F1 Score:</strong> <strong>89.9</strong> (v2) vs. <strong>88.2</strong> (v1)</li><li><strong>SuperGLUE Score:</strong> <strong>89.2</strong> (v2) vs. <strong>87.8</strong> (v1)</li></ul><p>While DeBERTa v2 improved efficiency, it still required significant compute resources. <a href="https://arxiv.org/abs/2111.09543"><strong>DeBERTa v3</strong></a> further improved the model’s performance and efficiency.</p><p><strong>Gradient-Disentangled Objective</strong></p><p>DeBERTa v3’s most notable innovation was the <strong>Gradient-Disentangled Objective (GDC)</strong>, which aimed to mitigate <strong>gradient conflicts</strong> between <strong>MLM (Masked Language Modeling)</strong> and <strong>RTD (Replaced Token Detection)</strong> objectives.</p><p>In models like DeBERTa v2 (which used both MLM and RTD for pretraining), conflicting gradients from these two objectives could <strong>interfere with learning</strong>, leading to suboptimal representations. GDC <strong>decouples</strong> these gradients, allowing the model to <strong>learn from both objectives independently</strong> and improving training efficiency.</p><p>GDC introduces a gradient projection layer that <strong>separates</strong> the updates from <strong>MLM and RTD</strong>, ensuring that one does not negatively impact the learning signal of the other.</p><p>(disentangling again!)</p><p>This disentangling mechanism reduces the required training steps and makes DeBERTa v3 more cost-efficient while maintaining state-of-the-art performance.</p><p>With GDC and optimizations in <strong>pretraining efficiency</strong>, DeBERTa v3 achieved superior performance across multiple tasks:</p><ul><li><strong>GLUE Benchmark:</strong> <strong>91.3</strong> (v3) vs. <strong>90.1</strong> (v2)</li><li><strong>SQuAD v2.0 F1 Score:</strong> <strong>91.1</strong> (v3) vs. <strong>89.9</strong> (v2)</li><li><strong>SuperGLUE Score:</strong> <strong>90.5</strong> (v3) vs. <strong>89.2</strong> (v2)</li></ul><h4>MosaicBERT</h4><p><a href="https://arxiv.org/abs/2312.17482"><strong>MosaicBERT</strong></a>, introduced by Portes et al. in 2023, is a <strong>lightweight and efficient</strong> transformer model designed for <strong>practical deployment in resource-constrained environments</strong>. While large transformer models like BERT and RoBERTa deliver state-of-the-art performance, they often come at the cost of high memory usage and computational inefficiency.</p><p>MosaicBERT integrates <strong>several architectural advancements</strong> that collectively improve both speed and accuracy. These include <strong>FlashAttention</strong>, <strong>Attention with Linear Biases (ALiBi)</strong>, <strong>Gated Linear Units (GLU)</strong>, <strong>unpadding mechanism</strong>, and <strong>low-precision LayerNorm</strong>, all of which significantly enhance training efficiency.</p><p><strong>Unpadding Mechanism</strong></p><p>In BERT, input sequences are padded to a fixed length (e.g., <strong>512 tokens</strong>) to ensure efficient <strong>batch processing</strong>. This is necessary because transformers operate on <strong>fixed-size tensors</strong>, and modern deep learning frameworks (like PyTorch and TensorFlow) require uniform input dimensions for parallel computation. However, this padding introduces <strong>significant inefficiencies</strong>, especially when dealing with sequences of varying lengths.</p><p>BERT employs <strong>attention masks</strong> to prevent the model from attending to <strong>[PAD]</strong> tokens during self-attention computations. However, despite this masking, padded tokens <strong>still consume memory and computational resources</strong>, since they are passed through <strong>all layers</strong> of the model.</p><p>Instead of processing padded sequences throughout all transformer layers, MosaicBERT dynamically <strong>tracks actual token lengths</strong>, eliminates padding and reindexes tokens for efficient computation. This optimization allows the self-attention mechanism to focus only on meaningful tokens and significantly reduce FLOPs and memory usage.</p><p>MosaicBERT employs an architecture that <strong>removes unnecessary complexity</strong> while maintaining the <strong>core transformer structure</strong>.</p><p><strong>GeGLU</strong></p><p>Instead of traditional <strong>Feed-Forward Networks (FFNs)</strong> in transformer layers, MosaicBERT uses Gated Linear Unit (<strong>GLU</strong>) with activation function Gaussian-error Linear Unit (<strong>GeLU</strong>). This improves parameter efficiency and enhances expressivity while maintaining speed.</p><p><strong>Flash Attention Integration</strong></p><p>To further optimize computational efficiency, MosaicBERT incorporates <strong>Flash Attention</strong>, a technique that reduces the amount of memory-intensive operations involved in self-attention. This allows the model to scale efficiently while maintaining <strong>high-speed execution</strong>.</p><p><strong>Low-Precision LayerNorm</strong></p><p>The model leverages <strong>bfloat16</strong> precision instead of <strong>float32</strong> as in BERT for <strong>LayerNorm</strong> operations. This reduces memory bandwidth requirements and improving throughput without compromising numerical stability.</p><p><strong>Attention with Linear Biases (ALiBi)</strong></p><p>Instead of learned positional embeddings of BERT, MosaicBERT employs <strong>ALiBi</strong>, which introduces a <strong>position-aware bias</strong> directly in attention scores. This approach <strong>reduces overhead</strong> and enables <strong>better generalization to longer sequences</strong>.</p><p>On the <strong>GLUE benchmark</strong>, it achieved an <strong>average score of 79.6</strong> in just <strong>1.13 hours on 8×A100 GPUs</strong>, at a <strong>fraction of the cost</strong> compared to traditional BERT training setups.</p><p>MosaicBERT-Base achieves an accuracy of <strong>83.2 on GLUE in just 4.6 hours</strong>, while a standard <strong>BERT-Base</strong> requires <strong>11.5 hours</strong> on the same hardware.</p><p>The combination of <strong>unpadding, Flash Attention, and GeGLU</strong> allows MosaicBERT to be <strong>Pareto-optimal</strong>, meaning it consistently outperforms standard BERT in the tradeoff between accuracy and training time.</p><p>Cumulative effect of all of these works and experimentations pushed the field further.</p><h3>ModernBERT</h3><p><strong>ModernBERT</strong>, introduced in the 2024 paper <a href="https://arxiv.org/abs/2412.13663"><em>“Smarter, Better, Faster, Longer: A Modern Bidirectional Encoder for Fast, Memory Efficient, and Long Context Finetuning and Inference”</em></a>, represents a significant leap in the development of encoder-only transformer models. Authored by researchers from institutions Answer.AI, LightOn, and Johns Hopkins University, ModernBERT builds on the legacy of BERT by incorporating contemporary innovations that address longstanding limitations in efficiency, scalability, and context handling.</p><p>ModernBERT is designed to achieve three primary goals:</p><ul><li><strong>Efficiency:</strong> Optimized for fast inference and reduced memory usage</li><li><strong>Versatility:</strong> Effective in handling both short- and long-context tasks</li><li><strong>Scalability:</strong> Natively capable of processing sequences up to 8192 tokens</li></ul><p>So, let’s talk about the techniques.</p><h4>Rotary Positional Embeddings</h4><p>In BERT, each token has two components in its final embedding:</p><p><strong>Token embedding (semantic meaning):</strong> Represents the meaning of a word, e.g., “BERT” is represented as a vector <strong>E_BERT</strong>.</p><p><strong>Positional embedding (absolute position):</strong> Represents the position of the word in the sequence, e.g., position 1 is <strong>P1</strong>, position 2 is <strong>P2</strong>, and so on.</p><p>For the sentence <em>“In BERT, each token has two components”</em>, BERT computes:</p><p><strong>E_In + P1, E_BERT + P2, E_each + P3, E_token + P4, E_has + P5, E_two + P6, E_components + P7</strong></p><p>While absolute positional embeddings allow models like BERT to encode token positions in a sequence, they treat positions as fixed, independent vectors. This approach lacks an explicit representation of the relative relationships between tokens, such as how close or far apart they are. As a result, models using absolute embeddings rely on the self-attention mechanism to infer these relationships indirectly, which can make it harder to generalize effectively across sequences of varying lengths or handle long contexts efficiently.</p><p>RoPE, on the other hand, applies a <strong>rotational transformation</strong> to the token embeddings to encode <strong>relative positional information</strong> directly into the attention mechanism. It is first proposed in <em>RoFormer: Enhanced transformer with Rotary Position Embedding</em> by Su et al. in 2023.</p><p><strong>Rotated(E_BERT, θ1), Rotated(E_each, θ2), Rotated(E_token, θ3), Rotated(E_has, θ4), Rotated(E_two, θ5), Rotated(E_components, θ6)</strong></p><p>Now, differences between angles represent relative distances.</p><p><strong>Relative Positional Awareness:</strong> RoPE makes the model aware of the relative distances between tokens, which is crucial for capturing relationships like <strong>“which word modifies which”</strong> or <strong>“what is the main subject”</strong>.</p><p><strong>Generalization to Long Contexts:</strong> Since RoPE doesn’t rely on a fixed positional embedding table like BERT, it can extend to longer sequences without predefined limits.</p><p><strong>Improved Attention Mechanism:</strong> By encoding relative positions directly into the token embeddings, the attention mechanism can more effectively weigh relationships between distant tokens.</p><h4>Global and Local Attention</h4><p>ModernBERT leverages <strong>a mix of global and local attention</strong> to optimize efficiency and capture both short-range and long-range dependencies.</p><p>While Longformer and similar models use <strong>predefined local and global attention patterns</strong>, ModernBERT optimizes attention placement dynamically. Instead of <strong>static global tokens</strong>, ModernBERT can <strong>assign different levels of global attention dynamically</strong> based on task-specific needs. This means that for some tasks (like classification) [CLS] and task-specific tokens receive stronger global attention, where for retrieval tasks <strong>important spans of text</strong> may be dynamically assigned global attention.</p><p>By balancing <strong>computational efficiency</strong> with <strong>effective context retention</strong>, ModernBERT achieves superior performance on long-context tasks without the quadratic cost of full self-attention.</p><h4>Flash Attention</h4><p>ModernBERT incorporates <strong>Flash Attention</strong>, an optimized attention mechanism introduced by Dao et al. in 2022. Flash Attention was designed to improve both the <strong>speed</strong> and <strong>memory efficiency</strong> of self-attention calculations in transformers, particularly for long sequences. Traditional self-attention mechanisms, as used in <strong>BERT</strong>, compute attention scores across all token pairs and store large <strong>attention matrices</strong>. Naturally, this leads to high <strong>memory consumption</strong> and <strong>slow processing times</strong>.</p><p>Flash Attention eliminates these inefficiencies by introducing three key optimizations:</p><p><strong>Blocked Attention Computation:</strong>Traditional attention computes a full <strong>n x n</strong> attention matrix, where <strong>n</strong> is the sequence length, leading to <strong>quadratic complexity</strong>. <strong>Flash Attention</strong> processes attention in <strong>small blocks</strong> that fit within fast on-chip memory (SRAM), significantly reducing memory overhead.</p><p><strong>Memory-efficient Backpropagation:</strong>Standard transformers store <strong>all</strong> intermediate attention scores, leading to excessive memory use. Flash Attention <strong>does not store</strong> attention matrices during forward propagation. Instead, it <strong>recomputes gradients on demand</strong> using <strong>on-chip memory</strong>.</p><p><strong>Hardware Optimization:</strong>Traditional attention mechanisms perform many unnecessary memory reads/writes to slow DRAM. Flash Attention <strong>optimally schedules computations</strong> to <strong>minimize memory access</strong>, leveraging modern <strong>GPUs’ fast SRAM</strong> for significantly faster execution.</p><p>By integrating Flash Attention, ModernBERT achieves <strong>up to 3x faster self-attention computations</strong> while using <strong>significantly less memory</strong>.</p><h4>Unpadding</h4><p>As in MosaicBERT, unpadding method is applied. However, its implementation differs in scope, execution, and efficiency improvements.</p><p>MosaicBERT optimizes transformer efficiency by <strong>removing padding tokens before computation</strong> and dynamically <strong>tracking token lengths</strong>. Standard transformers process all tokens (including padded ones) through every layer and waste compute on non-informative tokens. While attention masks prevent padded tokens from influencing results, they still <strong>consume memory and FLOPs</strong> because padded sequences are fed through every layer.</p><p>ModernBERT takes unpadding optimization further by <strong>removing padding tokens before the token embedding layer itself</strong> and ensuring that <strong>no padded tokens ever enter the main model pipeline</strong>. Unlike MosaicBERT’s approach, ModernBERT <strong>completely avoids the need for intermediate repadding</strong>.</p><h4>GeGLU</h4><p>ModernBERT uses <strong>Gated Linear Units (GeGLU)</strong> instead of traditional <strong>GeLU</strong> activation functions. GeGLU enhances the model’s expressivity by introducing an <strong>additional gating mechanism</strong>, allowing the model to control the flow of information dynamically.</p><p><strong>GeLU</strong> applies a simple non-linear transformation to the input. <strong>GeGLU</strong> splits input into two parts, applies an activation function to one part while using the other as a gate. This allows for <strong>better feature selection</strong> and improves generalization.</p><h4>Normalization after Embeddings</h4><p>Unlike BERT, which applies <strong>LayerNorm at multiple points</strong>, ModernBERT introduces <strong>early normalization</strong> right after the embedding layer. This ensures that token embeddings are <strong>properly scaled</strong> before they enter the transformer layers, leading to <strong>more stable training and improved generalization</strong>.</p><h4>Disabling Bias Terms</h4><p>In large models, bias parameters contribute <strong>marginally</strong> to performance but <strong>increase computation</strong>. ModernBERT removes <strong>bias terms</strong> from fully connected layers, a technique that has been shown to <strong>improve generalization</strong> and <strong>reduce parameter redundancy</strong>. This works <strong>particularly well</strong> when paired with <strong>normalization layers</strong>, which naturally compensate for the absence of biases.</p><h4>Training Data</h4><p>Of course, the data… ModernBERT follows the trend of leveraging <strong>high-quality, large-scale datasets</strong> to enhance both generalization and task-specific performance. Unlike the original BERT, which was trained on <strong>BookCorpus and English Wikipedia (16GB of text data)</strong>, ModernBERT benefits from a significantly more <strong>diverse, high-volume</strong> dataset.</p><p>ModernBERT is trained on <strong>2 trillion tokens</strong>, sourced from a mix of <strong>web content, academic literature, code repositories, and domain-specific texts</strong>. This expanded dataset ensures <strong>better coverage of linguistic patterns, terminology, and factual knowledge</strong>, making ModernBERT more robust across various applications.</p><h4>Evaluation</h4><p>This <strong>highly diverse dataset</strong> enables ModernBERT to outperform its predecessors in <strong>natural language understanding (GLUE, BEIR), retrieval tasks (DPR, MLDR), and long-context reasoning</strong>.</p><p>ModernBERT demonstrates state-of-the-art performance on the GLUE benchmark, showcasing its robustness across various sentence-pair understanding tasks:</p><ul><li><strong>ModernBERT-base</strong>: GLUE score of <strong>88.4</strong>, surpassing BERT-base (84.7) and RoBERTa-base (86.4).</li><li><strong>ModernBERT-large</strong>: GLUE score of <strong>90.4</strong>, outperforming BERT-large (85.2) and RoBERTa-large (88.9).</li></ul><p>ModernBERT excels in information retrieval tasks under the Dense Passage Retrieval (DPR) and ColBERT settings:</p><p><strong>BEIR benchmark (DPR setting)</strong></p><ul><li><strong>ModernBERT-base</strong>: Achieved a score of <strong>41.6</strong>, narrowly surpassing GTE-en-MLM-base (41.4).</li><li><strong>ModernBERT-large</strong>: Scored <strong>44.0</strong>, outperforming GTE-en-MLM-large (42.5).</li></ul><p><strong>BEIR benchmark (ColBERT setting)</strong></p><ul><li><strong>ModernBERT-base</strong>: <strong>51.3</strong>, versus BERT-base (49.0).</li><li><strong>ModernBERT-large</strong>: <strong>52.4</strong>, surpassing GTE-en-MLM-large (50.7).</li></ul><p>ModernBERT achieves competitive results on the MLDR benchmark, which evaluates retrieval performance for long-context tasks:</p><p><strong>Out-of-domain performance (MLDR-OOD)</strong></p><ul><li><strong>ModernBERT-base</strong>: <strong>27.4</strong>, trailing GTE-en-MLM-base (34.3).</li><li><strong>ModernBERT-large</strong>: <strong>34.3</strong>, slightly behind GTE-en-MLM-large (36.4).</li></ul><p><strong>In-domain performance (MLDR-ID)</strong></p><ul><li><strong>ModernBERT-base</strong>: <strong>44.0</strong>, comparable to GTE-en-MLM-base (44.4).</li><li><strong>ModernBERT-large</strong>: <strong>48.6</strong>, approaching GTE-en-MLM-large (48.9).</li></ul><p>And, ModernBERT is significantly more succesful in code understanding tasks compared to previous encoder-only models:</p><p><strong>CodeSearchNet</strong></p><ul><li><strong>ModernBERT-base</strong>: Achieved a score of <strong>56.4</strong>, outperforming GTE-en-MLM-base (44.9) and RoBERTa-base (44.3).</li><li><strong>ModernBERT-large</strong>: Scored <strong>59.5</strong>, exceeding GTE-en-MLM-large (40.5) and RoBERTa-large (47.3).</li></ul><p><strong>SQuAD v2.0 (SQA)</strong></p><ul><li><strong>ModernBERT-base</strong>: <strong>73.6</strong>, surpassing BERT-base (59.5).</li><li><strong>ModernBERT-large</strong>: <strong>83.9</strong>, significantly ahead of BERT-large (60.8).</li></ul><p>ModernBERT outperforms competitors in terms of efficiency, thanks to advancements like flash attention and unpadding:</p><p><strong>Maximum batch size</strong></p><ul><li><strong>ModernBERT-base</strong>: <strong>128k tokens</strong>, surpassing GTE-en-MLM-base (102k) and RoBERTa-base (102k).</li><li><strong>ModernBERT-large</strong>: <strong>128k tokens</strong>, exceeding GTE-en-MLM-large (102k) and RoBERTa-large (102k).</li></ul><p><strong>Inference speed (tokens/sec)</strong></p><ul><li><strong>ModernBERT-base</strong>: <strong>148.1 fixed</strong>, <strong>147.3 variable</strong>.</li><li><strong>ModernBERT-large</strong>: <strong>52.9 fixed</strong>, <strong>52.3 variable</strong>.</li></ul><p>With its blend of cutting-edge innovations and practical design, ModernBERT represents a new standard for encoder-only models.</p><h3>Conclusion</h3><p>To conclude, encoder-only models made a come back with ModernBERT, and I expect even further improvements, most likely involving generator-discriminator framework or other methods tried in BERT-inspired architectures.</p><p>There are so many groundbreaking improvements on generative AI models. But the landscape of NLP is not limited to them, and in each field practical and promising work continues to be performed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39b261b1ce83" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The LLM Era: from Embeddings to Emergence]]></title>
            <link>https://medium.com/@alpernebikanli/the-llm-era-from-embeddings-to-emergence-31e09d906fbf?source=rss-7df355b3196e------2</link>
            <guid isPermaLink="false">https://medium.com/p/31e09d906fbf</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[word-embeddings]]></category>
            <category><![CDATA[gpt]]></category>
            <dc:creator><![CDATA[Alper Nebi Kanlı]]></dc:creator>
            <pubDate>Thu, 16 Jan 2025 22:45:22 GMT</pubDate>
            <atom:updated>2025-01-22T18:45:38.598Z</atom:updated>
            <content:encoded><![CDATA[<p><em>“All of our experiments suggest that our results can be improved simply by waiting for faster GPUs and bigger datasets to become available.”</em></p><p>This quote is from the paper <a href="https://proceedings.neurips.cc/paper_files/paper/2012/file/c399862d3b9d6b76c8436e924a68c45b-Paper.pdf"><em>ImageNet Classification with Deep Convolutional Neural Networks</em></a> by Alex Krizhevsky, Ilya Sutskever and Geoffrey E. Hinton. (At least, we know what did Ilya see in 2012.)</p><p>In the previous two posts of the series Words and Their Mappings, I briefly introduced LLMs, and journey of embeddings up until BERT and GPT. In this post, we will explore our near past and today.</p><h3>Foundations</h3><p>In the era following BERT and GPT, categorically different kind of NLP emerged. I personally witnessed it during my years at Turkcell, working at a search engine project. Rapidly, new language models using transformer architecture are published. At these days, BERT and GPT used to be considered as large language models.</p><p>Researchers was striving to address the limitations of these early transformer-based models while exploring new horizons in language understanding, reasoning, and representation. Despite these efforts, skepticism toward large language models was widespread. Many viewed the field as a potential dead-end, constrained by computational costs and diminishing returns. Yet, this skepticism was met with what Richard Sutton famously termed <a href="http://www.incompleteideas.net/IncIdeas/BitterLesson.html"><em>The Bitter Lesson</em></a>, a paradigm shift driven by scaling models, data, and computational resources. (If you haven’t already, I highly recommend reading Sutton’s article. While I am skeptical about its details and extent, its core argument is compelling and valuable.)</p><p>Let us this time look into the foundational milestones that set the stage for the transformative capabilities of LLMs today.</p><h4>After BERT and GPT</h4><p>As I mentioned before, when <a href="https://arxiv.org/abs/1810.04805"><strong>BERT (Bidirectional Encoder Representations from Transformers)</strong></a> and <a href="https://cdn.openai.com/research-covers/language-unsupervised/language_understanding_paper.pdf"><strong>GPT (Generative Pre-trained Transformer)</strong></a> were introduced, they categorically changed the field of NLP. BERT excelled in <strong>understanding tasks</strong>, leveraging bidirectional context to generate embeddings that reflected the full surrounding context of each word. GPT, on the other hand, focused on <strong>generative tasks</strong>, using autoregressive modeling to predict text sequences fluently.</p><p>Despite their groundbreaking achievements, significant challenges remained:</p><ul><li><strong>Static Fine-Tuning</strong>: Both BERT and GPT required <strong>task-specific fine-tuning</strong>, a process that could be resource-intensive and limited the adaptability of the models across a diverse range of tasks.</li><li><strong>Single-Task Optimization</strong>: BERT and GPT were optimized for narrow objectives — BERT for masked language modeling and next-sentence prediction, and GPT for autoregressive language generation — resulting in limited versatility for tasks.</li><li><strong>Data Inefficiency</strong>: Both models were trained with a pretraining-finetuning paradigm that lacked the flexibility to dynamically adapt to new data or tasks without retraining.</li><li><strong>Contextual and Conceptual Gaps</strong>: While both models improved contextual understanding, they still struggled with tasks requiring deep reasoning, long-term dependencies, or representations of abstract concepts.</li><li><strong>Scalability and Performance</strong>: Early transformer-based models hinted at the potential of larger architectures but were constrained by the computational resources available at the time.</li></ul><p>These limitations prompted researchers to explore new architectures, training paradigms, and optimization strategies to expand the capabilities of transformers.</p><h4>T5: A Unified Framework</h4><p>What if we approach to all of the NLP tasks as text-to-text tasks?</p><p>Introduced by Google Research in 2020, <a href="https://arxiv.org/abs/1910.10683"><strong>T5 (Text-to-Text Transfer Transformer)</strong></a> by Raffel et al. represented a significant leap forward. It proposed a unifying framework that treated all NLP tasks as text-to-text problems. In this paradigm, both input and output were expressed as strings, enabling a consistent and versatile approach to diverse tasks.</p><p>By framing tasks such as translation, summarization, classification, and even question answering as text-to-text transformations, T5 simplified the NLP pipeline. Instead of maintaining</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3jJ8oeFsKYEhrVy4" /><figcaption>from <a href="https://arxiv.org/abs/1910.10683">T5 paper</a></figcaption></figure><p>At the first time, tasks were given as <strong>prompts</strong>. Although the prompts were fixed, this could be considered as one of the inspirations behind idea of <strong>prompt engineering</strong>.</p><p>Also, another important thing happened. Recall that we talked about <strong>contextual embeddings</strong> before. For example, “plane” as a vehicle and “plane” as a surface represented differently in the contextual embeddings generated by BERT and GPT. Now, this context in contextual embeddings became <strong>task-specific embedding</strong>. The embeddings started to represent <strong>tasks</strong> themselves in the latent space.</p><p>In addition to all of that, T5 introduced a new training method. Instead of BERT’s single token <strong>masked language modeling (MLM)</strong>, contiguous sequences of tokens were masked and replaced. This method was called <strong>span corruption</strong>. By doing this, model became more inclined to develop embeddings that encoded <strong>multi-word phrases</strong>. As you can guess, many concepts (such as “artificial intelligence” or “large language models”) are represented as multi-word phrases in the natural language. So, this allowed better concept representations in the latent space.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/0*1bdNi_94Gvo0REJl" /><figcaption>from <a href="https://arxiv.org/abs/1910.10683">T5 paper</a></figcaption></figure><p>Moreover, using multi-word phrases as embeddings allowed denser representations. This provided an additional performance boost and capturing broader conceptual information.</p><p>T5 also leveraged techniques like <strong>beam search</strong>, which systematically explored multiple output sequences to ensure grammatical accuracy and fluency. This made T5 particularly effective in structured tasks like translation and summarization, where coherence and precision were the first priorities.</p><p>However, T5 had several problems:</p><ul><li><strong>“Prompts” were static</strong>: The model couldn’t adapt to nuanced variations in task instructions. For instance, minor rewordings of a prompt might confuse the model or degrade performance.</li><li><strong>Overfitting to Masking Objective</strong>: By focusing on reconstructing masked spans during training, the model occasionally struggled with tasks requiring <strong>longer-range dependencies</strong> or deeper reasoning, as it prioritized reconstructive accuracy over broader generalization.</li><li><strong>Task-specific fine-tuning limitations</strong>: While T5 excelled in multi-task learning, it still required <strong>fine-tuning</strong> for many downstream tasks. Generalizing to entirely unseen tasks often necessitated additional training or adjustments.</li><li><strong>Less general-purpose embeddings</strong>: Embeddings became heavily tied to the tasks they were trained on, potentially reducing generalizability to new or unseen tasks.</li><li><strong>Fixed input lengths</strong>: Long documents or conversations needed to be truncated or split, which could lead to loss of context and degraded performance.</li><li><strong>Loss of global understanding</strong>: While T5 was effective for localized tasks, maintaining coherence across longer texts or multi-turn dialogues remained challenging.</li></ul><h4>GPT-2: Beyond GPT</h4><p>Released by OpenAI in 2019, mentioned in paper <a href="https://arxiv.org/abs/1912.05587"><strong>GPT-2</strong></a> marked a significant leap forward in generative language modeling. It built upon the foundations of GPT (2018) while addressing several challenges of earlier transformer-based models like T5 and BERT.</p><p>As T5 framed all tasks as text-to-text, GPT-2 framed all tasks as <strong>next-word prediction</strong>. In principle, GPT-2 demonstrated the potential of language models to perform tasks without task-specific fine-tuning. It could handle a variety of NLP tasks such as translation, summarization and question-answering simply by interpreting task instructions in natural language.</p><p>To enhance generative diversity and flexibility, GPT-2 introduced advanced decoding techniques. Among these was <strong>temperature scaling</strong>, which adjusted the model’s confidence in selecting the next token. Lower temperatures focused on high-probability outputs, producing deterministic and coherent responses. Higher temperatures, by contrast, allowed the model to explore less probable tokens, fostering creativity at the risk of incoherence.</p><p>Alongside temperature scaling, GPT-2 employed <strong>top-k sampling</strong> and <strong>nucleus sampling (top-p)</strong> to further refine text generation, enabling creative, contextually appropriate outputs while mitigating repetitiveness.</p><p>BERT and GPT had <strong>task-agnostic</strong> embeddings, T5 had <strong>task-specific</strong> embeddings, GPT-2 had <strong>task-adaptive</strong> embeddings.</p><p>Main difference between GPT and GPT-2 was <strong>scale</strong>. Larger parameters, and larger training data. While GPT had 117 million parameters and was trained on a 7GB dataset (BookCorpus), GPT-2 had 1.5 billion parameters and was trained on a much larger, 45GB dataset.</p><p>One can say “so what, better next-word prediction?”, but scale is more than just scale.</p><p>Emergence, Scaling Laws and Zero-Shot Learning</p><p>The jump from GPT to GPT-2 was more than a quantitative increase in scale; it was a qualitative shift in what language models could achieve. As the size of the model and its training data increased, something remarkable happened: <strong>emergent capabilities</strong> began to surface.</p><p>Before continuing, let me talk about the concept of <strong>emergence</strong>.</p><p>Emergence is a fundamental idea in <strong>complexity science</strong>, a field (one of my favourite fields!) that explores how simple rules at a lower level can give rise to intricate and unexpected phenomena at a higher level. In essence, emergence refers to the appearance of behaviors, properties, or patterns in a system that cannot be directly inferred from its individual components.</p><p>For example, think of a flock of birds. Each bird follows simple local rules: maintain distance from neighbors, align direction, and avoid collisions. Yet, as a collective, the flock exhibits graceful, dynamic patterns that seem to have a mind of their own. The behavior of the flock as a whole emerges from the interactions between the birds and their environment.</p><p>Similarly, in language models, emergence was seen in their ability to perform tasks it had not been explicitly trained for. For instance:</p><ul><li><strong>Zero-Shot Learning</strong>: GPT-2 could generalize to unseen tasks simply by interpreting natural language prompts. This was not the result of task-specific fine-tuning but rather an inherent property of the model’s training on diverse, large-scale datasets.</li><li><strong>Coherent Text Generation</strong>: Unlike earlier models that produced fragmented or nonsensical output, GPT-2 could generate coherent, contextually appropriate text over long passages.</li><li><strong>Semantic Understanding</strong>: While still imperfect, GPT-2 demonstrated an ability to capture deeper relationships between words and concepts, allowing it to infer meanings and generate plausible answers to open-ended questions.</li></ul><p>What makes these capabilities emergent is that they were not directly programmed into the model or obvious outcomes of its design. Instead, they arose as by-products of scaling up the model and training it on diverse, interconnected datasets.</p><h4>Scaling Laws</h4><p>The concept of emergence led researchers to ask: <strong>Why does scale lead to these transformative behaviors?</strong> And, more importantly, <strong>how much further could scale take us?</strong></p><p>In 2020, OpenAI published the seminal paper <a href="https://arxiv.org/abs/2001.08361"><em>Scaling Laws for Neural Language Models</em></a> by Kaplan et al., which systematically studied how the performance of language models improved as three key factors were scaled:</p><ul><li><strong>Model Size</strong>: The number of parameters in the network.</li><li><strong>Dataset Size</strong>: The volume of training data.</li><li><strong>Compute Power</strong>: The computational resources used for training.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9uuxIsi2C7c9Zl6z" /></figure><p>The findings were groundbreaking:</p><ul><li><strong>Performance Follows Power Laws</strong>: The improvements in model performance were found to follow predictable power-law trends as model size, dataset size, and compute power increased. These trends provided a roadmap for building better models: scale up, and performance will improve.</li><li><strong>No Plateau in Sight</strong>: The research indicated that larger models trained on larger datasets continued to deliver gains, defying the traditional ML concerns of overfitting. Instead, larger</li><li><strong>Diminishing Returns but Justifiable Costs</strong>: While returns diminished at extreme scales, the gains remained meaningful, justifying investments in ever-larger architectures.</li></ul><p>The <strong>Scaling Laws</strong> paper established a theoretical framework for the rapid advancements that followed. It showed that scaling wasn’t just a brute-force approach — it was a principle-driven strategy.</p><p>The implications of these findings were extremely important. They validated the notion that as models grow larger and datasets more diverse, new capabilities naturally emerge.</p><p>For instance:</p><ul><li>GPT-2’s zero-shot learning capabilities became more pronounced as its scale increased.</li><li>Larger models developed richer latent spaces, where representations of words and concepts encoded nuanced, multidimensional relationships.</li><li>The model’s ability to generate coherent, contextually appropriate text over long passages improved as it scaled.</li></ul><p>So, how far would these capabilities go?</p><h4>GPT-3</h4><p>Released in 2020, <a href="https://arxiv.org/abs/2005.14165"><strong>GPT-3 (Generative Pre-trained Transformer 3)</strong></a> was OpenAI’s answer to the lessons of scaling and emergence. With <strong>175 billion parameters</strong>, and larger training data, GPT-3 far exceeded its predecessor GPT-2 (1.5 billion parameters) and started a new era in natural language processing.</p><p>Scaling GPT-3 revealed better emergent properties:</p><ul><li><strong>Few-Shot and Zero-Shot Learning</strong>: GPT-3 could adapt to tasks with minimal instruction. By providing a few examples (few-shot) or even just a well-crafted natural language prompt (zero-shot), GPT-3 demonstrated surprising proficiency in tasks like translation, summarization, and creative writing. This flexibility minimized the need for task-specific fine-tuning.</li><li><strong>Reasoning and Problem Solving</strong>: Tasks that traditionally required specialized models including coding mathematical reasoning became accessible to GPT-3 through well-designed prompts. This ability to generalize across domains was a testament to the power of its scaled latent space.</li><li><strong>Longer Contextual Understanding</strong>: With an increased capacity to handle larger contexts, GPT-3 excelled at tasks requiring reasoning over extended passages. It could write coherent multi-paragraph essays, hold extended conversations, and even perform complex reasoning tasks.</li><li><strong>Better Conceptual Representations</strong>: GPT-3’s embeddings became richer and more nuanced, allowing it to represent abstract concepts, multi-word phrases, and task-specific relationships in a multidimensional latent space. This was evident in its ability to generate plausible responses to open-ended philosophical questions, technical problem-solving prompts, and creative storylines.</li></ul><h4>Prompt Engineering</h4><p>Prompt engineering is more than just crafting clever sentences. It is a semiscientific, or even scientific approach to manipulating the probabilistic underpinnings of large language models (LLMs) to achieve desired outcomes. It is more than just “please explain step-by-step”.</p><p>At its core, prompt engineering harnesses the <strong>statistical and structural representations encoded in embeddings and latent space</strong>, enabling LLMs to respond with remarkable precision across a diverse range of tasks.</p><p>To understand why prompt engineering is effective, we must look at the mechanisms underlying modern LLMs. These models operate on three core principles:</p><p>During training, LLMs process vast amounts of text to capture statistical relationships between tokens (words, subwords, or characters). This allows them to predict the next token in a sequence with high accuracy, forming the basis of their generative capabilities.</p><p>Every token, phrase, or concept is represented as a dense vector in a high-dimensional latent space. This latent space is structured such that semantically similar words (e.g., “king” and “queen”) are positioned close to each other, while dissimilar words (e.g., “king” and “fish”) are farther apart. These embeddings encode both syntactic and semantic information. Let’s remember: <strong>tasks</strong> themselves are also encoded into the latent spce.</p><p>Also, the transformer architecture dynamically adjusts token embeddings based on their surrounding context. For example, the word “plane” as a surface and plane as a vehicle will occupy different regions of latent space due to their distinct contexts.</p><p>When you design a prompt, you effectively guide the traversal of the model through latent space. By framing a question or task in a specific way, you nudge the model toward regions of latent space where the embeddings are likely to yield the desired response.</p><p>At the heart of prompt engineering lies the <strong>conditional probabilities</strong>, where the model predicts the next token given a sequence of previous tokens. A well-engineered prompt maximizes the probability that the desired sequence will align with the model’s learned patterns.</p><p>For example, the query <em>“Translate the following sentence into French: Words, my colonel, do not reach certain meaning.”</em> increases the probability of generating “Les mots, mon colonel, n’atteignent pas certains sens.” because the phrase “Translate the following sentence into French” strongly activates regions of latent space associated with translation tasks.</p><p>Similarly, if the data and model necessarily large and complex, the same case applies for mathematical or coding tasks.</p><p>When designing prompts, words act as <strong>notations</strong>, symbols that guide the model’s traversal through latent space, activating regions where learned relationships and patterns reside. LLMs do not “learn words”; they learn the <strong>world</strong> encoded in the relationships between words and contexts. The text they process is a proxy for the underlying structure of reality, enabling models to approximate the patterns, concepts, and associations within the data.</p><p>Now, let’s look at some of the prompt engineering techniques, and gain intuition about <strong>why</strong> and <strong>how</strong> do they work.</p><p>Some Popular Prompt Engineering Techniques and Their Probabilistic Behaviour</p><p>The evolution of prompt engineering has seen the development of systematic approaches that leverage the model’s embeddings and latent space more effectively. Here are some key techniques:</p><p><strong>Zero-Shot Prompting</strong></p><p>Zero-shot prompting involves directly instructing the model to perform a task using natural language without providing examples. This relies on the model’s pre-trained knowledge and its ability to generalize from its latent space representation.</p><p>Example:</p><p>&gt; Write a function that obtains n random samples from a Qdrant vector database</p><p>In zero-shot prompting, the prompt directly narrows the vast latent space to regions associated with the task, relying on patterns encoded during pretraining. The model aligns its probabilities with general-purpose task knowledge.</p><p>The prompt serves as an instruction without examples. Words in the prompt (e.g., “write code” or “summarize”) act as high-level markers that activate regions of latent space where similar tasks are encoded. Probabilities are adjusted based on data patterns, increasing the likelihood of generating a correct result.</p><p><strong>Few-Shot/N-Shot Prompting</strong></p><p>Few-shot prompting provides a small number of input-output examples to prime the model. This reduces ambiguity and improves task performance by anchoring the model in the desired latent region.</p><p>Example:</p><p>Extract the company name, date, and total revenue from the following financial summaries:<br>Summary: The quarterly earnings report for XYZ Corp., dated August 15, 2023, revealed a total revenue of $45 million for Q2. <br>Company Name: XYZ Corp. <br>Date: August 15, 2023 <br>Total Revenue: $45 million</p><p>Summary: On September 10, 2022, Alpha Industries announced its yearly revenue of $3.5 billion in its annual financial report. <br>Company Name: Alpha Industries <br>Date: September 10, 2022 <br>Total Revenue: $3.5 billion</p><p>Summary: BlueTech Inc. published its financial statement for Q1 on May 3, 2023, showing a revenue of $120 million.</p><p>Model Output:</p><p>Company Name: BlueTech Inc. <br>Date: May 3, 2023 <br>Total Revenue: $120 million</p><p>Now, suppose the task “Extract the company name, date, and total revenue” is less likely to be encoded in the latent space of the LLM. However, by providing a template or a pattern, we guide the model toward creating a localized pathway in the latent space that aligns with the task. This template acts as a guideline, allowing the model to infer relationships between the input text and the desired output structure.</p><p>By repeating the pattern across examples, the model builds a probabilistic structure where the likelihood of following the specified format increases significantly. Even if the task is not pre-encoded, the prompt conditions the model to behave as though it understands the task intrinsically.</p><p>Furthermore, the latent space traversal is adjusted dynamically:</p><ul><li>The initial input text activates embeddings related to finance and temporal information.</li><li>The template acts as a guidepost, filtering out irrelevant embeddings and concentrating the model’s focus on specific aspects of the input.</li><li>As the output tokens are predicted, the model continually refines its context, staying aligned with the established template.</li></ul><p>This demonstrates the flexibility of few-shot prompting to “teach” the model tasks that are not explicitly encoded, leveraging its generalization ability and probabilistic structure to perform domain-specific operations.</p><p><strong>Chain of Thought Prompting</strong></p><p>Chain-of-thought (CoT) prompting encourages a language model to generate intermediate reasoning steps before arriving at a final answer. This technique leverages the model’s ability to simulate structured thought processes, improving performance on tasks requiring logical reasoning, multi-step computation, or contextual dependencies.</p><p>Example:</p><p>Task: Explain the cause and process of photosynthesis in plants. <br>Explain photosynthesis by breaking it into steps: <br>1. Identify the primary purpose of photosynthesis. <br>2. Describe the inputs required for photosynthesis. <br>3. Explain the process that occurs during photosynthesis. <br>4. State the outputs of photosynthesis.</p><p>Model Output:</p><p>1. The primary purpose of photosynthesis is to convert light energy into chemical energy for the plant&#39;s use. <br>2. The inputs required are sunlight, carbon dioxide, and water. <br>3. During photosynthesis, chlorophyll in the plant&#39;s cells absorbs sunlight, and the plant uses this energy to convert carbon dioxide and water into glucose and oxygen. <br>4. The outputs are glucose, which serves as energy for the plant, and oxygen, which is released into the atmosphere. <br>Answer: Photosynthesis is the process by which plants convert light energy into chemical energy, using sunlight, carbon dioxide, and water to produce glucose and oxygen.</p><p>CoT prompting modifies the conditional probability distribution by embedding reasoning steps within the sequence. Each step acts as contextual input for the subsequent prediction. The model is guided through a structured traversal of latent space, ensuring that intermediate outputs logically align with the final answer.</p><p>The phrase “break it into steps” signals the model to activate embeddings associated with reasoning and problem-solving rather than directly generating an answer. This shifts the latent space traversal toward regions representing logical relationships and intermediate computations.</p><p><em>In each step, the model auto-converges to the result.</em></p><p><strong>Few-Shot Chain-of-Thought Prompting</strong></p><p>Few-shot CoT combines the benefits of few-shot examples and CoT reasoning. By including worked-out examples with intermediate reasoning steps, this technique provides a robust template for complex tasks.</p><p>Example:</p><p>Example 1: <br>Q: If a train travels 60 miles per hour for 2 hours, how far did it travel? <br>A: <br>Step 1: Identify the speed: 60 miles per hour. <br>Step 2: Identify the time: 2 hours. <br>Step 3: Multiply speed by time: 60 × 2 = 120 miles. <br>Answer: 120 miles.</p><p>Example 2: <br>Q: A cyclist rides 20 miles per hour for 4 hours. How far did they ride? <br>A: <br>Step 1: Identify the speed: 20 miles per hour. <br>Step 2: Identify the time: 4 hours. <br>Step 3: Multiply speed by time: 20 × 4 = 80 miles. <br>Answer: 80 miles.</p><p>Q: A car drives 50 miles per hour for 3 hours. How far did it travel? <br>A:</p><p>Model Output:</p><p>Step 1: Identify the speed: 50 miles per hour. <br>Step 2: Identify the time: 3 hours. <br>Step 3: Multiply speed by time: 50 × 3 = 150 miles. <br>Answer: 150 miles.</p><p>Reframing Prompts</p><p>Reframing involves rewording or adding context to a prompt to make the task more aligned with patterns the model recognizes. This technique works well when initial outputs are suboptimal due to ambiguity or the model misinterpreting the task.</p><p>Example:</p><p>Instead of:</p><p>Summarize this article in one sentence.</p><p>Reframe as:</p><p>Imagine you are summarizing this article for a 5th grader. Write one simple sentence summarizing the article.</p><p>Reframing activates latent space embeddings related to specific contexts (e.g., simplifying for a younger audience). Probabilistically, the additional instruction narrows the output distribution to align with the desired tone or complexity.</p><p><strong>Prompt Cascading</strong></p><p>Prompt cascading involves chaining multiple prompts together to handle complex, multi-stage tasks. Instead of doing it in one prompt like in CoT, output of a stage is used as input for the subsequent stage, enabling iterative refinement.</p><p>Example:</p><p>1. Step 1: Summarize the article in three bullet points: <br>- Output: <br>- 1. Discusses climate change impacts. <br>- 2. Highlights potential solutions. <br>- 3. Mentions government policies. <br>2. Step 2: Expand on the second bullet point with examples.</p><p>Each step dynamically updates the latent context, progressively narrowing the model’s focus. Probabilistically, cascading breaks a complex task into simpler sub-tasks, reducing the risk of logical errors or omissions.</p><p>This is by no means a comprehensive list, and it omits one of the most important methods that caused a paradigm shift in utilizing LLMs: <strong>Retrieval Augmented Generation (RAG).</strong> I intend to cover it in a separate post.</p><h3>After Scaling Laws</h3><p>The advancements following <strong>GPT-3</strong> represented not just incremental improvements but significant strides toward aligning large language models with human needs and preferences. Central to this evolution was the introduction of <strong>InstructGPT</strong>, a breakthrough that shifted the focus from raw generative capability to <strong>human alignment and usability</strong>.</p><h4>InstructGPT</h4><p>Released in early 2022, <a href="https://arxiv.org/abs/2203.02155"><strong>InstructGPT</strong></a> by OpenAI addressed one of GPT-3’s most prominent challenges: its tendency to produce verbose, irrelevant, or unhelpful responses. While GPT-3 showcased remarkable generative capabilities, it lacked the nuance to consistently align its outputs with user intentions. It was the beginning of the <strong>Reinforcement Learning from Human Feedback (RLHF)</strong>, a methodology that revolutionized how LLMs could be trained to prioritize meaningful, contextually relevant responses.</p><p>The mechanism is basically as follows:</p><ul><li><strong>Human Feedback</strong>: A team of human labelers ranked multiple outputs generated by the model for a variety of prompts. These rankings provided a basis for training a reward model.</li><li><strong>Fine-Tuning via RLHF</strong>: The reward model guided the optimization process, aligning the LLM’s outputs with human preferences.</li><li><strong>Instruction Tuning</strong>: Datasets containing prompts and their desired outputs were curated to train the model to better understand and respond to user instructions.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HtSx31ZqGw_re8SG" /><figcaption>By <a href="https://commons.wikimedia.org/wiki/User:PopoDameron">PopoDameron</a> — Own work, <a href="https://creativecommons.org/licenses/by-sa/4.0">CC BY-SA 4.0</a>, <a href="https://commons.wikimedia.org/w/index.php?curid=146365451">Link</a></figcaption></figure><p>This process resulted in a model capable of aligning its behavior more closely with <strong>human intent</strong>. Notably, <strong>human preferences became encoded in the model’s latent space</strong>, subtly guiding its responses toward greater relevance, safety, and usability. The model not only reduced harmful or biased outputs but also became more adept at interpreting nuanced instructions.</p><p>InstructGPT laid the groundwork for a significant leap forward in user-centric design, setting the stage for <strong>GPT-3.5</strong> and <strong>ChatGPT</strong>.</p><p>Meanwhile, Google advanced the field with models like <strong>Flan-T5</strong> and <strong>LaMDA</strong>, demonstrating how instruction-tuned architectures could achieve both alignment and versatility:</p><p><a href="https://arxiv.org/abs/2201.08239"><strong>LaMDA (Language Model for Dialogue Applications)</strong></a> (2021): Google introduced this model to excel in open-domain dialogue, emphasizing fluid, conversational AI that could handle nuanced, context-aware interactions.</p><p><a href="https://arxiv.org/abs/2210.11416"><strong>Flan-T5 (Foundation Language and Arithmetic Transformer)</strong></a> (2022): Google’s Flan-T5 model was designed to excel in arithmetic and language tasks, showcasing its ability to handle complex reasoning and mathematical operations.</p><h4>GPT-3.5</h4><p>Released later by OpenAI again in 2022, <strong>GPT-3.5</strong> built upon the advancements of InstructGPT, refining instruction-following capabilities and expanding the model’s versatility. It incorporated larger datasets, iterative RLHF improvements, and advanced fine-tuning techniques.</p><p>As expected from scaling laws, this iteration demonstrated:</p><p><strong>Improved Conversational Fluency:</strong> Responses became more natural and engaging, with noticeable improvements in coherence and tone.</p><p><strong>Generalization to Unseen Tasks:</strong> GPT-3.5 extended the zero-shot and few-shot learning capabilities of GPT-3, showcasing remarkable adaptability to a wide array of user prompts.</p><p><strong>Enhanced Reasoning:</strong> Multi-step reasoning tasks and problem-solving saw incremental gains, although limitations in logical rigor and factual accuracy persisted.</p><p>Also, another novel method, <strong>chain-of-thought (CoT) decoding</strong> enables intermediate reasoning steps. This technique proved invaluable in reasoning-intensive tasks like solving mathematical problems or generating logical arguments.</p><p>However, GPT-3.5 still faced challenges:</p><ul><li><strong>Context Retention in Multi-Turn Dialogues:</strong> Extended conversations sometimes led to “context drift,” where earlier parts of the dialogue were misinterpreted or forgotten.</li><li><strong>Dynamic Intent Adaptation:</strong> The model struggled to seamlessly adjust to evolving user needs within a single session.</li></ul><p>Other notable models developed during this time include:</p><ul><li><a href="https://arxiv.org/abs/2204.02311"><strong>PaLM (Pathways Language Model)</strong></a> (Google, 2022): With its 540 billion parameters, PaLM set a new benchmark in scaling, demonstrating advanced reasoning, multi-modal capabilities, and instruction-following. Its innovations in <strong>few-shot prompting</strong> allowed it to achieve state-of-the-art performance across diverse tasks, from translation to creative writing. PaLM’s development highlighted Google’s emphasis on combining scale with usability, showcasing how larger models could offer not just broader genera…</li><li><a href="https://arxiv.org/abs/2205.01068"><strong>OPT (Open Pre-trained Transformer)</strong></a> (Meta, 2022): Meta’s OPT marked a significant step</li><li><a href="https://www.anthropic.com/claude"><strong>Claude</strong></a> (Anthropic, 2023): Building directly on this wave of safety-centric innovation, <strong>Claude</strong> from Anthropic represented a deliberate shift toward aligning AI behavior with human values. Anthropic focused on embedding <strong>ethical guidelines and interpretability</strong> into its training process, emphasizing transparency and user safety. Claude excelled in conversational AI, offering responses that were not only accurate but also designed to avoid harm or controversy. This approach resonated with industri…</li></ul><p>These limitations and insights collectively paved the way for the next step: <strong>ChatGPT</strong>, OpenAI’s first major release explicitly designed for dialogue, and other strong conversational models.</p><h4>ChatGPT</h4><p><a href="https://openai.com/index/chatgpt/"><strong>ChatGPT</strong></a>, based on GPT-3.5, was OpenAI’s first major release explicitly designed for dialogue-based interactions. While GPT-3 and InstructGPT could handle prompts effectively, ChatGPT was optimized for <strong>multi-turn conversations</strong>, making it suitable for a broad range of interactive applications.</p><ul><li><strong>Conversational Context Management:</strong> <br>ChatGPT introduced advanced techniques for retaining and referencing context across multiple dialogue turns. This was achieved through: <br>- Dynamically updating internal conversation embeddings. <br>- Fine-tuning latent representations for dialogue coherence and continuity.</li><li><strong>RLHF Refinements:</strong> <br>Building on the RLHF methodology, ChatGPT introduced: <br>- Evaluations not just for individual responses but for entire conversations. <br>- A reward model prioritizing conversational tone, relevance, and consistency across exchanges.</li><li><strong>User-Focused Optimization:</strong> <br>ChatGPT’s responses felt more intuitive and conversational, making it accessible to non-technical users while retaining versatility for technical applications.</li></ul><p>ChatGPT quickly became a versatile tool across domains, and continuing to be used everyday by millions of users. The true breakthrough of ChatGPT was not just technical, it was <strong>experiential</strong>. It marked the transition of LLMs from experimental tools to <strong>widely adopted, user-centric products</strong>. By addressing usability, safety, and conversational adaptability, ChatGPT set a new standard for AI-human interaction.</p><p>Despite its transformative capabilities, ChatGPT faced notable challenges:</p><ul><li><strong>Reasoning Limitations:</strong> While improved, multi-step reasoning and logical problem-solving occasionally faltered.</li><li><strong>Factual Inaccuracies:</strong> The model sometimes generated confident but incorrect answers, a challenge tied to its reliance on probabilistic patterns from training data.</li><li><strong>Contextual Drift:</strong> Long dialogues could still lead to subtle inconsistencies or misunderstandings.</li></ul><p>These limitations mirrored those in models like LaMDA, PaLM, and Claude, which also wrestled with context retention and factual grounding. The iterative improvement of ChatGPT influenced the development of <strong>GPT-4</strong>, Anthropic’s <strong>Claude</strong>, Meta’s <strong>LLaMA 2</strong>, and Google’s <strong>Gemini</strong>, which aimed to address these challenges while introducing multimodal and task-specific capabilities.</p><p>Anthropic’s <strong>Claude series</strong>, starting in 2023, prioritized safety and ethical alignment. These models integrated human-centric design principles directly into their architecture, addressing</p><ul><li><strong>Claude 1</strong>: Marked the beginning of Anthropic’s journey into conversational AI, focusing on alignment with human preferences.</li><li><strong>Claude 2</strong>: Improved coherence, contextual understanding, and adaptability in dialogues, bridging the gap between ethical considerations and competitive performance.</li><li><strong>Claude 3 (2024)</strong>: Expanded on its predecessors with better multi-domain adaptability and enhanced reasoning capabilities, making it a strong competitor in long-term conversational tasks.</li></ul><p>Claude’s focus on alignment positioned it as a trusted choice for industries requiring safety-critical applications, from education to healthcare.</p><p>OpenAI’s <a href="https://arxiv.org/abs/2303.08774"><strong>GPT-4</strong></a>, released in 2023, built on the success of ChatGPT and GPT-3.5 by introducing major advancements in scale and functionality.</p><ul><li><strong>Enhanced Context Length</strong>: GPT-4 significantly extended the context window, enabling reasoning over larger inputs, such as entire documents or long conversations, without losing coherence.</li><li><strong>Multimodal Capabilities</strong>: For the first time, GPT-4 supported both text and image inputs, unlocking applications like document analysis, image captioning, and visual question answering.</li><li><strong>Improved Reasoning and Alignment</strong>: GPT-4’s enriched latent space and refined training methodology allowed for better multi-step reasoning and alignment with user intentions, addressing many of the limitations observed in GPT-3.5.</li></ul><h3>Accesibility of LLMs</h3><h4>LLaMA: Democratizing Access to High-Performance NLP</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/0*6KTlHY-U21x1ZQZS" /></figure><p>In 2023, Meta AI introduced <a href="https://arxiv.org/abs/2302.13971"><strong>LLaMA (Large Language Model Meta AI)</strong></a>, a groundbreaking initiative that provided open access to cutting-edge NLP models. Unlike proprietary models such as OpenAI’s GPT series, LLaMA was designed to empower researchers and practitioners through transparency, efficiency, and accessibility. Its open-access ethos spurred a wave of innovation, including tools and frameworks that enhanced its usability, such as <strong>Ollama</strong> and <strong>llama.cpp</strong>.</p><p>LLaMA was released in multiple sizes (7B, 13B, 30B, 65B), catering to diverse computational needs. Smaller models provided competitive performance, while larger variants excelled in complex reasoning tasks. Its architecture emphasized computational efficiency, achieving state-of-the-art results with fewer parameters compared to proprietary counterparts.</p><p>LLaMA was trained on high-quality, diverse datasets, ensuring strong generalization capabilities. This focus on data quality minimized biases and enhanced robustness across tasks.</p><p><a href="https://crfm.stanford.edu/2023/03/13/alpaca.html"><strong>Alpaca</strong></a> (2023, Stanford University) demonstrated the potential of small-scale fine-tuning with LLaMA. By generating synthetic examples and fine-tuning the original LLaMA, Alpaca was optimized for instruction-following tasks. This effort highlighted how accessible techniques could produce models comparable to larger, proprietary systems, emphasizing the versatility of LLaMA for targeted applications.</p><p><a href="https://lmsys.org/blog/2023-03-30-vicuna/"><strong>Vicuna</strong></a> (2023, by LMSYS Group) advanced conversational AI by building on LLaMA and incorporating <strong>Reinforcement Learning from Human Feedback (RLHF)</strong>. Vicuna’s emphasis on dialogue performance enabled it to rival commercial models like ChatGPT, showcasing the power of open-access models when enhanced with user-aligned feedback mechanisms.</p><p><a href="https://arxiv.org/abs/2307.09288"><strong>LLaMA 2</strong></a> (2023, Meta) was Meta’s major upgrade to the original LLaMA. It introduced instruction tuning, improving usability and making the model more aligned with user expectations out of the box. LLaMA 2 maintained Meta’s open-access philosophy, solidifying its role as a foundational model for research and development in NLP.</p><p><a href="https://arxiv.org/abs/2407.21783"><strong>LLaMA 3</strong></a> (2024, Meta) further pushed the boundaries of the LLaMA series, emphasizing <strong>multimodal capabilities</strong> and <strong>fine-grained instruction-following</strong>. LLaMA 3 integrated advanced reasoning and improved context handling, making it competitive with proprietary systems in both text and multimodal tasks. It also introduced <strong>modular architecture</strong>, allowing for more efficient scaling and adaptability across diverse domains while continuing the commitment to open-access development.</p><p>LLaMA’s release also catalyzed a surge of derivative models and tools, including:</p><ul><li><a href="https://ollama.ai/"><strong>Ollama</strong></a>: A tool designed to simplify the deployment and interaction with LLaMA models, focusing on usability for a wide range of users.</li><li><a href="https://github.com/ggerganov/llama.cpp"><strong>llama.cpp</strong></a>: An efficient framework enabling LLaMA-based models to run on consumer-grade hardware, including laptops and smartphones. This drastically reduced hardware requirements, making high-performance NLP more accessible.</li></ul><p>LLaMA’s release redefined the NLP landscape, proving that innovation thrives in open-access paradigms. By prioritizing efficiency, adaptability, and community-driven development, LLaMA and its ecosystem, inspired a new wave of open-source NLP tools. This democratization has expanded the boundaries of what’s possible in language understanding and generation, fostering collaboration across academia and industry.</p><p>We now have open source large language models. But there is an elephant in the room: <strong>increasing the scale is not free</strong>.</p><h4>Mixture of Experts (MoE) Models</h4><p>As the field of large language models advanced, the demand for higher performance collided with the limits of scalability. Dense models like ChatGPT, while powerful, required all parameters to be active for every task, leading to exponential computational costs as the model size grew. The solution? <strong>Mixture of Experts (MoE)</strong> models — an innovative approach to achieving efficiency and specialization in large-scale neural networks.</p><p>Mixture of Experts models use <strong>sparse activation</strong> to dynamically allocate computational resources. Instead of engaging the entire model’s parameters for every input, only a subset of <strong>expert modules</strong> is activated based on the task or input. These experts are highly specialized sub-networks within the broader model, and a <strong>routing mechanism</strong> determines which experts are most relevant for the current task.</p><p>Developed by Google, the <a href="https://arxiv.org/abs/2006.16668"><strong>GShard</strong></a> framework was introduced in June 2020. It facilitated the scaling of multilingual neural machine translation models by incorporating sparsely-gated MoE layers, effectively managing models with over 600 billion parameters.</p><p>Building upon this foundation, the <a href="https://arxiv.org/abs/2101.03961"><strong>Switch Transformer</strong></a> was presented in January 2021. It simplified the MoE routing mechanism by assigning each input token to a single expert, enhancing training stability and computational efficiency. This innovation enabled the creation of models with up to a trillion parameters, demonstrating substantial improvements in pre-training speed and performance across various tasks.</p><p>In December 2023, Mistral AI released <a href="https://arxiv.org/abs/2401.04088"><strong>Mixtral 8x7B</strong></a>, an open-source and LLaMa based sparse MoE model comprising eight experts, each with 7 billion parameters, totaling 56 billion parameters. However, due to its sparse activation, only a fraction of these parameters are utilized during inference, resulting in faster processing times and reduced computational requirements. Notably, Mixtral outperformed models like Llama 2 70B and GPT-3.5 on several benchmarks, highlighting the efficacy of MoE architectures…</p><p>Despite their advantages, MoE architectures introduce new complexities:</p><ul><li><strong>Routing Inefficiencies:</strong> Determining the optimal routing strategy remains computationally intensive and can lead to imbalanced expert usage.</li><li><strong>Overhead in Sparse Training:</strong> While inference is efficient, training MoE models requires sophisticated infrastructure and optimization techniques.</li><li><strong>Complex Debugging:</strong> The modular nature of MoE models complicates debugging and performance evaluation.</li></ul><p>MoE models give us a critical insight in the evolution of LLMs: <strong>scaling alone is not enough</strong>. There is a cycle between <strong>scaling and specialization</strong>.</p><h4>LoRA: Unlocking Parameter Efficiency</h4><p><a href="https://arxiv.org/abs/2106.09685"><strong>Low-Rank Adaptation (LoRA)</strong></a> is a breakthrough in fine-tuning large language models, designed to significantly reduce the computational and memory overhead required for adapting these models to new tasks. Unlike traditional fine-tuning, which updates all model parameters, LoRA focuses on modifying a small subset of parameters, maintaining the rest of the pre-trained weights in a frozen state.</p><p>LoRA introduces additional low-rank matrices into the model, representing the weight updates in a compact and efficient manner. These matrices are added to the frozen pre-trained weights during inference. The key idea is to leverage the observation that <strong>many updates in neural networks lie in a low-dimensional subspace</strong>.</p><p>This allows LoRA to significantly reduce the number of trainable parameters. And by reducing the number of trainable parameters, LoRA drastically lowers the computational and memory requirements for fine-tuning.</p><p>LoRA has gained widespread adoption for fine-tuning models like <strong>LLaMA</strong> and other open-access models. In real-world deployments, LoRA has enabled researchers to adapt state-of-the-art models for tasks such as sentiment analysis, domain-specific text generation, and machine translation, often on consumer-grade hardware.</p><h4>Quantization: Precision Reduction</h4><p>In standard neural networks, weights and activations are typically stored in 32-bit floating-point precision (FP32). <strong>Quantization</strong> reduces this precision to lower-bit formats (like 8-bit, 4-bit, or even 1-bit). This reduction leads to decreased memory usage and faster computation, facilitating the deployment of large language models on hardware with limited resources.</p><p>Quantization has revolutionized how large language models are deployed, with tools like <strong>llama.cpp</strong> enabling efficient use of <strong>quantized models</strong> on consumer hardware. Hugging Face now supports <strong>.gguf models</strong>, a quantized format tailored for LLaMA and other open-source models. This format allows users to run high-performance models on laptops, desktops, and even smartphones, democratizing access to cutting-edge NLP capabilities.</p><p>Quantization has been pivotal for deploying models like <strong>LLaMA 2</strong> and <strong>Mistral</strong> in production settings. These models, often trained with billions of parameters, achieve competitive performance in tasks like summarization and question answering while running efficiently on edge devices. By combining quantization with frameworks like LoRA, researchers and developers can now fine-tune and deploy state-of-the-art models with unprecedented efficiency.</p><p>Recent advancements have pushed the boundaries of quantization. Research initiatives, notably Microsoft, have introduced 1-bit Large Language Models (LLMs) like <a href="https://arxiv.org/abs/2402.17764"><strong>BitNet b1.58</strong></a>, where each parameter is ternary (-1, 0, 1). These models match the performance of full-precision counterparts while offering significant reductions in latency, memory footprint, and energy consumption.</p><p>And to facilitate the deployment of 1-bit LLMs on local devices, Microsoft released <a href="https://github.com/microsoft/BitNet.cpp"><strong>BitNet.cpp</strong></a>, an inference framework that enables efficient execution of 1-bit models on standard CPUs without the need for specialized hardware. This development democratizes access to advanced language models, making them more accessible for various applications.</p><p>Quantization surely reduces the precision of weights, but critical latent space properties mostly remain intact. Semantically similar tokens still remain close.</p><h4>Scaling Test-Time Compute</h4><p>The research from the paper <a href="https://arxiv.org/abs/2408.03314"><em>Scaling LLM Test-Time Compute Optimally can be More Effective than Scaling Model Parameters</em></a> by Google (2024) introduces a novel perspective on the trade-off between pretraining and test-time computation. Instead of solely expanding model parameters and pretraining, the study explores methods to maximize the efficiency of inference-time computation.</p><p><strong>Compute-Optimal Test-Time Scaling</strong> approach adjusts the allocation of compute resources during inference based on the difficulty of the prompt. It integrates strategies like:</p><ul><li><strong>Sequential Revisions</strong>: Models iteratively refine their outputs, learning from their initial responses.</li><li><strong>Verifier-Guided Search</strong>: Uses process reward models (PRMs) to evaluate intermediate and final steps, allowing tree-search or beam-search to optimize the solution space.</li></ul><p>The findings highlight that test-time compute can often substitute for large-scale pretraining. For “easy” and “medium” tasks, test-time compute with a smaller model can outperform a 14x larger pretrained model. However, pretraining larger models remains essential for “hard” tasks.</p><p>This research shows the potential for smarter resource use at inference time, offering a compelling alternative to relentless scaling of model parameters. It highlights a paradigm shift in how we approach model training and deployment, paving the way for more sustainable and efficient AI systems.</p><p>Also, <a href="https://huggingface.co/spaces/HuggingFaceH4/blogpost-scaling-test-time-compute">a recent blog post by Hugging Face</a> examines search-based methods as a means to optimize test-time compute. These techniques involve generating multiple candidate responses during inference and selecting the most appropriate one, thereby improving the model’s output quality. The blog post mentions three specific strategies:</p><ul><li><strong>Best-of-N Sampling</strong>: This method generates ’N’ responses for a given input and evaluates each to select the best outcome. By increasing ’N’, the likelihood of producing a high-quality response improves, albeit with a corresponding rise in computational cost.</li><li><strong>Beam Search</strong>: Beam search maintains multiple hypotheses at each step of generation, expanding the most promising ones. This approach balances exploration and exploitation, aiming to find the most likely sequence of words for a given input.</li><li><strong>Diverse Verifier Tree Search (DVTS)</strong>: An extension of traditional tree search methods, DVTS introduces diversity in the search process by incorporating verifier models that assess the validity of different branches. This technique enhances the model’s ability to explore varied solutions, leading to improved performance, especially in complex tasks.</li></ul><p>These methods leverage the structure of the latent space by exploring multiple trajectories for embeddings. This ensures the model can refine or discard less plausible outputs based on the task’s context.</p><p>When solving a reasoning-intensive task, Diverse Verifier Tree Search (DVTS) ensures embeddings for potential solutions are optimized for diversity. For example, in a question-answering task, embeddings for “solar power efficiency” are explored alongside “wind energy efficiency”, leading to a richer set of candidate answers.</p><p>To facilitate the application of search-based methods, Hugging Face has introduced a repository containing scripts and recipes for implementing different search algorithms at test-time.</p><p>Empirical studies have demonstrated that optimizing test-time compute can enable smaller models to outperform larger counterparts. For instance, a 3-billion parameter LLaMa model, when equipped with compute-optimal scaling strategies, surpassed the performance of a 70-billion parameter model on complex mathematical tasks. This finding underscores the efficacy of test-time compute optimization in achieving superior results without escalating model size.</p><h3>Reasoning Models</h3><h4>GPT-o1</h4><p>Released in 2024, <a href="https://openai.com/o1/"><strong>GPT-o1</strong></a> marked a transformative leap in how large language models approached logical reasoning tasks. While prior models like GPT-3.5 and GPT-4 excelled at generating fluent and coherent outputs, they often struggled with maintaining consistency and accuracy over multi-step reasoning processes. GPT-o1 addressed these limitations by incorporating a novel framework explicitly designed for <strong>step-by-step logical deductions</strong>.</p><p>GPT-o1 was trained on datasets curated specifically for reasoning tasks, such as mathematical problem-solving, programming, and scientific deduction. The training data emphasized logical progression, ensuring that the model could generate intermediate steps for complex problems.</p><p>Building on the success of Chain-of-Thought (CoT) prompting, GPT-o1 integrated <strong>iterative reasoning loops</strong> into its architecture. This allowed the model to self-correct by revisiting earlier steps in its reasoning, minimizing errors in multi-step tasks.</p><p>GPT-o1 also introduced dynamic memory modules, enabling the model to update its understanding of the context as it progressed through a problem. This feature was crucial for handling tasks requiring coherence over long sequences, such as scientific proofs or extended code debugging.</p><p>GPT-o1 set a new standard for reasoning-focused LLMs. By combining logical rigor with dynamic adaptability, it opened new avenues for AI applications in STEM fields and industries requiring high precision.</p><p>However, its iterative reasoning process demanded higher computational resources, which highlighted the ongoing trade-offs between capability and efficiency.</p><h4>GPT-o3</h4><p>Shortly after, <strong>GPT-o3</strong> built upon the successes of GPT-o1, pushing the boundaries of reasoning capabilities through <strong>advanced scaling</strong> and <strong>multi-domain integration</strong>. GPT-o3 was designed not just for reasoning but for <strong>reasoning at scale</strong>, enabling it to tackle deeply complex problems that required interdisciplinary knowledge and long-term coherence.</p><p>With a significantly larger parameter count and a training dataset spanning diverse scientific, mathematical, and ethical domains, GPT-o3 achieved unparalleled generalization. Its reasoning capabilities extended to intricate multi-modal tasks, combining text, images, and structured data.</p><p>GPT-o3 leveraged <strong>inference-time scaling techniques</strong>, such as <strong>adaptive compute allocation</strong> and <strong>context prioritization</strong>, to optimize computational efficiency during problem-solving. These innovations minimized the latency associated with its reasoning processes, making it practical for real-world deployment.</p><p>GPT-o3 achieved a landmark victory by winning the <a href="https://arcprize.org/blog/oai-o3-pub-breakthrough"><strong>ARC Prize</strong></a> (Advanced Reasoning Challenge), awarded for its exceptional performance in solving complex logical and ethical dilemmas. This accolade underscored GPT-o3’s ability to handle tasks traditionally reserved for human experts, such as crafting ethical policies, solving mathematical proofs, and generating interdisciplinary research hypotheses.</p><p>GPT-o3 redefined the capabilities of reasoning models, setting a new benchmark for AI in handling complex, multi-dimensional problems. Its success illustrated the potential for AI to contribute meaningfully to domains traditionally reserved for human expertise, such as advanced scientific research and ethical policymaking.</p><p>However, as in GPT-o1, the computational demands of GPT-o3 emphasized the importance of ongoing innovation in efficiency and accessibility, ensuring that such powerful models could be broadly utilized.</p><h3>Conclusion</h3><p>At the start of our journey, I intended to mention the development of current LLMs in a single, brief blog post. But, certainly this topic deserved a rigorous exploration.</p><p>In the next two post, I want to write about <strong>utilization of LLMs</strong>, and <strong>multimodal models</strong>.</p><p>I always think that current LLMs are severely underutilized, and new methods are waiting to be explored. There is a cycle of scaling and specialization, and I think we came to the specialization part of the cycle.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31e09d906fbf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Journey of Embeddings]]></title>
            <link>https://medium.com/@alpernebikanli/journey-of-embeddings-c437f6b16a30?source=rss-7df355b3196e------2</link>
            <guid isPermaLink="false">https://medium.com/p/c437f6b16a30</guid>
            <category><![CDATA[word-embeddings]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[Alper Nebi Kanlı]]></dc:creator>
            <pubDate>Wed, 04 Dec 2024 22:22:45 GMT</pubDate>
            <atom:updated>2024-12-05T10:07:16.584Z</atom:updated>
            <content:encoded><![CDATA[<p>At the first post of this series, <em>Words and Their Mappings</em>, I briefly talked about words, their notational nature, latent space and LLMs.</p><p>I decided that embeddings are the central concept for understanding the power of LLMs, and deserve dedicated blog posts: one from beginnings to BERT and GPT, and one for LLM era.</p><p>So, let’s talk about the journey of embeddings and latent space!</p><h3>Beginnings</h3><p>As known, machine learning models perform mathematical operations. But, not all data is numerical. In order to enable machine learning models to perform mathematical operations on non-numerical data (such as text), we should somehow represent the data numerically.</p><p><strong>Categorical Variables</strong></p><p>At first, we used basic methods for assigning numbers to the categorical variables or words. The first thing come to mind naturally is assigning numbers arbitrarily to each word/category. For example, if our vocabulary simply consists of words car, motorcycle, bicycle, ship and plane, we can assign 1, 2, 3, 4, 5 to each of them, respectively. Or say we choose to do this randomly, 10, 50, 5, 1, 1000.</p><p>Technically, a machine learning algorithm would attempt to learn a model on this data. But, there will be a problem: a <strong>false pattern</strong> will be learnt according to the order and relationships to the numbers we assigned. Maybe it would return a result of “bicycle” for a pattern could both match “car” and “plane”.</p><p>In order to mitigate this, another approach is used in classical machine learning models: <strong>one-hot encoding</strong>. In this approach, words are simply defined as a <strong>fixed size vector</strong>, where only one element is set to 1, others to 0. The element set to 1 corresponds to the column representing the word itself. By doing that, we get rid of the false representations of relationships between the words.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*phiwB6sQh7q6jsfU" /></figure><p>While simple, one-hot encoding had significant limitations:</p><ul><li>These one-hot encoded vectors are <strong>orthogonal</strong>. Any two vectors have cosine similarity of zero, for example. They bear no meaningful relationships to each other. While we are removing all false similarities, we actually removed all kinds of similarities. Each word is an isolated atom.</li><li>So, it cannot capture any semantic relationships between words. For instance, even though they share similar meanings as land vehicles, “car” and “motorcycle” would be as unrelated as “car” and “cloud”. Models do not learn meanings of words in that case, they learn words as <strong>categorical variables</strong>.</li><li>Also, words are represented as <strong>sparse vectors</strong>, and vector lengths should be as much as the count of words in the dictionary. For a dictionary of a million words, that would mean a million columns to be added to the data. This severely limits the learning ability of machine learning models, because of the <strong>“curse of dimensionality”</strong>.</li></ul><p><strong>Count Based Methods on Documents</strong></p><p>Natural Language Processing is not about digitizing isolated words, of course. It’s about understanding and analyzing text. We want to process documents, paragraphs, sentences or phrases.</p><p>To go beyond the limitations of one-hot encoding, <strong>statistical, count-based methods</strong>, such as <strong>bag-of-words (BoW)</strong> and <strong>term frequency-inverse document frequency (TF-IDF)</strong> are developed. This family of methods allowed pieces of texts to be represented according to the words they contain, and provided a means to gain insight about them.</p><p>So again, we are constructing vectors, but in a different way:</p><p><strong>Bag-of-Words (BoW)</strong> is a simple technique that represents documents by counting the occurrences of each word within these documents. Each unique word in the vocabulary becomes a feature (or column), and the document is simply represented as a vector of these word counts. By doing that, we gain the ability to compare different documents/pieces of text according to their content in terms of words.</p><p><strong>Term Frequency-Inverse Document Frequency (TF-IDF)</strong>, which is an improved version of BoW, weights frequencies of each word within a document relative to its frequency across <strong>all</strong> documents. Words that appear frequently in one document but are rare across others receive higher weights, highlighting their importance to that document.</p><p>TF-IDF provides a more refined representation than BoW by distinguishing common terms from unique, document-specific terms. This allows many powerful applications such as lexical search alongside machine learning.</p><p>In both methods, at least the document vectors are no longer completely orthogonal now, as documents that share common words will have overlapping non-zero values, representing a shared vocabulary and thematic content.</p><p>However, while BoW and TF-IDF provide foundational ways to represent text, they have limitations:</p><ul><li>Semantic relationships between words are non-existent. Words are still treated as atoms.</li><li>Sentences change meaning according to the word order. Information about word order is simply non-existent.</li><li>Vectors are still sparse. They are as large as the count of unique words in a piece of text.</li></ul><p><strong>One Step Further</strong></p><p>In order to address these issues, <strong>latent structure</strong> within the data was began to be explored. For example, in the methods of <strong>Latent Semantic Analysis (LSA)</strong> and <strong>Latent Dirichlet Allocation (LDA)</strong>.</p><p>As mentioned before, methods like BoW and TF-IDF generate a sparse term-document matrix. Introduced by Deerwester et al. (1990), <strong>LSA</strong> uses <strong>singular value decomposition (SVD)</strong> on the term-document matrix to reduce dimensionality. This reduction not only provides ease of computation by reducing the dimensionality, but also uncovers patterns of <strong>co-occurrence</strong> that reveal hidden relationships between words and concepts, clustering similar terms in a <strong>semantic space</strong>.</p><p>Proposed by Blei, Ng, and Jordan (2003), <strong>LDA</strong> adopts a probabilistic approach to uncovering latent structure. Unlike LSA, which relies on matrix decomposition, LDA models documents as a mixture of <strong>topics</strong>, where each topic is a probability distribution over words. This allows it to assign weights to different topics for a document.</p><p>For instance, in a document about “space exploration,” LDA might assign 70% to a “space” topic (with words like “rocket” and “NASA”) and 30% to a “technology” topic (with words like “robotics” and “AI”). By modeling documents in this way, LDA captures thematic structures that go beyond mere word counts.</p><p>As computing power improved, researchers began exploring neural networks to enhance text representations. With these models, the idea of <strong>learning from context</strong> started to gain popularity.</p><p>By Bengio et al. (2003), <strong>Neural Probabilistic Language Models (NPLMs)</strong> used neural networks to predict the likelihood of the next word in a sequence. Unlike BoW or TF-IDF, NPLMs captured the <strong>sequential dependencies</strong> between words. For instance, in the phrase “The cat sat on the,” the model could predict “mat” by learning patterns in word order and syntax.</p><p><strong>Unified Architecture for NLP</strong>, milestone paper by Collobert and Weston (2008), proposed a <strong>shared embedding space</strong> that could be used across multiple NLP tasks, such as part-of-speech tagging and named entity recognition. The key innovation was the introduction of <strong>pre-trained embeddings</strong> — word representations learned from large corpora that could generalize to multiple tasks without requiring task-specific models.</p><p>Collobert and Weston demonstrated the power of neural embeddings to capture semantic relationships across tasks. For example, words like “apple” (the fruit) and “orange” (another fruit) would cluster together, distinct from “Apple” (the company). This concept of pre-training would later inspire transformative models we are using today.</p><p>While revolutionary, neural network based models needed extensive use of computational power. So, they had to wait for their time a little bit more.</p><h3>Word2Vec, Doc2Vec, GloVe</h3><p>Years passed, and ability to access computational power is improved. Also, large datasets which are crucial for training machine learning became accesible. So, machine learning began to be revisited as a method for various stages of NLP.</p><p>This renewed exploration led to the development of <strong>Word2Vec</strong>, by Mikolov et al. (2013).</p><p>In <strong>Word2Vec</strong>, <strong>co-occurrence</strong> is again introduced as a key idea for natural language processing. Instead of treating each word as an isolated entity (as in Bag-of-Words or TF-IDF), Word2Vec recognized that words appearing in similar contexts are likely to share related meanings.</p><p>This concept, rooted in <strong>distributional semantics</strong>, is elegantly summarized by linguist J.R. Firth’s famous quote from the 1950s:</p><p><em>You shall know a word by the company it keeps.</em></p><p>Word2Vec uses this idea by looking at <strong>which words appear frequently near each other</strong> in large text corpora. Words that share similar company, contextual neighbors, are mapped to similar vector representations in a continuous vector space, by this machine learning model.</p><p>There are two main approaches Word2Vec uses to leverage co-occurrence:</p><ul><li><strong>Skip-Gram Model</strong>: Predicts the context (neighboring words) for each target word. For example, given the word “dog,” the model learns to predict words like “barks,” “tail,” “pet,” or “animal.”</li><li><strong>Continuous Bag of Words (CBOW)</strong>: Predicts the target word based on its surrounding context words. For example, given the context words “tail,” “barks,” “pet,” and “animal,” the model would learn to predict “dog.”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*N9S-kVEEnA6MKjW4" /></figure><p>This innovation represents a paradigm shift: instead of sparse, high-dimensional vectors, Word2Vec produces <strong>dense, lower-dimensional embeddings</strong> that captures rich semantic relationships. Besides capturing semantic relationships and even allow for interesting <strong>vector arithmetic</strong> like:</p><p>king — man + woman ≈ queen</p><p>Unlike one-hot encoding, where each vector is orthogonal and lacks any relational structure, Word2Vec maps words into a lower-dimensional space where proximity in this space reflects similarity in meaning or usage. Words with similar contexts, like “car” and “bicycle,” are positioned close together, while unrelated words are placed farther apart.</p><p>The space that contains these embedding vector is called <strong>latent space</strong>, because it reveals underlying, latent, hidden patterns derived from <strong>co-occurrence data</strong> rather than directly observed features. Each dimension in this latent space encodes abstract, latent characteristics of words, such as gender, pluralization, or thematic similarity, or any other thing we do not normally think about, without these features being explicitly labeled or defined. Through training, Word2Vec captures these complex relationships, making the latent space a nuanced, multi-dimensional representation of semantic knowledge.</p><p>Word2Vec revolutionized how words are represented in vector space, but it focused only on individual words, ignoring the broader structure and meaning of documents or sentences. This limitation inspired the development of <strong>Doc2Vec</strong> (Le and Mikolov, 2014), which extended Word2Vec to generate embeddings for entire documents (just as extension from one-hot vectors to the documents vectors in BoW and TF-IDF!)</p><p>By introducing a <strong>document vector</strong>, Doc2Vec enabled models to represent the unique context of a document alongside word vectors. This innovation was particularly useful for tasks like document classification and similarity, paving the way for further exploration of embeddings beyond single-word representations.</p><p>While <strong>Word2Vec</strong> relies on local co-occurrence within a sliding context window to learn embeddings, <strong>GloVe</strong> (Pennington et al., 2014) takes a more global approach. GloVe is trained on a <strong>global co-occurrence matrix</strong> that captures how frequently words appear together across the entire corpus, rather than just within a narrow window. This approach allows GloVe to encode richer semantic and thematic relationships between words, leveraging the entire corpus for context.</p><p>Certainly <strong>Word2Vec</strong>, <strong>GloVe</strong> and <strong>Doc2Vec</strong> were breakthroughs in creating vector representations of words or paragraphs based on their semantic relationships. But they had several notable limitations we needed to solve to reach today’s capabilities:</p><ul><li>They produce <strong>static embeddings</strong>, meaning each word or document has a single, fixed representation regardless of context. For example, in word2vec, this approach fails to capture the nuances of polysemous words (e.g., “plane” as a vehicle vs. “plane” as a surface), limiting the model’s understanding of context.</li><li>Additionally, Word2Vec does not account for <strong>word order</strong>; it only considers co-occurrence within a limited context window, which means sentences like “dog bites man” and “man bites dog” would produce similar embeddings despite their very different meanings.</li><li>The models also requires <strong>fixed vocabulary</strong> and struggles with out-of-vocabulary (OOV) words, as they cannot dynamically create embeddings for new terms. Also, they struggle in morphologically rich languages, where prefixes and suffixes play a critical role in meaning.</li><li>Finally, as shallow models, they are effective for basic semantic relationships but struggle to capture deeper linguistic structures or <strong>long-range dependencies</strong> critical for complex tasks.</li></ul><h3>More Steps Further</h3><p><strong>fastText</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*CLd6eUeJMGQZzrTJ" /></figure><p>One of the first significant advancements after Word2Vec was fastText, introduced by Facebook AI Research (FAIR).</p><p>Instead of representing each word as a single atomic unit, fastText breaks down words into smaller subword components called <strong>character n-grams</strong>, capturing morphological structure within words.</p><p>This approach allows fastText to handle some of the out-of-vocabulary (OOV) words effectively, as it can generate embeddings for unseen words by combining the embeddings of their subword components.</p><p>For example, I just coined a word now: MoEOps. It is like MLOps, managing the machine learning life cycle, but for mixture-of-experts models. Normally, a word2vec model that is trained just before I coined the term would fail to recognize it. But, a recently trained fastText model would be able to, since it learnt subwords “MoE” and “Ops”.</p><p>Additionally, fastText performs better with <strong>morphologically rich languages</strong>, since they frequently use prefixes and suffixes as <strong>notations for meanings</strong>.</p><p>However, while <strong>fastText</strong> improved the handling of out-of-vocabulary words and morphological variations, it still shared some fundamental limitations with Word2Vec.</p><p>Specifically,</p><ul><li>fastText embeddings are still <strong>static</strong>. Each word still has a single, fixed representation regardless of <strong>context</strong>. So, it couldn’t differentiate between different meanings of polysemous words based on their usage either. “Plane as a vehicle” and “plane as a surface” still could not be distinguished.</li><li>fastText didn’t capture <strong>word order</strong> or syntactic relationships between words. That limits its understanding to simple co-occurrence patterns. It is still a <strong>word</strong> (single word) embedding model. “Man eats dog” and “dog eats man” still have the same meanings.</li><li>fastText also struggled with <strong>long range dependencies</strong>.</li></ul><p><strong>Recurrent Neural Networks (RNNs)</strong></p><p>In the 1990s, following the foundational paper <em>“Finding Structure in Time”</em> by Jeffrey Elman (1990), <strong>Recurrent Neural Networks (RNNs)</strong> emerged as a powerful method for handling sequential data. These networks enabled machine learning models to capture temporal dependencies, making them suitable for tasks like <strong>time series analysis</strong>, <strong>sequence prediction</strong>, and <strong>language modeling</strong>. The field saw significant advancements with the introduction of the <strong>Long Short-Term Memory (LSTM)</strong> architecture by Hochreiter and Schmidhuber in 1997, which addressed challenges like the vanishing gradient problem. LSTMs revolutionized tasks such as <strong>language modeling</strong>, <strong>speech recognition</strong>, and <strong>machine translation</strong>, setting a foundation for modern neural sequence models.</p><p>Before embeddings like <strong>Word2Vec</strong>, RNNs and LSTMs typically worked with <strong>one-hot encoded vectors</strong> or <strong>count-based features</strong> (e.g., BoW or TF-IDF). Of course this was inefficient because of <strong>dimensionality</strong> (sparse vectors) and <strong>context independence</strong> (words as atoms).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/0*EWsoOFdaQfxioA1L" /></figure><p>When embeddings are introduced, they improved RNNs by providing <strong>dimensionality reduction</strong>, <strong>semantic similarity</strong>, and <strong>emerged inherent knowledge of language</strong>.</p><p>While dimensionality reduction make models able to process large amounts of data, semantic similarity and emerged inherent knowledge of language provided a means for building upon them for specific tasks.</p><p>However, there were still some problems with RNNs:</p><ul><li>RNNs and LSTMs relied on <strong>static embeddings</strong>, such as Word2Vec or GloVe, which assigned a single, fixed representation to each word regardless of its context. “Plane as a vehicle” and “plane as a surface” are still indistinguishable.</li><li>RNNs, and even to some extent LSTMs, struggle with <strong>long-range dependencies</strong> in sequences. The gradients can become extremely small (<strong>vanishing</strong>) or excessively large (<strong>exploding</strong>) during backpropagation, making it hard to learn from earlier parts of a sequence. They struggle to maintain a broad understanding of the entire context due to their architecture. Capturing global dependencies over very long texts is challenging.</li><li>RNNs process sequences step by step, making them inherently sequential. This limits <strong>parallelization</strong> during training and inference, leading to inefficiency with large datasets and long sequences.</li><li>If input and output sequences (for example, sentences) have different lengths, RNNs and LSTMs struggle to perform properly.</li></ul><p>These shortcomings highlighted the need for more sophisticated approaches.</p><h3><strong>Encoders, Decoders and Attention</strong></h3><p>In 2014, the <strong>encoder-decoder architecture</strong> was introduced, by Sutskever et al. in their 2014 paper <em>“Sequence to Sequence Learning with Neural Networks.”</em> This framework was designed to transform one sequence into another, as required in tasks like machine translation.</p><p>The encoder-decoder architecture works by <strong>encoding</strong> the input sequence into a <strong>fixed-length vector</strong> that represents the entire sequence. This vector is then used by the <strong>decoder</strong> to generate the target sequence. We can think of this fixed-length vector as the models **internal notation for meaning of the sequence/sentence.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*f1RodOvuraF8T_Bz" /></figure><p>While this approach improved the ability to handle sequence-to-sequence tasks, it still struggled with long-range dependencies, as the fixed-length vector had to compress all information from the input sequence. This limitation often led to a loss of critical context for longer sentences.</p><p>The next breakthrough came with the introduction of the <strong>attention mechanism</strong> by Bahdanau et al. in their 2015 paper <em>“Neural Machine Translation by Jointly Learning to Align and Translate.”</em> Attention revolutionized the encoder-decoder architecture by allowing the decoder to selectively focus on specific parts of the input sequence at each step of decoding, rather than relying on a single fixed-length vector.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3aeqgRNAaGtHsYyJ" /></figure><p>For example, when translating a long sentence, the attention mechanism enables the model to dynamically align and prioritize words or phrases in the input sequence that are most relevant to the current word being generated in the target sequence. This not only improved translation quality but also provided a way to better capture <strong>long-range dependencies</strong> and <strong>syntactic relationships</strong>.</p><p>By using attention, the model implicitly created <strong>contextual representations</strong> of words, as their importance was weighted based on surrounding information.</p><p>With the success of attention mechanisms in machine translation, researchers quickly recognized their potential for other sequence-to-sequence tasks. Models incorporating attention were applied to:</p><ul><li><strong>Summarization</strong>: Allowing models to focus on the most relevant parts of a text when generating a summary.</li><li><strong>Speech Recognition</strong>: Enhancing alignment between audio signals and textual representations in models like <em>Listen, Attend, and Spell</em> (Chan et al., 2016).</li><li><strong>Image Captioning</strong>: Enabling models to generate captions for images by attending to specific regions of an image (<em>Show, Attend, and Tell</em>, Xu et al., 2015).</li></ul><p>These innovations demonstrated that attention mechanisms could be generalized beyond translation, becoming a foundational tool for a variety of NLP and multimodal tasks.</p><p>However, traditional attention mechanisms were still dependent on RNNs or LSTMs for sequential processing. While these architectures benefited from the addition of attention, they still suffered from challenges like <strong>vanishing gradients</strong> and <strong>inefficiency in parallelizing computations</strong>.</p><h3>Attention is All You Need</h3><p>In 2017, paper <em>“Attention is All You Need”</em> by Vaswani et al. introduced a new paradigm in natural language processing: the <strong>transformer architecture</strong>. This model broke away from the reliance on RNNs and LSTMs entirely, using <strong>self-attention</strong> as its primary mechanism for understanding sequences.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BEPDaD-qD9KZhuMr" /></figure><p>The transformer’s self-attention mechanism enables the model to weigh the relationships between all words in a sequence <strong>simultaneously</strong>, rather than processing words <strong>sequentially</strong>.</p><p>This provides an ease of <strong>parallelization</strong>, by using <strong>positional encodings</strong>. By eliminating the sequential bottleneck of RNNs, transformers not only improved computational efficiency but also scaled effectively to massive datasets and complex tasks. This innovation laid the groundwork for subsequent advancements in NLP.</p><p>There was still a problem: <strong>embeddings were static</strong>. While the transformer architecture introduced self-attention and positional encodings, the embeddings produced by early transformer implementations like those in <em>“Attention is All You Need”</em> were static, meaning that a word’s representation did not dynamically change based on its context. “Plane as a vehicle” and “plane as a surface” were still the same.</p><p>Around the same time, researchers sought to address this limitation still using recurrent architectures (they were not entirely convinced that attention was all they needed). In 2018, Peters et al. introduced <strong>ELMo (Embeddings from Language Models)</strong> in their paper <em>“Deep Contextualized Word Representations”</em>. Unlike earlier static embeddings, ELMo generated <strong>contextual embeddings</strong> by combining representations from a bidirectional LSTM language model. This meant that each word’s embedding dynamically adjusted based on the entire sentence.</p><p>ELMo would assign different embeddings to “plane,” reflecting its specific meaning in each context. This breakthrough made ELMo particularly effective for tasks requiring nuanced language understanding, such as question answering and named entity recognition.</p><p>However, ELMo still relied on recurrent architectures, which limited its efficiency and scalability. Its bidirectional LSTM structure required sequential processing, making it slower and less parallelizable compared to transformer-based approaches.</p><p>Then, a <strong>convergence</strong> occured, best of two worlds.</p><h3>Transformers + Contextual Embeddings</h3><p>The next breakthrough came with <strong>BERT (Bidirectional Encoder Representations from Transformers)</strong>, introduced by Devlin et al. in 2018. BERT combined the power of <strong>transformers</strong> with the concept of <strong>contextual embeddings</strong>, eliminating the sequential processing bottleneck while significantly advancing NLP capabilities.</p><p>BERT achieved contextual embeddings through its two key innovations:</p><ul><li><strong>Masked Language Modeling (MLM)</strong>: By randomly masking tokens in the input and predicting them, BERT learned bidirectional relationships in context, allowing embeddings to reflect both left and right context simultaneously.</li><li><strong>Next Sentence Prediction (NSP)</strong>: This auxiliary task trained BERT to understand sentence-level relationships, further enriching its contextual understanding.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*f_jI0GPb4bb8w3gw" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*2j2jT6QSUpqoK1JC" /></figure><p>With BERT, contextual embeddings reached new heights, outperforming ELMo and setting a new standard for language models. Its transformer-based architecture enabled unparalleled scalability, making it a foundational model for modern NLP.</p><p>Also, using <strong>pre-trained models</strong> and <strong>fine-tuning</strong> them for specific (<strong>downstream</strong>) tasks started become a wider practice among practitioners.</p><p><strong>BERT</strong> focuses on <strong>understanding tasks</strong> like <strong>classification</strong>, <strong>named entity recognition</strong>, <strong>question answering</strong>, by considering context from both the left and the right of a token. This bidirectional nature makes it excellent for tasks like sentiment analysis, entity recognition, and question answering. But, it was not suitable for <strong>generative tasks</strong> like text generation.</p><p>Around the same time, in 2018, OpenAI introduced <strong>GPT (Generative Pre-trained Transformer)</strong>, marking a significant leap forward in transformer applications, especially for <strong>generative tasks</strong> like text completion and creative writing. While BERT excelled at <strong>understanding tasks</strong>, GPT aimed to unlock the full potential of transformers for <strong>language generation</strong>.</p><p>In contrast to BERT’s <strong>bidirectional masking</strong>, GPT uses an <strong>autoregressive approach</strong>, training the model to predict the next word in a sequence based only on the left (previous) context. And GPT’s pre-training objective focuses entirely on <strong>next-word prediction</strong>, optimizing it for fluency and coherence in generative tasks. This makes it ideal for tasks requiring sequential generation, such as writing coherent essays or crafting natural-sounding dialogue.</p><p>The journey of word embeddings and latent space is a testament to the continuous innovation in natural language processing. From the ordinary one-hot encodings to the transformative contextual embeddings of BERT and GPT, we’ve moved from treating words as isolated atoms to understanding them as dynamic representations influenced by their context. These breakthroughs have fundamentally changed how machines process language, enabling models to not only understand but also generate human-like text.</p><p>What makes this evolution so groundbreaking is the emergence of <strong>latent space</strong> — a multi-dimensional representation that captures hidden patterns, relationships, and even abstract concepts about language. Words are no longer arbitrary symbols; they become notations for models to learn mathematical entities connected to each other semantically. Through latent space, machine learning models gain the ability to navigate the intricate web of human language, mapping relationships and uncovering insights that go beyond simple rules or surface-level statistics.</p><p>However, this is not the end of the story.</p><p>As known, the capabilities of current <strong>large language models (LLMs)</strong> — their reasoning, creativity, and adaptability — go far beyond BERT and GPT. In the next post, we will look at the <strong>LLM era</strong>, exploring how post-GPT models like GPT-3, GPT-4, and others build on this foundation to redefine what machines can do with language.</p><p>Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c437f6b16a30" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Inspirations behind Words and Their Mappings Series]]></title>
            <link>https://medium.com/@alpernebikanli/inspirations-behind-words-and-their-mappings-series-64c6a0bcb9af?source=rss-7df355b3196e------2</link>
            <guid isPermaLink="false">https://medium.com/p/64c6a0bcb9af</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[embedding]]></category>
            <dc:creator><![CDATA[Alper Nebi Kanlı]]></dc:creator>
            <pubDate>Thu, 07 Nov 2024 21:08:32 GMT</pubDate>
            <atom:updated>2024-11-07T21:44:41.198Z</atom:updated>
            <content:encoded><![CDATA[<p>As I work on my latest series, I wanted to share some of the resources and inspirations that have deeply influenced my perspective on AI and its potential as a tool for augmenting human intelligence.</p><p>These pieces shaped my understanding of how LLMs really work, what are the insights that can be gained from them, and how to make use of them more creatively.</p><h3>1. “<a href="https://distill.pub/2017/aia/">Using Artificial Intelligence to Augment Human Intelligence</a>” by Shan Carter and Michael Nielsen</h3><p>This paper was initially published on <em>distill.pub</em>, a platform dedicated to creating visually rich and accessible explanations of machine learning research. The ideas presented in this work fundamentally shaped how I think about AI.</p><p>Carter and Nielsen outline how AI can act as an augmentation tool, amplifying human intelligence rather than just automating tasks.</p><p>Their vision aligns with the concept of AI as a “bicycle for the mind” — a tool that enhances our ability to understand, create, and solve complex problems.</p><h3>2. Mechanistic Interpretability research, especially the <a href="https://transformer-circuits.pub/">Transformer Circuits Thread</a></h3><p>Another significant source of inspiration is <strong>mechanistic interpretability research</strong>, particularly the work from <strong>Anthropic’s Transformer Circuits</strong> thread. This research builds on the original <a href="https://distill.pub/2020/circuits/">Circuits thread from <em>distill.pub</em></a>, exploring how large language models represent and process information at a structural level.</p><p>Understanding the mechanisms inside neural networks is crucial for ensuring AI systems are both safe and reliable. This work dives into the internal organization of language models, providing a lens through which we can better interpret and control complex AI behaviors.</p><h3>3. Interfaces for AI: Insights from <a href="https://wattenberger.com/">Amelia Wattenberger</a> and <a href="https://thesephist.com/">Linus Lee</a></h3><p>The design of AI interfaces is another area that fascinates me, especially as it relates to <strong>true capabilities of LLMs</strong>. Recent explorations by <strong>Amelia Wattenberger</strong> and <strong>Linus Lee</strong> have rekindled my curiosity in this area. I am a huge fan of them!</p><p>In <a href="https://wattenberger.com/thoughts/llms-as-a-tool-for-thought">LLMs as a Tool for Thought</a>, Wattenberger explores how large language models (LLMs) can go beyond from traditional applications like chatbots to <em>a good tool for thought as an extension of your mind.</em></p><p>In <a href="https://thesephist.com/posts/synth/">Synthesizer for Thought</a>, Lee presents the idea of AI as a <strong>“synthesizer” for human thought</strong>, emphasizing its role in blending, expanding, and transforming ideas and concepts rather than simply generating text. Lee sees AI as a tool that does not just answer questions or complete tasks but actively <strong>combines fragments of thought into coherent, novel insights</strong>, much like a musical synthesizer layers and manipulates sounds to create new harmonies.</p><p>I highly recommend reading their other relevant work as well.</p><p>At its best, AI has the power to expand our intellectual horizons and enable new ways of thinking. By combining mechanistic insights with well-designed interfaces, we can create AI tools that not only enhance human intelligence but do so in ways that are safe, interpretable, and user-centered.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64c6a0bcb9af" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Words and Their Mappings — Introduction]]></title>
            <link>https://medium.com/@alpernebikanli/words-and-their-mappings-introduction-fe4afc3aaafd?source=rss-7df355b3196e------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe4afc3aaafd</guid>
            <category><![CDATA[word-embeddings]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[latent-space]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Alper Nebi Kanlı]]></dc:creator>
            <pubDate>Mon, 04 Nov 2024 08:15:06 GMT</pubDate>
            <atom:updated>2024-11-04T08:15:06.394Z</atom:updated>
            <content:encoded><![CDATA[<h3>Words and Their Mappings — Introduction</h3><p><em>“Words, my colonel, do not reach certain meanings.”</em> — Dangerous Games, Oğuz Atay</p><p>Language is our primary tool for grasping and communicating both the abstract and the concrete. To capture and communicate the vastness of thought, emotion, and perception; we use a nice notation system: words.</p><p>I am not so sure if the main character of the novel Dangerous Games, Hikmet, is entirely right with that statement or not. But <strong>words are like a notation for a discretization on a continuum of meaning.</strong> The most useful notation we have ever used, maybe.</p><p>Years after the boom of deep learning, with the advent of Large Language Models (LLMs), it is again realized that language is more than just words. It is a medium for transferring and shaping concepts and information.</p><p>The map is not the territory, notation is not the music, and words are not the mathematical objects LLMs engage with.</p><p>This post is a very brief introduction to a series, exploring words, their mappings, and applications emerging from them in the context of LLMs. In the series, we will be discovering:</p><ul><li>Power of embeddings and the latent space</li><li>Applications enabled by embeddings (definitely not limited to chatbots, text generation or simply talking with your documents! True power is in exploratory and creative tools.)</li><li>AI interpretability and monosemanticity</li><li>UI/UX for better AI-powered applications</li><li>Intelligence augmentation, <em>bicycle for the mind.</em></li></ul><h3>Words and Notations</h3><p>Our attempts to organize, represent or express concepts often lead us to create systems of notation, i.e. structured languages like mathematics, musical scores, or even emojis. These notations serve as tools that help us encode and manipulate abstract (and concrete) concepts. They shape how we think, how we reason, what we can imagine, and what can we do.</p><p>Words, the most common notation we use among ourselves, also serve as a form of notation we use for communicating with LLMs. But make no mistake — <strong>words are merely notation to LLMs as well, representations of underlying mathematical objects.</strong></p><p>LLMs are using a different internal notation than words.</p><h3>LLMs and Meanings</h3><p>In LLMs, each word, phrase, or concept is mapped into an abstract, multidimensional space known as <strong>latent space</strong>, where the model identifies and captures complex patterns and relationships. Within this latent space, concepts are represented by vectors, enabling the model to organize and interpret language based on the relationships between these mathematical representations.</p><p>These vectors are called embeddings. The latent space is vast, allowing the model to place concepts that often appear together or share meaning in proximity to one another.</p><p>This enables so many things: content generation, semantic search, exploratory tools and creative tools.</p><p>In the next post, we will be discovering the power of embeddings and the latent space. Also, we will explore the ower of LLMs beyond standard applications and how they can fuel innovative, user-centered AI tools.</p><p>Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe4afc3aaafd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Does Elasticsearch Work? — Elasticsearch Architecture — General Overview]]></title>
            <link>https://medium.com/@alpernebikanli/how-does-elasticsearch-work-elasticsearch-architecture-general-overview-550cfb1d6127?source=rss-7df355b3196e------2</link>
            <guid isPermaLink="false">https://medium.com/p/550cfb1d6127</guid>
            <dc:creator><![CDATA[Alper Nebi Kanlı]]></dc:creator>
            <pubDate>Fri, 03 Feb 2023 21:50:06 GMT</pubDate>
            <atom:updated>2024-11-04T08:12:09.665Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>How Does Elasticsearch Work? — Elasticsearch Architecture — General Overview</strong></h3><h3><strong>Introduction</strong></h3><p>Elasticsearch is a fast and scalable search and analytics engine built on top of the Apache Lucene library.</p><p>It is known for its powerful full-text search capabilities and is widely used in applications ranging from enterprise search to log and event data analysis.</p><p>Here are some of the key reasons to use Elasticsearch:</p><ul><li><strong>Near Real-Time (NRT) Search:</strong> Elasticsearch provides near-instant search results, making it an excellent choice for applications that require real-time search or analytics functionality.</li></ul><p>This is achieved through efficient indexing processes that update the search indices almost immediately after data is ingested.</p><ul><li><strong>Powerful Querying Abilities:</strong> Elasticsearch offers various search and query options, from simple keyword searches to complex compound queries, which can filter, aggregate, and sort results in ways that closely match user needs.</li></ul><p>This flexibility makes it suitable for a broad range of applications, including e-commerce, data monitoring, and enterprise search.</p><ul><li><strong>Scalability:</strong> Designed to scale horizontally, Elasticsearch allows you to manage growing data volumes by adding more nodes to the cluster, distributing both data and search load efficiently.</li></ul><p>This enables it to handle billions of documents and high query volumes without compromising performance.</p><ul><li><strong>High Availability:</strong> With built-in support for sharding and replication, Elasticsearch ensures high availability and fault tolerance.</li></ul><p>By distributing data across multiple nodes and replicating it, Elasticsearch can continue to serve queries even if some nodes fail.</p><ul><li><strong>Analytics:</strong> Beyond search, Elasticsearch provides robust analytics capabilities, including aggregations that enable complex data analysis and visualization directly within the engine.</li></ul><p>This allows users to derive insights from their data, such as identifying trends, patterns, and anomalies.</p><ul><li><strong>Integrations:</strong> Elasticsearch integrates seamlessly with a wide variety of tools and platforms, including log management systems (like Logstash and Kibana), security frameworks, and business intelligence tools.</li></ul><p>It also supports multiple programming languages, making it easy to embed search capabilities in various applications.</p><p>Due to these capabilities, Elasticsearch is currently the most popular enterprise search engine according to the DB-Engines ranking, making it a go-to solution for many organizations looking for scalable search and analytics.</p><h3>Architecture Overview</h3><p>An Elasticsearch cluster is composed of individual service units called nodes, which store data and perform indexing and querying operations. A cluster can have many nodes, and each node plays a specific role depending on its configuration:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*8P5qrScvKQj13L5hmPLFmg.png" /></figure><ul><li><strong>Master Node:</strong> Responsible for cluster-wide operations such as creating and deleting indices, managing cluster state, and distributing shards. The master node is selected through an election among master-eligible nodes.</li><li><strong>Data Node:</strong> Stores data and handles CRUD (Create, Read, Update, Delete) operations and search requests. Data nodes perform the heavy lifting of indexing and querying.</li><li><strong>Ingest Node:</strong> Pre-processes documents before indexing, such as enriching data, transforming data formats, or removing unwanted fields. This helps in optimizing the data before it’s stored in the indices.</li><li><strong>Client (Coordinating) Node:</strong> Acts as a load balancer by routing requests to the appropriate data nodes and aggregating results. It does not hold data or perform indexing but plays a crucial role in distributing search load efficiently across the cluster.</li></ul><p>Nodes contain shards, and indices are made up of these shards. An index, which can be thought of like a database, is distributed across different nodes in a multi-node cluster. This distribution allows Elasticsearch to scale and handle large datasets effectively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*eYhVtXkuGfCqf8h64KdwlQ.png" /></figure><p>Shards are of two types: primary shards and replica shards. Each primary shard can have one or more replica shards. Elasticsearch ensures that a primary shard and its replicas are never located on the same node, enhancing data redundancy and fault tolerance.</p><ul><li><strong>Primary Shard:</strong> Each document is stored in one primary shard. Elasticsearch uses these primary shards to create replica shards.</li><li><strong>Replica Shard:</strong> A copy of the primary shard that provides redundancy. Replica shards improve query performance and provide failover in case the primary shard becomes unavailable.</li></ul><p>Each shard is essentially a self-contained search engine that indexes and handles queries. This architecture allows Elasticsearch to split large datasets across multiple nodes and shards, improving both search performance and data availability.</p><h3>Shards and Index</h3><p>An index is a logical namespace that maps to one or more primary shards and their replicas. Each shard is a Lucene index, and these Lucene indices consist of segments, which are fully functional inverted indices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*70PwkvtPIOCJgPyjA6kMCQ.png" /></figure><p><strong>But what is an inverted index?</strong></p><p>An inverted index is a data structure commonly used in search engines to map terms to the documents containing them. Instead of having a list of documents and the terms they contain, an inverted index has a list of terms and the corresponding documents. This structure allows for quick full-text searches across large datasets, enabling fast retrieval of documents that match search criteria.</p><p>For example, consider the following documents:</p><ul><li>“What is an inverted index?”</li><li>“Thinking about inverted index is so much fun.”</li><li>“I don’t often index my thoughts as much as I should.”</li></ul><p>The inverted index would look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/409/0*raWErm7ZlwF9C-pg.png" /></figure><p>This structure allows Elasticsearch to efficiently retrieve documents containing specific terms, even in very large datasets.</p><h3>What Happens When a Document is Indexed?</h3><p>When a document is indexed, Elasticsearch performs several steps:</p><ol><li><strong>Parsing:</strong> The document data is parsed and converted into a structured format (JSON) that Elasticsearch understands. This ensures that the data can be processed and indexed correctly.</li><li><strong>Analysis:</strong> The fields of the document are analyzed using a tokenizer and a set of filters (e.g., lowercasing, removing stop words). This step helps break down text fields into tokens, which are the searchable terms stored in the inverted index.</li><li><strong>Inverted Index Creation:</strong> From the analyzed fields, terms are generated, and an inverted index is constructed. This data structure maps each term to the documents that contain it, enabling efficient full-text searches.</li><li><strong>Vector Index Creation (if applicable):</strong> If the document contains vector fields (e.g., dense vectors from embeddings), Elasticsearch stores these vectors in a special type of index that allows for approximate nearest neighbor (ANN) search. This enables similarity search capabilities, such as finding documents with similar content based on vector representations from machine learning models. The vectors are indexed using algorithms like HNSW (Hierarchical Navigable Small World graphs) to support fast and efficient vector-based queries.</li><li><strong>Document Storage:</strong> The document, along with its metadata (e.g., unique ID, version number), is stored in the index. This allows Elasticsearch to retrieve the document directly when a search query matches it.</li><li><strong>Replication:</strong> If replica shards are configured, Elasticsearch replicates the document data across these shards to ensure high availability and redundancy. This replication process helps maintain data integrity and provides failover protection in case of node failures.</li><li><strong>Updating the Cluster State:</strong> The cluster state is updated to reflect the new or modified document, including updates to shard allocation and indexing statistics. This step ensures the cluster’s consistency and availability of the new data for search operations.</li><li><strong>Index Refresh:</strong> Periodically, Elasticsearch refreshes the index to make newly indexed documents searchable. This involves making the latest changes visible to search queries by creating new segment files that include the newly indexed data.</li></ol><p>Elasticsearch’s vector search functionality allows for more advanced search capabilities beyond traditional keyword matching. By using dense vectors (like those generated by neural networks or other embedding models), Elasticsearch can perform similarity searches based on the mathematical properties of the vectors. This is particularly useful in applications such as:</p><ul><li><strong>Recommendation Systems:</strong> Finding items that are similar to a user’s preferences based on vector representations.</li><li><strong>Semantic Search, and with the help of it, RAG:</strong> Enabling searches that understand the meaning and context of queries rather than just matching keywords.</li><li><strong>Image and Audio Search:</strong> Indexing vectors representing images or audio clips to find similar media content.</li></ul><p>To use vector search, you define vector fields in your index mappings and specify the appropriate settings for vector search algorithms, such as the size of the vectors and the type of distance metric (e.g., cosine similarity, Euclidean distance). By incorporating vector fields and leveraging Elasticsearch’s vector search capabilities, you can enhance your search experience with powerful, data-driven insights that go beyond traditional text search.</p><h3>What Happens When a Query is Run?</h3><p>When a query is executed in Elasticsearch, the search operation occurs in two main phases: the query phase and the fetch phase. This two-step process is designed to efficiently search across distributed data while optimizing performance.</p><ol><li><strong>Query Phase:</strong> The search query is broadcasted to all relevant shards, whether they are primary or replicas. Each shard executes the query independently, processing it locally to produce a list of matching documents. During this phase, Elasticsearch uses a customizable scoring algorithm to rank the results, with Okapi BM25 (based on TF-IDF) being the default method for text relevancy scoring. This algorithm considers factors like term frequency, inverse document frequency, and field-length normalization to calculate the relevance score of each document. The top-ranked results from each shard are then collected and merged into a single sorted list to produce the final ranked result set.</li><li><strong>Fetch Phase:</strong> Once the top results are identified in the query phase, the fetch phase retrieves the actual documents from the shards using their document IDs. In this phase, Elasticsearch ensures that only the necessary documents are fetched, which optimizes performance by minimizing data transfer and reducing load on the nodes. The fetch phase is responsible for assembling the final result set that is returned to the user, including any requested fields, highlights, or additional metadata.</li><li><strong>Coordination and Merging:</strong> During the query phase, a coordinating node aggregates the partial results from each shard, merges them based on the relevancy scores, and selects the top results that should be fetched in the fetch phase. This coordination reduces the amount of data moved across the cluster and ensures efficient use of resources.</li><li><strong>Handling Large Results:</strong> For queries that return a large number of results, Elasticsearch uses a technique called pagination, which allows the client to request results in smaller batches (e.g., 10 results per page). This is achieved using the `from` and `size` parameters, which specify the offset and the number of results to return. This approach helps manage memory usage and network load, ensuring that the cluster remains responsive even under heavy query loads.</li><li><strong>Support for Vector Search:</strong> In addition to traditional text-based queries, Elasticsearch can handle vector searches during the query phase. When dealing with vector fields, Elasticsearch uses algorithms like HNSW (Hierarchical Navigable Small World graphs) to perform approximate nearest neighbor searches, which are essential for tasks such as similarity search, recommendations, and semantic search. The query phase for vector searches also involves ranking and merging results based on vector similarity scores.</li><li><strong>Query Optimization:</strong> Elasticsearch automatically optimizes query execution by using various techniques such as query caching, query rewriting, and shard preference settings. These optimizations help reduce the computational cost of frequent or complex queries and improve response times by reusing previously computed results when possible.</li><li><strong>Security and Access Control:</strong> During the query execution, Elasticsearch enforces security rules and access controls defined by roles and permissions. This ensures that users can only access documents and fields that they are authorized to view, providing an additional layer of security in multi-user environments.</li></ol><h3>Conclusion</h3><p>This brief introduction to Elasticsearch provides an overview of its architecture and core functionalities, highlighting why it’s a popular choice for scalable search and analytics solutions.</p><p>In the next parts of the series, we’ll dive deeper into more advanced topics, including performance tuning, advanced query techniques, and integrating Elasticsearch into your existing tech stack.</p><p>Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=550cfb1d6127" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>