<?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 Saad on Medium]]></title>
        <description><![CDATA[Stories by Saad on Medium]]></description>
        <link>https://medium.com/@itissaad25?source=rss-dd23210354df------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*ctQmkVztIIZv9tOB</url>
            <title>Stories by Saad on Medium</title>
            <link>https://medium.com/@itissaad25?source=rss-dd23210354df------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 17:22:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@itissaad25/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[From AlphaGo to AlphaFold: How AI Is Becoming a Tool for Scientific Discovery]]></title>
            <link>https://medium.com/@itissaad25/from-alphago-to-alphafold-how-ai-is-becoming-a-tool-for-scientific-discovery-2ec398f6cd67?source=rss-dd23210354df------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ec398f6cd67</guid>
            <category><![CDATA[new-age]]></category>
            <category><![CDATA[ai-boom]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[scientific-discovery]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Saad]]></dc:creator>
            <pubDate>Mon, 21 Sep 2026 06:04:09 GMT</pubDate>
            <atom:updated>2026-09-21T06:04:09.473Z</atom:updated>
            <content:encoded><![CDATA[<h3>DeepMind’s journey shows how systems trained through games can help solve major problems in biology, medicine, physics, and the pursuit of artificial general intelligence.</h3><p>Artificial intelligence has progressed from playing simple video games to predicting the structures of nearly every protein known to science. This transformation did not happen because researchers created a separate system for every possible task. It emerged from the development of learning algorithms capable of finding useful patterns inside enormous spaces of possibilities.</p><p>The journey of DeepMind offers a clear example of this evolution. Games such as chess, Go, and Atari provided controlled environments for testing new approaches to intelligence. The lessons learned from these environments were later applied to protein folding, drug discovery, weather prediction, materials science, and other complex scientific problems.</p><p>The broader goal is no longer simply to create machines that perform individual tasks well. It is to build general systems that can learn, reason, plan, and help uncover knowledge that humans have not yet discovered.</p><h3>Games as a Starting Point for Artificial Intelligence</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uPV-c5IVtY76_Y-cGkl4AA.png" /></figure><p>Chess has long served as a way to study reasoning. Every move requires planning, evaluation, prediction, and adaptation. These mental processes make chess useful not only as a competitive game but also as a simplified model of intelligence.</p><p>Early chess computers followed carefully programmed rules. Human experts encoded strategies, priorities, and evaluation methods into the software. This approach produced powerful systems, including IBM’s Deep Blue, which defeated world chess champion Garry Kasparov in 1997.</p><p>However, these expert systems had an important limitation. They could only handle situations anticipated by their programmers. When faced with something unexpected, they had no general mechanism for learning or adapting.</p><p>Modern AI systems follow a different approach. Instead of receiving complete solutions from programmers, they learn directly from data and experience. This allows them to discover strategies that may not have been known to the people who designed them.</p><p>DeepMind was founded in 2010 around this idea. Its early mission could be summarized in two steps:</p><ol><li>Solve intelligence.</li><li>Use intelligence to solve other problems.</li></ol><p>At the time, this goal appeared extremely ambitious. AI was not yet the central technology industry it is today. Deep learning was still developing, computational resources were limited, and many researchers remained focused on traditional methods.</p><p>DeepMind placed its bets on two technologies: deep learning and reinforcement learning. Deep learning allowed systems to build representations of the environments they encountered. Reinforcement learning allowed them to take actions, observe results, and improve their decisions.</p><p>The combination became the foundation for several major breakthroughs.</p><h3>Learning Directly From Pixels</h3><p>One of DeepMind’s first important systems was the Deep Q-Network, commonly known as DQN. It learned to play Atari games using only the pixels displayed on the screen.</p><p>The system was not given a description of the game, the objects on the screen, or the controls. It simply received a stream of images and a goal: maximize the score.</p><p>This was significant because it demonstrated an end-to-end learning system. Raw visual information entered the model, and useful actions came out. The system learned the relationship between what it saw, what it did, and the reward it received.</p><p>Atari games were relatively simple, but they provided an ideal testing environment. Experiments could be repeated quickly, performance could be measured clearly, and the system could gain large amounts of experience without affecting the real world.</p><p>After mastering many Atari games, the next challenge was far more complex.</p><h3>AlphaGo and the Limits of Brute Force</h3><p>Go is one of the most complex games ever created. An estimated 1017010^{170} board positions are possible, a number vastly greater than the estimated number of atoms in the observable universe.</p><p>This makes brute-force search impractical. A system cannot examine every possible continuation before selecting a move. It must identify which possibilities are worth exploring.</p><p>AlphaGo solved this problem by combining neural networks with a guided search process. The neural networks evaluated positions and suggested promising moves. The search algorithm then concentrated its computational effort on the most useful branches of the decision tree.</p><p>In 2016, AlphaGo defeated Lee Sedol, one of the strongest Go players in history, in a widely watched five-game match. The victory was important, but the way AlphaGo played was even more revealing.</p><p>During the second game, AlphaGo made a move that professional players initially considered strange or even mistaken. The move, now known as Move 37, eventually became central to its victory. It represented a strategy that had not been part of conventional human Go knowledge.</p><p>This showed that a learning system could do more than reproduce existing expertise. It could discover new knowledge.</p><h3>How Self-Play Creates Superhuman Performance</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bA0BcSGvs4vcdnwOkeqFNw.png" /></figure><p>Later systems such as AlphaGo Zero and AlphaZero reduced their dependence on human examples. They learned by repeatedly playing against themselves.</p><p>The process begins with a system that knows only the rules. Its initial moves are nearly random. After playing many games, the resulting positions and outcomes become training data for a stronger version of the model.</p><p>The improved model then competes against the previous version. If it wins consistently, it replaces the older model and generates a new set of higher-quality games.</p><p>Repeated over many iterations, this cycle can transform random play into superhuman performance within a remarkably short period.</p><p>AlphaZero generalized this approach beyond Go. It learned chess and shogi from scratch and developed playing styles that differed from those of traditional engines.</p><p>Conventional chess programs often place significant value on material, such as the number and strength of pieces remaining on the board. AlphaZero frequently sacrificed material to gain mobility, initiative, and positional control. Its games demonstrated that a machine could develop strategies that were not only effective but also considered creative and aesthetically appealing by leading chess players.</p><p>Games, however, were never meant to be the final destination. They were training grounds for algorithms that could eventually tackle real-world problems.</p><h3>What Makes a Problem Suitable for AI?</h3><p>The techniques developed for games can be applied to other fields when a problem has three main characteristics.</p><p>First, it contains a massive search space. There may be too many possible solutions for brute-force methods to examine.</p><p>Second, it has a clear objective. The system needs a measurable way to determine whether one solution is better than another.</p><p>Third, it provides enough data, experience, or simulation capability for learning.</p><p>Many scientific problems fit this description. Chemistry involves searching through enormous numbers of possible molecules. Materials science requires identifying combinations of atoms with useful properties. Drug discovery involves finding compounds that bind to a particular target without creating harmful side effects.</p><p>One of the most important examples is protein folding.</p><h3>The Protein-Folding Problem</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ujVU14JWFGvqnPZNxbMW8g.png" /></figure><p>Proteins are fundamental components of life. They contribute to nearly every biological process, including muscle movement, immune responses, and communication between cells.</p><p>A protein begins as a sequence of amino acids. This sequence folds into a three-dimensional structure, and that structure strongly influences the protein’s function.</p><p>The protein-folding problem asks whether the final three-dimensional structure can be predicted directly from the amino acid sequence.</p><p>The challenge is enormous. An average protein can theoretically adopt an astronomical number of possible shapes. Yet inside living organisms, proteins often fold into their correct structures within milliseconds. This observation suggests that the problem contains an underlying structure that can be learned.</p><p>Traditionally, scientists determined protein structures through experimental methods such as X-ray crystallography, cryogenic electron microscopy, and nuclear magnetic resonance. These methods are valuable but can require years of work. Determining a single structure may consume much of a doctoral research project.</p><p>AlphaFold was developed to predict these structures computationally.</p><h3>AlphaFold and the Arrival of Digital Biology</h3><p>The first version of AlphaFold entered the Critical Assessment of Structure Prediction competition in 2018. Known as CASP, the competition evaluates computational predictions against protein structures that have been experimentally determined but not yet publicly released.</p><p>AlphaFold 1 substantially outperformed competing systems, but it did not reach the accuracy required to replace experimental work in many situations.</p><p>The system was then redesigned. AlphaFold 2 achieved atomic-level accuracy during the 2020 CASP competition, leading organizers to describe the protein-folding problem as effectively solved for many practical purposes.</p><p>The importance of AlphaFold came from both its accuracy and its speed. A structure that might take years to determine experimentally could often be predicted in minutes or seconds.</p><p>DeepMind subsequently used AlphaFold to predict the structures of approximately 200 million proteins and released the results through a freely accessible database. The scale of this achievement can be compared to hundreds of millions of years of cumulative experimental work compressed into a computational project lasting roughly one year.</p><p>Millions of researchers around the world now use AlphaFold predictions. Applications include:</p><ul><li>Designing enzymes that can help break down plastic</li><li>Studying antibiotic resistance</li><li>Researching malaria and neglected tropical diseases</li><li>Investigating mechanisms related to fertility</li><li>Developing targeted drug-delivery systems</li><li>Understanding important structures inside cells</li><li>Studying plants and organisms with limited experimental data</li></ul><p>AlphaFold 3 expanded the focus from isolated protein structures to biological interactions. It can model how proteins interact with other proteins, DNA, RNA, and small molecules such as drug compounds.</p><p>Another system, AlphaProteo, approaches the problem in reverse. Instead of predicting the shape produced by a known amino acid sequence, it helps design new proteins for specific functions.</p><p>Together, these developments point toward a new era of digital biology.</p><h3>AI as a Language for Biology</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9uwAwsrLe1r2hOdizcim6A.png" /></figure><p>Mathematics provides a powerful language for describing physics. Equations can represent motion, forces, energy, and the behavior of physical systems.</p><p>Biology is more difficult to express through compact equations because it involves complex interactions and emergent behavior. AI may provide a better descriptive language for these systems.</p><p>At its foundation, biology can be viewed as an information-processing system. Genetic instructions, molecular interactions, cellular signals, and environmental responses all contribute to the behavior of living organisms.</p><p>AI systems are well suited to finding patterns in this complexity. AlphaFold is an early example of how machine learning can convert biological information into accurate and useful predictions.</p><p>The next major objective is to apply this approach to drug discovery. Developing a new medicine currently takes many years and can cost billions of dollars. AI could reduce the search process by predicting promising compounds before expensive laboratory testing begins.</p><p>A longer-term possibility is the development of a virtual cell. Such a system would simulate the behavior of a simple living cell and allow researchers to conduct experiments computationally. Physical laboratories could then focus more heavily on validating the most promising predictions.</p><p>This would allow science to move closer to digital speed.</p><h3>Beyond Biology</h3><p>The same general methods are already being applied across many fields.</p><p>AI systems have helped identify eye diseases from retinal scans, discover new materials, improve weather forecasting, control plasma in fusion reactors, and design faster algorithms for matrix multiplication.</p><p>These examples share a common structure. Each problem contains a large number of possibilities, but only a small number of useful solutions. A learning system builds a model of the problem and guides the search toward the most promising areas.</p><p>This approach could make AI an important partner across scientific disciplines. The greatest progress may come from collaboration between AI researchers and specialists in biology, medicine, chemistry, physics, climate science, and engineering.</p><h3>World Models and the Path Toward AGI</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B2nv1IsNbnpaWjy4TOEJPA.png" /></figure><p>Scientific systems such as AlphaFold are highly capable, but they operate within specialized domains. Artificial general intelligence requires models that understand a much broader range of environments and tasks.</p><p>Multimodal models such as Gemini are part of this progression. They process several forms of information, including text, images, audio, and video.</p><p>Video-generation systems provide another important research direction. To generate a convincing video of a tomato being cut or an object falling into water, a model must reproduce aspects of motion, object permanence, and physical interaction.</p><p>The system may not contain explicitly programmed equations of physics. Instead, it learns patterns by observing large amounts of video data.</p><p>Genie 2 extends this idea by generating interactive environments from descriptions or images. These environments are currently consistent for limited periods, but improving their stability could lead to more capable world models.</p><p>A world model does more than produce images. It represents how an environment changes when actions are taken. When combined with planning systems inspired by AlphaGo, such models could support advanced assistants, autonomous agents, and robots.</p><p>Project Astra represents one vision of a universal assistant that can understand its surroundings through devices such as phones or glasses. Rather than responding only to written prompts, such an assistant could observe the physical environment, remember relevant information, and provide help in real time.</p><h3>Safety Must Develop Alongside Capability</h3><p>The increasing power of AI also creates significant risks. Synthetic images, video, audio, and text can make it difficult to distinguish real content from generated material.</p><p>Technologies such as SynthID address part of this problem by embedding imperceptible watermarks into AI-generated content. Detection systems can later identify whether an image, video, audio recording, or piece of text was generated by an AI system.</p><p>Technical safeguards alone are not enough. Governments, researchers, companies, civil society organizations, and the public all have roles in determining how powerful AI systems should be developed and deployed.</p><p>The traditional technology philosophy of moving quickly and accepting broken systems is unsuitable for a technology with such broad consequences. AI development requires scientific care, humility, transparency, and long-term planning.</p><p>The goal should be to preserve the benefits while reducing foreseeable harm.</p><h3>The Continuing Importance of Human Skills</h3><p>Rapid AI development creates understandable uncertainty about education and careers. Programming, mathematics, and technical knowledge remain important because they provide a deeper understanding of how AI tools work.</p><p>At the same time, natural-language programming will make software development accessible to more people. Artists, designers, filmmakers, researchers, and entrepreneurs may be able to build applications without mastering every detail of a traditional programming language.</p><p>For experienced engineers, AI could significantly increase productivity rather than simply replace technical work.</p><p>The most durable skill may be the ability to learn quickly. Tools, models, and workflows will continue changing. People who understand the fundamentals and can adapt to new systems will be better prepared for both the disruption and the opportunities ahead.</p><h3>AI as a Tool for Understanding the Universe</h3><p>AlphaFold suggests that classical computers may be capable of modelling more of nature than previously assumed.</p><p>Proteins operate at the atomic scale and are governed by physical processes with quantum foundations. Nevertheless, neural networks running on classical computers can approximate their structures with remarkable accuracy.</p><p>This leads to a broader possibility: if a stable pattern exists in nature, it may contain enough structure for a learning algorithm to model it efficiently.</p><p>That idea remains a conjecture, and some problems may still require quantum computing. However, the success of systems such as AlphaFold shows that learning algorithms can make previously intractable problems manageable without directly simulating every underlying physical interaction.</p><p>Artificial general intelligence could therefore become more than an automation technology. It could serve as a general-purpose scientific instrument, helping researchers understand life, matter, intelligence, and the fundamental structure of reality.</p><p>The journey from chessboards to protein structures shows the direction clearly. Games taught machines how to search, learn, and plan. Science is now giving those abilities a more consequential purpose.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ec398f6cd67" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Chatbots to Long-Running AI Agents: The Infrastructure Shift Behind the Next Wave of AI]]></title>
            <link>https://medium.com/@itissaad25/from-chatbots-to-long-running-ai-agents-the-infrastructure-shift-behind-the-next-wave-of-ai-684846710fd4?source=rss-dd23210354df------2</link>
            <guid isPermaLink="false">https://medium.com/p/684846710fd4</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[ai-future]]></category>
            <category><![CDATA[ai-wave]]></category>
            <category><![CDATA[ai-infrastructure]]></category>
            <category><![CDATA[chatbots]]></category>
            <dc:creator><![CDATA[Saad]]></dc:creator>
            <pubDate>Mon, 14 Sep 2026 06:47:41 GMT</pubDate>
            <atom:updated>2026-09-14T06:47:41.711Z</atom:updated>
            <content:encoded><![CDATA[<h3>AI models can now work for longer, recover from mistakes, and pursue complete outcomes. The challenge is no longer just model intelligence. It is building the systems that let agents operate safely, reliably, and efficiently.</h3><p>The most important change in artificial intelligence is not simply that models have become smarter. It is that they can now work for longer periods, use tools, correct mistakes, and complete complex tasks with far less human involvement.</p><p>A year ago, most AI interactions still required a person to remain closely involved. A user would send a prompt, inspect the response, provide another instruction, and repeat the process until the work was complete. The model acted more like an assistant waiting for its next command.</p><p>Long-running agents introduce a different model of work. Instead of receiving detailed instructions for every step, an agent can be given an outcome. It can then determine which actions are required, execute them, inspect the results, recover from errors, and continue working in the background.</p><p>This transition changes what companies need to build. The central challenge is moving away from carefully steering a model through every action and toward creating an environment in which an agent can operate reliably for an extended period.</p><h3>From Instructions to Outcomes</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WtkoUyUDlvFxWCqdXYC5Pg.png" /></figure><p>Traditional AI applications usually break work into small, explicit tasks. Consider a financial analysis workflow. An earlier system might be instructed to open a particular spreadsheet, calculate values in specific cells, and return the result. The human remains responsible for defining the procedure.</p><p>A capable agent can be given a much broader objective, such as producing a discounted cash flow analysis for a company and assessing whether its current valuation appears attractive. Completing that objective may require the agent to gather information, open files, perform calculations, identify errors, revise its work, and explain the conclusion.</p><p>The difference is significant:</p><ul><li>A chatbot responds to a request</li><li>A tool-using assistant performs a defined action.</li><li>A long-running agent pursues an outcome across multiple actions.</li></ul><p>This pattern applies far beyond finance. Agents can support healthcare administration, software development, research, compliance, customer operations, and many other forms of knowledge work. In each case, the value comes from delegating a complete result rather than a sequence of tiny instructions.</p><h3>Why Better Models Create Harder Infrastructure Problems</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ny182mP48DvrxYC2ZCSdwA.png" /></figure><p>More capable models reduce the amount of scaffolding needed to make an agent understand a task. However, they increase the importance of the infrastructure surrounding the model.</p><p>An agent working for several minutes or hours needs more than a good prompt. It needs durable state, secure tool access, controlled execution, error recovery, observability, and a reliable way to resume interrupted work. These are distributed systems and platform engineering problems.</p><p>One useful architectural pattern separates the agent’s reasoning loop from its execution environment.</p><p>The reasoning component, sometimes called the harness, runs on durable infrastructure. It maintains the conversation, tracks progress, and decides what should happen next. When the agent needs to execute code or interact with files, it creates a temporary sandbox. The action occurs inside that isolated environment, and the sandbox is removed when the work is complete.</p><p>This separation provides an important advantage. If a sandbox crashes or loses its connection, the entire agent does not have to disappear with it. The durable reasoning process can retain the task state, create a new environment, and continue.</p><h3>What an Agent Harness Actually Does</h3><p>At its simplest, an agent harness is a loop. It receives input, asks the model what to do, calls the required tool, returns the result to the model, and repeats the process.</p><p>Production systems add several layers around that basic loop:</p><ul><li><strong>Persistent state:</strong> The agent must remember its conversation, decisions, intermediate results, and unfinished work.</li><li><strong>Safe execution:</strong> Code and tool calls should run within controlled environments that limit potential damage.</li><li><strong>Credential management:</strong> The agent may need access to external systems without being allowed to view or expose raw credentials.</li><li><strong>Error recovery:</strong> Failed tool calls, broken connections, and invalid outputs should not terminate the entire task.</li><li><strong>Observability:</strong> Operators need records of what the agent attempted, which tools it used, and how it reached a result.</li><li><strong>Evaluation:</strong> A separate process may need to judge whether the output meets the required standard.</li></ul><p>The term “harness” is sometimes used too broadly, covering everything from the reasoning loop to an entire application. The useful distinction is that the core harness manages interaction with the model, while the surrounding platform provides execution, security, memory, connectivity, and monitoring.</p><p>Once these foundations are reliable, teams can experiment with more advanced coordination strategies. Multiple agents can review one another, specialize in different roles, or collaborate on a shared objective.</p><h3>Not Every Token Has the Same Job</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hRRpdWRSBIPBx3TZcbr66A.png" /></figure><p>AI cost is often reduced to the price of tokens, as if every token produced the same amount of value. In practice, the role assigned to a model can matter as much as the model’s price.</p><p>A smaller model may be inexpensive per token but consume more tokens while following an inefficient path or correcting repeated errors. A larger model may appear more expensive but solve the task accurately with fewer attempts. The relevant measure is therefore not only cost per token. It is the cost of achieving a correct business outcome.</p><p>Agent systems can also assign different jobs to different model calls:</p><ul><li><strong>Execution:</strong> One model performs the main task.</li><li><strong>Advising:</strong> A stronger model provides guidance when the executor reaches a difficult step.</li><li><strong>Grading:</strong> A second agent evaluates the result against a defined rubric and requests another attempt when necessary.</li><li><strong>Learning:</strong> Past sessions are reviewed to update memory, instructions, or reusable skills.</li></ul><p>This approach can produce better results without relying on the most expensive model for every step. The objective is to use the appropriate level of intelligence at the point where it creates the most value.</p><h3>Trust Requires Security and Visibility</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sd-UWOfhPXAS-HXxpOguoA.png" /></figure><p>Enterprises cannot deploy autonomous agents based on capability alone. Trust depends on two separate layers.</p><p>The first is architectural security. An agent that can access production systems or sensitive internal data must operate within boundaries defined by the organization. Sandboxes, restricted permissions, controlled network access, and secure credential injection help ensure that the agent can perform approved work without gaining unnecessary access.</p><p>The second is observability. Even when an agent is allowed to act, operators need to know whether it acted correctly. Logs, traces, tool-call histories, intermediate outputs, and evaluation results make the system auditable. They also help teams diagnose failures and improve performance.</p><p>Security answers the question, “What is the agent allowed to do?” Observability answers, “What did the agent actually do?” Both are necessary before meaningful autonomy can be granted.</p><h3>The Most Common Mistake: Automating the Existing Process</h3><p>Many organizations begin with an ambitious goal, such as automating an entire compliance or customer verification workflow. They then examine the existing human process and insert agents wherever a person appears slow or expensive.</p><p>This approach often fails because the original workflow was designed around human limitations, organizational history, and manual approval structures. Forcing an agent to imitate every step can preserve unnecessary complexity.</p><p>A better approach is to redesign the workflow around the capabilities of agents.</p><p>The large objective should first be divided into small, understandable units, similar to tasks that might be assigned to a new employee. Each unit can then be tested independently. After the components become reliable, they can be combined into a more autonomous process.</p><p>The new workflow may look very different from the old one. Instead of asking for human feedback after every step, an agent might complete the work, review its own output, and escalate only when confidence is low or a policy requires approval.</p><p>The goal is not to copy the human process more quickly. It is to design a better process for a system that can reason, use tools, and operate continuously.</p><h3>Start With Abstractions, Then Add Control</h3><p>Organizations in the early stages of adoption often focus too quickly on prompt caching, context engineering, orchestration, and infrastructure details. These concerns matter, but solving all of them before testing a useful workflow can delay learning.</p><p>A practical adoption path begins with a higher-level managed agent platform. This allows teams to test whether an agent can produce a valuable outcome without first building the entire execution system. As the use case matures, the organization can move toward lower-level controls for caching, context management, sandboxing, model selection, and custom orchestration.</p><p>Even experienced teams benefit from this approach. Rebuilding standard infrastructure for every agent rarely creates a competitive advantage. The most valuable customization usually occurs closer to the customer and the problem domain.</p><p>That is where domain expertise matters: defining what success looks like, supplying the right context, connecting the necessary tools, establishing evaluation criteria, and designing the user experience.</p><h3>The Interface Will Become More Human</h3><p>The first wave of generative AI placed chat boxes inside almost every product. Chat was familiar and easy to build, but it still required users to manage the interaction continuously.</p><p>The next generation of agents is likely to feel more like working with a capable colleague. The interface may remain inside familiar tools such as workplace messaging platforms, but much of the work will happen in the background. A user will describe the desired result, provide feedback when necessary, and receive completed work later.</p><p>This creates a new design challenge. People need simple ways to express goals, constraints, preferences, and quality standards. They also need mechanisms to steer work that continues while they are away.</p><p>Memory will play an important role. When an agent records preferences, corrections, and successful approaches, repeated interaction becomes more efficient. A correction should not disappear after one session. It should improve future behavior, provided that the memory remains transparent and controllable.</p><h3>AI Changes the Bottlenecks Inside Organizations</h3><p>Agents do more than accelerate individual tasks. They change which parts of an organization limit progress.</p><p>In a traditional software project, implementation may take weeks. Product managers, technical leads, and program managers use that time to align teams, resolve dependencies, and prepare decisions. When agents help engineers finish implementation in days, coordination and decision-making may become the slower part of the system.</p><p>This pushes roles toward their most essential responsibilities. Product managers must spend less time moving tickets and more time deciding which problems deserve attention. Technical leaders must define architecture, quality, and risk more clearly. Strategy becomes more important because execution becomes cheaper.</p><p>Rapid execution also supports a portfolio approach to product development. When prototypes can be built quickly, teams can test several informed hypotheses rather than placing every resource behind a single bet. This requires a higher tolerance for failed experiments, while maintaining strict standards for security and production reliability.</p><h3>The Competitive Advantage Moves Up the Stack</h3><p>As agent infrastructure becomes standardized, competitive advantage will move away from basic orchestration. Durable execution, sandboxing, memory, credential handling, and tool connectivity will increasingly become platform capabilities.</p><p>Differentiation will come from understanding users and problems better than competitors. Strong agent products will be defined by the quality of their workflows, evaluations, domain knowledge, and interfaces.</p><p>The central question for builders is therefore not, “How can every part of an agent stack be built from scratch?” It is, “Which parts directly create unique value for the customer?”</p><p>Long-running agents are turning AI from a conversational tool into an operational system. Models provide the intelligence, but infrastructure provides continuity, safety, and control. Organizations that understand both sides will be better positioned to move beyond impressive demonstrations and build agents that perform useful work in the real world.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=684846710fd4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Practical Guide to Using LLMs, Part 3: Modalities, Memory, and Customization]]></title>
            <link>https://medium.com/@itissaad25/a-practical-guide-to-using-llms-part-3-modalities-memory-and-customization-5707561c400f?source=rss-dd23210354df------2</link>
            <guid isPermaLink="false">https://medium.com/p/5707561c400f</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai-customization]]></category>
            <category><![CDATA[agentic-memory]]></category>
            <category><![CDATA[multimodal-ai]]></category>
            <category><![CDATA[llms-reasoning]]></category>
            <dc:creator><![CDATA[Saad]]></dc:creator>
            <pubDate>Wed, 02 Sep 2026 06:23:08 GMT</pubDate>
            <atom:updated>2026-09-03T09:19:41.147Z</atom:updated>
            <content:encoded><![CDATA[<h3>Voice, images, video, and the small features that decide whether any of this survives contact with daily use.</h3><p>Part 1 covered the model itself. Part 2 covered the tools wrapped around it. This part covers the two remaining layers: the modalities beyond text, and the quality-of-life features that turn an impressive demo into something used every day.</p><h3>Everything becomes tokens</h3><p>The reason a text model can handle audio and images at all comes down to one idea: <strong>any signal can be chopped up and quantized into tokens, and the model does not care where the tokens came from.</strong></p><p>For audio, the waveform is converted into a spectrogram showing which frequencies are present over time. That spectrogram is sliced into short windows, and each window is matched to the closest entry in a fixed vocabulary of, say, a hundred thousand possible audio chunks. The result is a sequence of audio tokens.</p><p>For images, the picture is divided into a grid of small patches. Each patch is matched to the closest entry in a vocabulary of possible patches. The result is a sequence of image tokens.</p><p>The network itself never learns that some tokens are text and others are sound or pixels. It models statistical patterns in a token stream. Only the encoder and decoder at the edges know how to turn audio and images into tokens and back again.</p><p>This is why multimodality arrived so quickly once it arrived at all. The modeling machinery did not need to change. Only the vocabulary did.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HSamY9Flo4Lvjv_90xzUiQ.png" /><figcaption><em>Audio and images are quantized into tokens and fed through the same network as text.</em></figcaption></figure><h3>Speech: the fake version and the real one</h3><p>There are two distinct things that get called voice mode, and confusing them leads to wrong expectations.</p><h3>Transcription and read-aloud</h3><p>The first version keeps the model purely textual and adds converters at each end. Speech is transcribed to text before it reaches the model, and the model’s text reply is read out by a separate text-to-speech system.</p><p>This is a productivity feature rather than a capability change, and it is a large one. Speaking is several times faster than typing for most people, and a substantial share of everyday queries do not need to be typed at all. On mobile, where typing is slowest, the share is higher still.</p><p>Mobile apps generally include a microphone button that does this. Desktop apps often do not, which is why system-wide dictation utilities have become popular among heavy users. These bind a key, listen while it is held or toggled, and paste transcribed text wherever the cursor is. The advantage over an in-app button is that the same key works in every application.</p><p>One limitation is worth planning around: <strong>transcription is weakest exactly where precision matters most.</strong> Library names, product names, code identifiers, and unusual proper nouns are frequently mangled. The workable pattern is to speak the prose and type the specifics.</p><p>For output, many apps offer a read-aloud control on individual responses. Availability varies, and system-wide text-to-speech utilities fill the gap where it is missing.</p><h3>Native audio</h3><p>The second version is different in kind. Here the audio tokens go directly into the model, and the model emits audio tokens directly back. No text is involved at any point. The transcript displayed on screen afterwards is a rendering of the conversation, not the medium of it.</p><p>This is what interfaces mean by “advanced voice” or similar labels, and it unlocks behavior that transcription cannot reach: changing the character of the voice on request, adopting an accent or a persona, speeding up or slowing down delivery, producing non-speech sounds, and responding to interruption naturally. Latency drops as well, because two conversion steps are removed.</p><p>Two observations from use. First, native voice modes tend to be noticeably more restrictive than the same provider’s text interface, refusing requests that the text model would answer, which can be an odd experience when the request is harmless. Second, providers differ substantially in how tightly they tune this, and some ship deliberately loose or persona-driven voice modes aimed at entertainment rather than assistance. Which behavior is preferable depends entirely on what the tool is being used for.</p><p>Availability moves quickly across pricing tiers, so it is worth rechecking rather than assuming.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bTTMbXBt-b6Zt7UfqvOrrg.png" /><figcaption><em>Two things get called voice mode. Only the second changes what is possible.</em></figcaption></figure><h3>Video input</h3><p>Video input is largely an extension of native voice on mobile: the camera runs, the model receives frames, and the conversation continues by voice while pointing at things.</p><p>In practice it identifies books from their covers, reads device displays and explains what the readings mean, recognizes posters and maps, and comments on the physical setup of a room. Whether the underlying system truly processes video or samples a frame or two per second is not obvious from the outside, and from a user’s point of view it does not matter much.</p><p>The interesting thing about this feature is who it serves. Experienced users with specific technical questions rarely reach for it. It is far more compelling for people who find typing a barrier, because it removes the requirement to describe something in words before asking about it. Pointing and asking is the oldest interface there is.</p><h3>Images as input</h3><p>Image input is one of the most immediately useful capabilities available, and it rewards a specific technique.</p><p><strong>Transcribe first, then analyze.</strong> Rather than asking a question about a photograph directly, ask the model to transcribe what it sees into text, usually a table. Then confirm the transcription is right, and only then ask the analytical question.</p><p>This costs one extra turn and buys two things. It makes visual misreadings visible immediately, before they propagate into the answer. And it moves the content into text in the context window, where the model handles it more reliably than it handles the image.</p><p>Cases where this works well:</p><ul><li><strong>Ingredient and nutrition labels.</strong> Photograph the label, transcribe it, then ask what each ingredient is, which are well studied and which are not, and which are functional rather than cosmetic. The exercise is often uncomfortable, in that many ingredients in everyday food and cosmetic products turn out to serve appearance rather than function.</li><li><strong>Lab results.</strong> A long clinical PDF full of numbers and reference ranges is hard to interpret unaided. Screenshotting each section, confirming the transcription, and asking for interpretation produces something considerably more useful than the original document. This is a domain where model knowledge is likely to be strong, because reference ranges and their meaning are extremely well represented in text, which makes it a reasonable first pass. It remains a first pass, and the results still belong in a conversation with a doctor. Its real value is producing informed questions to bring to that conversation.</li><li><strong>Mathematical expressions.</strong> Photograph an expression, have it transcribed into typed notation, then work with the text.</li><li><strong>Anything confusing on screen.</strong> A screenshot is a fast way to ask about a diagram, an error message, an unfamiliar interface, or a joke whose reference is not landing.</li></ul><p>The mechanical enabler is the screenshot shortcut. On macOS, Control-Shift-Command-4 copies a selected region straight to the clipboard, which then pastes into a chat. A one-second capture plus a paste replaces a paragraph of description.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DlpOwQJv_K5vtMHjU8DEEA.png" /><figcaption><em>One extra turn makes a visual misreading visible before it reaches the answer.</em></figcaption></figure><h3>Images and video as output</h3><p>Image generation is the reverse direction, and in most current products it is not one model doing everything. A request produces a caption internally, that caption is sent to a separate image generation model, and the resulting image is returned. Native image generation inside the language model exists and is spreading, but a two-model pipeline remains common. The distinction matters mainly because it explains why generated images sometimes miss details that were clear in the conversation: only the caption made it across.</p><p>The practical uses are unglamorous and real: illustrations for articles, thumbnails, icons, diagrams, and placeholder assets. Several competing products exist, they have different house styles, and moving between them for different aesthetics is normal.</p><p>Video generation has advanced rapidly and is developing faster than any summary can track. Multiple systems now produce short clips of high quality from text prompts, with meaningful differences in style, coherence, and motion between them. For anyone doing creative work, comparing a few current options directly is more informative than reading about them.</p><h3>Generated audio explainers</h3><p>One further application deserves attention because it fits a specific gap. Some tools take arbitrary uploaded sources, papers, web pages, raw notes, and generate a conversational audio explainer about them, typically running twenty to forty minutes, in the format of two hosts discussing the material.</p><p>The output is not a substitute for reading the source. Its value is in covering topics too narrow for anyone to have made real content about. A recent paper in an unfamiliar field, a set of internal notes, or a niche interest can all become listening material for a walk or a drive. Some implementations allow interrupting to ask a question mid-conversation.</p><p>Treated as passive orientation rather than as authority, it fills a real gap. Treated as a source, it inherits every hallucination risk discussed earlier with none of the citations.</p><h3>Memory</h3><p>Every conversation begins with an empty context window, and starting a new chat wipes it. Memory features work around this by maintaining a separate store of notes about the user, which is prepended to conversations so the model has access to it.</p><p>The store is a list of short text strings. Entries are added when the model decides something is worth keeping, or when asked directly with a phrase like “remember this.” Most implementations expose the store for review, editing, and deletion, which is worth using at least once to see what has accumulated.</p><p>The effect builds slowly and is easy to underestimate at first. Preferences, context about ongoing projects, working style, and stated opinions accumulate, and responses gradually become better fitted without any deliberate effort. Recommendations in particular improve, because taste is exactly the kind of thing that is tedious to restate and valuable to retain.</p><p>Two cautions. Memory can carry a wrong or outdated inference forward indefinitely, which is why the edit control matters. And anything sensitive that gets written into the store persists across conversations until removed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NHHXSfPMncRSHuOrGUBwOQ.png" /><figcaption><em>Chats still start empty. The memory store is written in at the front of each one.</em></figcaption></figure><h3>Custom instructions</h3><p>Custom instructions are a block of standing text applied to every new conversation. They are the highest-leverage setting in most of these products and the least used.</p><p>Things worth putting there:</p><ul><li><strong>Tone.</strong> A direct instruction to drop corporate hedging and speak plainly changes the reading experience of every future response.</li><li><strong>Depth.</strong> A preference for explanation and background rather than bare answers turns routine questions into something more useful.</li><li><strong>Context about the person.</strong> Background, field, and level of expertise let the model calibrate rather than guess.</li><li><strong>Persistent conventions.</strong> For language learners, specifying a required level of formality removes a recurring correction. The same applies to code style, units, date formats, and citation preferences.</li></ul><p>Anything corrected more than twice in different conversations belongs in custom instructions.</p><h3>Custom assistants, and why few-shot prompting works</h3><p>Most products now offer saved, configured assistants under names like custom GPTs, projects, or gems. The concept is simple and frequently misunderstood: <strong>nothing new is happening under the hood. A prompt is being saved so it does not have to be retyped.</strong></p><p>That is still valuable, because a good prompt for a repeated task is long, and retyping it or hunting for it in old conversations is exactly the friction that stops people from using a workflow they know is better.</p><p>Language learning produces particularly clear examples.</p><p><strong>A vocabulary extractor.</strong> Given a sentence in the target language, return the vocabulary in dictionary form, one item per line, in a format that pastes directly into a flashcard application. Turning a sentence encountered in the wild into study material becomes a single paste.</p><p><strong>A detailed translator.</strong> Given a sentence, translate it in full, then break the translation down piece by piece, showing how each fragment of the original maps into the target language. This is dramatically more useful than a conventional translation service, which returns a result with no visible structure and no way to ask what happened to a particular particle. The ability to ask follow-up questions about the translation is the whole point.</p><p><strong>A subtitle helper.</strong> Given a screenshot of a video with burned-in subtitles, read the text from the image, translate it, and break it down. This chains three capabilities into one action and works for any content where the subtitles cannot be copied.</p><h3>The construction detail that matters</h3><p>Opening the configuration of any of these reveals only an instruction block. The structure that makes those instructions work is worth stating explicitly, because it applies to prompting in general.</p><p><strong>Describe the task, then show several worked examples.</strong></p><p>A description alone is a zero-shot prompt: perform this task, with no demonstration. Adding two to five complete input and output pairs makes it a <strong>few-shot prompt</strong>, and the improvement in consistency is reliable enough to treat as a default technique.</p><p>When the examples are long, wrapping each in tags makes the boundaries unambiguous:</p><pre>&lt;example&gt;<br>  &lt;input&gt;...&lt;/input&gt;<br>  &lt;output&gt;...&lt;/output&gt;<br>&lt;/example&gt;</pre><p>The parallel with teaching a person is close. An explanation of a task communicates the goal. A few worked examples communicate the standard, the edge cases, and the format, and both people and models pick up more from the demonstration than from the description.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SkuXWrPPeHqLAJKue7OpiA.png" /><figcaption><em>A description sets the goal. Worked examples set the format, which is what keeps repeated output consistent.</em></figcaption></figure><h3>Putting it together</h3><p>The landscape is a zoo, and it changes monthly. A small number of questions cover most of the decisions:</p><p><strong>Which model is answering?</strong> Check the tier and the selector. A larger model brings more knowledge, better writing, and fewer mistakes. A smaller one is faster and usually adequate for routine work.</p><p><strong>Does this need thinking?</strong> Try the fast model first. Escalate to a reasoning model for mathematics, code, debugging, and multi-step logic, or whenever a first attempt has failed.</p><p><strong>Does this need a tool?</strong> Recent or changing information needs search. Exact numbers need code execution. A specific document needs to be uploaded rather than described. Charts need a data analysis feature. Professional coding belongs in an editor or agent, not a chat box.</p><p><strong>Which modality is fastest here?</strong> Speaking beats typing for prose. A screenshot beats describing something in words. Read-aloud is convenient when the reply is long.</p><p><strong>Is this repeatable?</strong> Anything done more than twice belongs in custom instructions or a saved assistant, with worked examples included.</p><p><strong>What still needs checking?</strong> Fresh claims need their sources opened. Numbers need their code read. Anything consequential needs a second opinion, either from another model or from a primary source.</p><p>Underneath all of it, the same object from Part 1 is still doing the work: a large file of parameters predicting the next token, with a great deal of useful machinery arranged around it. The machinery is what changes every few months. The habit of knowing which pieces are switched on, and which parts of the answer still need verifying, is what keeps the output trustworthy while everything else moves.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5707561c400f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Practical Guide to Using LLMs, Part 2: Giving the Model Tools]]></title>
            <link>https://medium.com/@itissaad25/a-practical-guide-to-using-llms-part-2-giving-the-model-tools-39c22d3de6fc?source=rss-dd23210354df------2</link>
            <guid isPermaLink="false">https://medium.com/p/39c22d3de6fc</guid>
            <category><![CDATA[llm-applications]]></category>
            <category><![CDATA[ai-agents-in-action]]></category>
            <category><![CDATA[agentic-harness]]></category>
            <category><![CDATA[agentic-tool]]></category>
            <dc:creator><![CDATA[Saad]]></dc:creator>
            <pubDate>Mon, 31 Aug 2026 07:43:22 GMT</pubDate>
            <atom:updated>2026-09-03T09:21:02.454Z</atom:updated>
            <content:encoded><![CDATA[<h3>Search, deep research, documents, code execution, and generated apps. Every one of them works by writing something new into the context window.</h3><p>Part 1 described the model as a self-contained file that maps tokens to tokens, carrying compressed knowledge from pre-training and an assistant persona from post-training. That model cannot browse, cannot calculate, cannot read a file, and does not know today’s date.</p><p>Tools close those gaps. The mechanism is consistent enough to state once: <strong>the model emits a special token that the surrounding application recognizes as a tool call, the application pauses generation, runs something, writes the result back into the context window as text, and hands control back to the model.</strong> Search, code execution, and file reading are all variations on that single pattern.</p><p>Knowing the pattern makes the failure modes predictable. If a tool did not run, the model answered from memory. If the tool returned something wrong, the model will build confidently on top of the wrong thing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HT3eWS5zWBPzDxEuSzYuhg.png" /><figcaption><em>Every tool follows the same five steps. Only what happens at step three changes.</em></figcaption></figure><h3>Internet search</h3><p>The old workflow for a question like “when does the next season of a show air” was to search, open five links, dismiss the ads, and piece together an answer from pages of varying quality.</p><p>Search-enabled models compress that loop. The model issues one or more queries, the application fetches the pages, the text of those pages goes into the context window, and the model answers by reference to text that is now sitting in its working memory rather than by recalling anything.</p><p>This is why search is not a nice-to-have for recent information. It is the only mechanism available. A release date decided three weeks ago cannot be in the parameters, and no amount of prompting will extract it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mnYFwv9VrDZ3aCT1f9H07w.png" /><figcaption><em>Search copies whole pages into the context window and answers from text the model can now read.</em></figcaption></figure><p><strong>What search is well suited to:</strong> anything answerable by running a normal web search and reading the top few results. Current prices and market status. Whether a company offers a particular product right now. What a trending story is actually about. Recent announcements. Niche details that were probably too rare to survive pre-training. Anything where the phrasing includes “latest,” “current,” or “still.”</p><p><strong>Three practical notes:</strong></p><p><em>Some apps decide for themselves whether to search, and some need to be told.</em> Models are increasingly good at recognizing that a question is about recent events and searching without being asked, but the behavior varies by app and by model. When a question clearly needs fresh information, ticking the search option explicitly removes the uncertainty.</p><p><em>Not every model has the tool.</em> Within the same provider, one model in the dropdown may have search wired in while another does not. A model without search will either answer from its knowledge cutoff and say so, or answer from its knowledge cutoff and not say so. The second case is the dangerous one.</p><p><em>Citations are the point.</em> A search-based answer that cites its sources can be verified in about thirty seconds. The pages are right there. Skipping that check on anything consequential wastes the main advantage the tool provides.</p><h3>Deep research</h3><p>Deep research is what happens when search and thinking are combined and allowed to run for a long time. Instead of one round of queries, the model runs many, reads dozens of pages and papers, thinks between rounds about what is still missing, and produces a structured report with references. A single run typically takes five to thirty minutes.</p><p>Most major providers now offer some version of this, usually on higher tiers, sometimes under a slightly different name.</p><p><strong>Where it earns its time:</strong></p><ul><li>Understanding an unfamiliar compound, ingredient, or supplement, including mechanism, evidence in animal models, evidence in humans, and safety concerns</li><li>Comparing products on a dimension that requires reading rather than a spec sheet, such as which of two browsers actually handles privacy better and why</li><li>Surveying the state of a research area before deciding whether to go deeper</li><li>Building a comparison table across many entities</li></ul><p><strong>Where it fails, and the failure is instructive.</strong> Asked for a table of major labs in a particular field with headcounts and funding, these reports routinely produce something that looks authoritative and is quietly wrong: a major organization missing entirely, an unrelated one included, numbers that are close but not right. The structure of the output projects far more confidence than its contents deserve.</p><p>The rule that follows is not complicated. <strong>Treat a deep research report as a well-organized first draft and a reading list, never as a verified result.</strong> The real value is in the references. Read the ones that matter, confirm the claims that will be acted on, and ask follow-up questions in the same conversation while all the material is still in the context window.</p><p>Clarifying questions at the start are worth answering carefully. Most implementations ask what scope, sources, and comparisons are wanted before beginning, and a few extra words there measurably improve what comes back thirty minutes later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_qnYu9A8UVH99UXY7MmDEQ.png" /><figcaption><em>Deep research alternates searching and thinking for as long as it takes, then writes a report that reads more confidently than it should.</em></figcaption></figure><h3>Putting documents into the context window</h3><p>Search is one way to get external text into the working memory. Uploading a file is the other, and it is more precise because the source is chosen deliberately.</p><p>Dragging a PDF into a chat generally results in the text being extracted and written into the context window. Some caveats apply: figures and images may be discarded or handled less well than the text, layout can be lost, and very long documents can exceed the window and be rejected or truncated. What is left is usually enough to work with.</p><p>Two applications of this are worth calling out because they change how the underlying activity feels.</p><p><strong>Reading papers.</strong> Uploading a paper and opening with a request for a summary, then asking questions section by section while reading, makes technical material from an unfamiliar field far more approachable. The model is not recalling the paper. It is reading the copy that was just placed in front of it, which is why it can be pushed on specific sentences.</p><p><strong>Reading books.</strong> Older texts are the strongest case. Pasting a chapter of a public domain work into the chat, asking for a summary, then reading the chapter with the ability to ask about any confusing passage, dramatically improves both comprehension and retention. Eighteenth century economics, Shakespeare, primary historical sources: material that would otherwise be abandoned in the first few pages becomes tractable, because confusion can be resolved the moment it appears instead of accumulating.</p><p>The reason this specifically requires uploading, rather than just naming the book, is worth being clear about. A model may know a great deal <em>about</em> a famous book while having no reliable recall of the exact contents of chapter three. Asking about the chapter without providing it invites a plausible answer assembled from general knowledge. Pasting the chapter in removes the guesswork.</p><p>The tooling here remains clumsy. There is no widely available reader that lets a passage be highlighted and questioned in place, so the workflow is still copy, paste, and switch windows. It is worth the friction.</p><h3>Code execution</h3><p>Ask a model to multiply thirty by nine and it will answer two hundred seventy, correctly, from memory. Nothing was calculated. The answer was recalled, the way a person recalls a times table.</p><p>Ask it to multiply two ten-digit numbers and memory has nothing to offer. A model without tools will produce a number that is close, formatted confidently, and wrong in the middle digits.</p><p>Models with a code interpreter handle this differently. They recognize that the problem cannot be done by recall, write a short program, emit the tokens that tell the application to run it, pause, receive the output as text, and report it. This is arithmetic that is actually performed rather than estimated.</p><p>Which models have this varies, and the variation is easy to miss because the failure is silent. A model without an interpreter does not decline. It guesses. Anyone relying on model-produced numbers should confirm, once, that the model in use actually runs code, and should treat unverified arithmetic from a model without that capability as unreliable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BUzv4FzYwPJKWdQJGVGeTw.png" /><figcaption><em>Small products are recalled. Large ones have to be computed, and a model without an interpreter guesses instead of declining.</em></figcaption></figure><h3>Data analysis, and the junior analyst problem</h3><p>Code execution combined with charting turns a chat window into something like a junior data analyst. Data can be gathered (ideally with search, so the numbers have sources), organized into a table, plotted, fitted, and extrapolated, with each step taking seconds.</p><p>It is a strong capability, and it comes with a specific hazard: <strong>the code makes assumptions that the prose does not report.</strong></p><p>A representative case. A table of company valuations by year, with one early year marked as unknown. The generated plotting code silently substitutes a specific placeholder value for the unknown year, which changes the fitted trend line. Nothing in the written answer mentions this. It is visible only in the code.</p><p>A second, worse case from the same session. A trend is extrapolated forward several years. The prose reports one figure. The variable actually computed by the code holds a figure an order of magnitude different. Asked to print the variable directly, the model produces the correct value and acknowledges the mistake. The original number was simply fabricated in the write-up while correct code ran underneath it.</p><p>The lesson is not to avoid the feature. It is that <strong>the generated code is part of the answer and needs to be read.</strong> Where the person cannot read the code, the numbers should be treated as illustrative rather than as results, and any figure that will be quoted elsewhere should be recomputed independently. This is a good reason to be cautious about recommending automated data analysis to people who are not able to check the work.</p><h3>Generated mini apps and diagrams</h3><p>Some interfaces can run generated front-end code directly in the browser, which produces a different kind of output: a small, single-purpose application built on request.</p><p>A worked example. Paste a few paragraphs of source text, ask for twenty flashcards, then ask for a small app to drill them. What comes back is a working flashcard interface with the questions hard-coded into it, running immediately, with reveal, scoring, shuffle, and reset.</p><p>This inverts the usual relationship with software. The normal pattern is that engineers build a general application and users adapt their data to it. Here the application is written for one person and one dataset, and then discarded. There is no backend, no database, and no persistence, which limits what is possible and also removes almost all of the setup cost.</p><p>The most consistently valuable use of this capability is more modest: <strong>diagrams.</strong> Asking for a conceptual diagram of a chapter, a codebase, or an argument typically produces a diagram definition (Mermaid is common) that is rendered inline. The result lays out the structure of an argument spatially: the central claim, the supporting comparisons, the examples, and how they connect.</p><p>For anyone who thinks visually, seeing the shape of an argument is a different and often faster form of understanding than reading a summary of it. Chapters, papers, source files, and processes all work.</p><h3>Where serious coding actually happens</h3><p>Most professional coding with a model no longer happens in a chat window. Copying snippets back and forth is slow, and the chat has no view of the project.</p><p>The tools that replaced it are editors and command-line agents that run locally, read the actual files on disk, and call a model through an API in the background. The person never visits the provider’s website. The tool assembles the relevant context automatically.</p><p>The capability ladder inside these tools has climbed quickly:</p><ol><li><strong>Edit this line or selection</strong> according to an instruction</li><li><strong>Explain this block of code</strong> with full project context available</li><li><strong>Complete this task</strong>, where an agent decides which files to open, edits across all of them, runs commands, installs packages, and iterates</li></ol><p>The third level is what the term <strong>vibe coding</strong> describes: handing over the objective rather than the implementation, and reviewing the outcome instead of the steps. A short request such as adding a visual effect when a game is won can result in a dependency being installed, several files being edited, styling being added, an asset being fetched, and the change being ready to test, with the person mostly approving commands.</p><p>Two honest observations about working this way.</p><p><strong>Verification does not disappear, it moves.</strong> The unit under review shifts from the line to the change set. Reading a diff and confirming behavior matters more than watching each edit.</p><p><strong>The floor is still ordinary programming.</strong> The files are on disk in a normal language and can be opened and edited by hand at any point. Agent-driven development works well until it stops working, and the fallback is the same work that was always there. That fallback is only available to someone who can read the code, which is the strongest current argument for continuing to learn how.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Iqdw9uTbDzNu-vlK3Loc-w.png" /><figcaption><em>As the model writes more, the unit a person reviews gets larger. It never disappears.</em></figcaption></figure><h3>A short checklist for tools</h3><p>Before accepting an answer, three questions cover most of the risk:</p><ul><li><strong>Did this need fresh information, and was search actually used?</strong> If the answer depends on the current state of the world and no sources were cited, it came from the knowledge cutoff.</li><li><strong>Did this need exact computation, and was code actually run?</strong> If numbers matter and no program appeared, they were estimated.</li><li><strong>If code did run, what did it assume?</strong> Placeholder values, dropped rows, and silent type coercions live in the code and not in the prose.</li></ul><p>Part 3 moves past text entirely, into voice, images, and video, and covers the memory, custom instruction, and custom assistant features that make daily use less repetitive.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39c22d3de6fc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Practical Guide to Using LLMs, Part 1: What You Are Actually Talking To]]></title>
            <link>https://medium.com/@itissaad25/a-practical-guide-to-using-llms-part-1-what-you-are-actually-talking-to-ae2abfbb7ca9?source=rss-dd23210354df------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae2abfbb7ca9</guid>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[conversations]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[internal-working]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Saad]]></dc:creator>
            <pubDate>Mon, 31 Aug 2026 07:40:41 GMT</pubDate>
            <atom:updated>2026-09-03T09:22:22.928Z</atom:updated>
            <content:encoded><![CDATA[<h3>Before tools, before voice, before agents, there is a file on a disk predicting the next token. Understanding that one fact changes how every other feature makes sense.</h3><p>The chat box is the most misleading interface in modern software. It looks like a search bar and behaves like a conversation, which encourages two opposite mistakes: treating the model as a database that returns facts, or treating it as a person who knows things. It is neither, and the gap between those two intuitions is where most bad outcomes come from.</p><p>This first part covers the entity behind the box. Part 2 covers the tools that get bolted onto it. Part 3 covers modalities and the quality-of-life features that make the whole thing usable day to day.</p><h3>The context window is the entire conversation</h3><p>Clicking “new chat” starts a token sequence from scratch. Tokens are the small chunks of text that models read and write, roughly a word or a fragment of one.</p><p>The user writes tokens into that sequence. Pressing enter hands control to the model, which appends its own tokens until it emits a special token meaning “done,” at which point control returns to the user. Both sides are writing into the same one-dimensional stream.</p><p>That stream is the context window, and it functions as the model’s working memory. Anything inside it is directly available. Anything outside it does not exist as far as this conversation is concerned. Every uploaded file, every search result, every prior turn either lives in that window or has no effect on the answer.</p><p>This single mechanic explains most of what follows. Search tools work by writing web pages into the window. File uploads work by writing documents into the window. Memory features work by quietly prepending saved notes to the window. It is all the same move.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lBDB7-COZzVQXRV8pLiLsg.png" /><figcaption><em>A conversation is a single token sequence that both sides write into. Everything the model can use lives inside it.</em></figcaption></figure><h3>Where the knowledge came from</h3><p>The model itself is produced in two broad stages.</p><p><strong>Pre-training</strong> takes an enormous quantity of internet text, converts it to tokens, and trains a neural network to predict the next token in a sequence. In the process of getting good at that prediction task, the network absorbs a large amount of knowledge about the world. That knowledge ends up compressed into the network’s parameters, which is to say into a large file of numbers sitting on a disk.</p><p>A useful mental image is a lossy zip file of the internet. The compression is not exact and cannot be, because there is far more text on the internet than there is room in the parameters. What survives is something closer to the gist. Facts that appear thousands of times survive well. Facts that appear twice may not survive at all.</p><p>Pre-training is expensive. It costs a great deal of money and takes months of compute, so it happens infrequently. The consequence is the <strong>knowledge cutoff</strong>: the model’s built-in knowledge stops at whatever point its pre-training data stopped. Anything more recent has to be supplied from outside.</p><p><strong>Post-training</strong> is much cheaper and comes second. Here the training data is swapped for conversations, many of them written or curated by human labelers. This is where the model learns to behave as an assistant that answers questions, rather than as an internet document generator that continues whatever text it was given. Tone, format, refusal behavior, and helpfulness are all shaped in this stage.</p><p>The result combines both: knowledge from pre-training, personality and format from post-training.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r0gGRyuDDNv_Ue1rlcGISw.png" /><figcaption><em>Pre-training supplies the knowledge and fixes the cutoff date. Post-training supplies the assistant persona.</em></figcaption></figure><p>A fair self-introduction for a base chat model would be something like: a large file of parameters, holding a hazy recollection of the internet as it existed some months ago, with a personality assembled by example.</p><h3>Three practical consequences</h3><p><strong>Recall is probabilistic and follows frequency.</strong> Information that appeared constantly online is recalled well. Information that appeared rarely is recalled badly, and the model will often produce a plausible answer anyway rather than reporting the gap. This is what hallucination usually looks like in practice: not wild invention, but confident approximation in a thin area.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wmq_OLyoos4RXdxC_3VM7Q.png" /><figcaption><em>How often something appeared in training text predicts how well it survived. The model does not report which side of the curve an answer came from.</em></figcaption></figure><p><strong>Recency is a systematic blind spot.</strong> Release dates, current prices, this quarter’s product lineup, who currently holds a job, what changed in a library last month: none of it is reliably in the parameters. These questions need a search tool, covered in Part 2.</p><p><strong>Nothing else is included by default.</strong> A raw model has no calculator, no code interpreter, no browser, no file system, no clock. Send it tokens, receive tokens back. Every additional capability discussed later in this series is something an application layer wraps around that core loop.</p><p>None of this makes the model unreliable in general. It makes it reliable in a specific shape. Questions like the caffeine content of a standard espresso shot, or the active ingredients in a common over-the-counter cold medicine, are well suited to it: the information is stable, it is repeated across thousands of pages, and the stakes of a small error are low. Questions about last week’s news, or a niche technical spec, or a number that will be acted on financially or medically, are not.</p><p>A simple filter: <strong>stable, common, low stakes</strong> points toward trusting the answer. Any of those three flipping points toward verification, a tool, or a primary source.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-VqxinuP64qD3eqBmsYYCg.png" /><figcaption><em>Three gates a question passes before its answer can be taken at face value.</em></figcaption></figure><h3>Keep the context window clean</h3><p>The tokens in the window are a finite and somewhat expensive resource, in two distinct ways.</p><p>The first is quality. A long window filled with unrelated material acts as a distraction. The model is drawing on everything in that working memory when it predicts the next token, and irrelevant earlier content can pull answers off course. Accuracy on the current question tends to degrade as unrelated context accumulates.</p><p>The second is cost and speed. More tokens in the window means more computation per token generated, so long conversations get gradually slower and more expensive.</p><p>The habit worth building is simple: <strong>when the topic changes, start a new chat.</strong> Wiping the window costs nothing and resets both problems. When earlier context is actually relevant, keep it. When it is just history, drop it.</p><h3>Know which model is answering</h3><p>Every provider offers a range of models at different prices, and the interface does not always make it obvious which one is in use. Logged-out or free-tier sessions frequently route to a smaller model, sometimes without saying so.</p><p>The difference between a large and a small model is not cosmetic. Larger models generally have more world knowledge, better writing, more creativity, better handling of long and complicated instructions, and a lower hallucination rate. Smaller models are faster and cheaper and are entirely adequate for summarizing, reformatting, drafting, and simple lookups.</p><p>Two things are worth doing:</p><ol><li><strong>Check the model selector before any task that matters.</strong> Most apps show the current model in a dropdown near the top of the conversation.</li><li><strong>Make the price tradeoff deliberately.</strong> For casual use, the free or entry tiers are usually fine. For professional use where the output feeds into real work, the cost of a subscription is small next to the cost of an hour spent fixing a weak answer.</li></ol><p>The same logic applies across providers. ChatGPT, Claude, Gemini, Grok, and others all publish tiered plans with different models and different rate limits at each tier. They are not interchangeable, and the tier determines what is actually being used.</p><h3>Thinking models</h3><p>A third training stage sits after pre-training and post-training: <strong>reinforcement learning on problems with checkable answers</strong>, mostly mathematics and code.</p><p>The idea is that the model practices on large collections of problems and is rewarded for reaching correct solutions. Over many attempts it discovers strategies that improve its own success rate. Those discovered strategies look remarkably like an inner monologue: trying an approach, noticing a contradiction, backtracking, re-examining an earlier assumption, checking the result.</p><p>The important detail is that these strategies were not hand-written by humans. Nobody can specify in advance what the ideal thinking process should be for a given model, because it depends on what that model already knows and where it tends to go wrong. Reinforcement learning lets the model find a process that works for itself. The approach was described publicly in DeepSeek’s work on incentivizing reasoning through reinforcement learning, and every major lab now ships models trained this way.</p><p>In the interface this shows up as a toggle or as a separate model family, labeled with words like “thinking,” “reasoning,” or “extended.” Turning it on means the model emits a long internal chain of tokens before answering, which can take anywhere from a few seconds to several minutes.</p><p><strong>When it helps:</strong> mathematics, debugging, algorithm design, multi-step logic, anything where a subtle error early on ruins the answer, and any problem where a first attempt has already failed.</p><p><strong>When it does not:</strong> factual lookups, summarization, rewriting, translation, brainstorming, travel suggestions. There is no benefit in waiting a minute for a list of restaurant ideas.</p><p>A reasonable default is to start with the fast model and escalate. If the answer looks thin, wrong, or superficial, resend the same prompt to a thinking model rather than arguing with the fast one. The difference on hard problems is frequently the difference between a list of things to check and the actual bug.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qGPTwOR94cRhD3ujopw9mg.png" /><figcaption><em>A reasoning model spends its extra minutes emitting a private stream of attempts before it answers.</em></figcaption></figure><h3>Asking more than one model</h3><p>Different models fail in different places. A debugging prompt that defeats one provider’s flagship model is often solved by another provider’s mid-tier model, and the reverse happens just as often.</p><p>For decisions of any weight, sending the same prompt to two or three different providers is cheap and informative. Agreement raises confidence. Disagreement flags exactly where verification is needed, which is more useful than a single confident answer that happens to be wrong. Some people treat this as a standing habit and describe the set of models they consult as a council.</p><p>The practical version: keep two apps open. Use one by default, and reach for the second when the first gives an answer that matters.</p><h3>Where this leaves things</h3><p>So far the model is a self-contained file that maps tokens to tokens, holding compressed and slightly stale knowledge, wearing an assistant persona, and optionally able to think for longer before answering.</p><p>That is already useful for a large class of questions, and useless for another large class: anything recent, anything requiring exact computation, anything requiring a specific document the model has never seen.</p><p>Part 2 covers how those gaps get closed, by giving the model tools: internet search, deep research, document uploads, code execution, and the coding environments where most of the real work now happens.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae2abfbb7ca9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fine-Tuning Meta’s Muse Glimmer 30B for Function Calling — Entirely on One GPU]]></title>
            <link>https://medium.com/@itissaad25/fine-tuning-metas-muse-glimmer-30b-for-function-calling-entirely-on-one-gpu-5c62bc1a4aa6?source=rss-dd23210354df------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c62bc1a4aa6</guid>
            <category><![CDATA[llm-tool-calling]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[meta-ai]]></category>
            <category><![CDATA[llm-finetuning]]></category>
            <category><![CDATA[muse-glimmer]]></category>
            <dc:creator><![CDATA[Saad]]></dc:creator>
            <pubDate>Mon, 24 Aug 2026 06:24:41 GMT</pubDate>
            <atom:updated>2026-08-24T06:24:41.717Z</atom:updated>
            <content:encoded><![CDATA[<h3><em>A local LoRA run that teaches a 30B agentic model to emit exactly the tool call your parser expects, and nothing else.</em></h3><p>On August 10th, Meta Superintelligence Labs released <strong>Muse Glimmer</strong>, a 30-billion-parameter dense model under Apache 2.0. It’s distilled from their larger closed model, Muse Spark, and it’s built specifically for the agent loop: multi-step reasoning, tool use, failure recovery, and long-running sessions. It’s multimodal, and the whole point of it is that it runs on a single consumer GPU.</p><p>So here’s a fair question: <strong>if the model is already trained for tool use, why fine-tune it for tool calling?</strong></p><p>Because “good at tool use” and “reliably emits the exact JSON my dispatcher can execute” are different properties. The base model understands your intent perfectly and then wraps the answer in a friendly sentence, or fences it in triple backticks, or calls the parameter city when your schema says location. Every one of those is a parse failure in production, and every one gets papered over with regex until the regex becomes the system.</p><p>Fine-tuning doesn’t make the model smarter here. It makes it <em>terser and more literal</em> — it collapses the space of acceptable outputs down to one. That’s a modest goal, which is exactly why a small LoRA on a few thousand examples can achieve it.</p><p>Everything below runs locally. No API keys, no cloud training.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o4N4r0EcxZAuONB8ZdS5Qw.png" /><figcaption><em>The whole run, end to end.</em></figcaption></figure><h3>The stack</h3><ul><li><a href="https://unsloth.ai/docs/models/muse-glimmer/train"><strong>Unsloth</strong></a> — patched kernels and memory tricks for the fine-tune. Their numbers for this model are roughly 1.5× faster training and about half the VRAM versus a standard FlashAttention-2 setup.</li><li><strong>Hugging Face </strong><strong>datasets</strong> — data loading and reshaping.</li><li><strong>TRL’s </strong><strong>SFTTrainer</strong> — the training loop.</li><li><strong>Salesforce/xlam-function-calling-60k</strong> — 60,000 execution-verified function calls spanning 3,673 APIs across 21 domains, generated by the APIGen pipeline. Every example was checked for format, actually executed, and semantically verified, which makes it unusually clean ground truth.</li></ul><p>Hardware: a single 24GB card is comfortable. Unsloth reports the model fitting for training in about 20GB.</p><h3>Step 0: Two things that will block you</h3><p><strong>The dataset is gated.</strong> You have to accept the terms on the dataset page while logged in, then authenticate locally. Skipping this produces a confusing 401 during load_dataset.</p><pre>pip install unsloth<br>hf auth login</pre><p><strong>The dataset ships JSON as strings, not objects.</strong> The query, tools, and answers columns are all serialized text. If you forget to json.loads them, you&#39;ll silently train on stringified Python reprs with single quotes, and the model will faithfully learn to emit invalid JSON. Ask me how I know.</p><h3>Step 1: Load the model</h3><pre>from unsloth import FastModel<br>import torch</pre><pre>MODEL = &quot;unsloth/Muse-Glimmer-30B-unsloth-bnb-4bit&quot;</pre><pre>model, tokenizer = FastModel.from_pretrained(<br>    model_name        = MODEL,<br>    max_seq_length    = 2048,<br>    load_in_4bit      = True,<br>    full_finetuning   = False,<br>    offload_embedding = True,<br>    text_only         = True,<br>)</pre><p>Three of these deserve a note.</p><p>max_seq_length = 2048. This is the one I&#39;d flag hardest. Tool-calling prompts are long — you&#39;re pasting several full JSON schemas into every single example, each with parameter types and descriptions. My first run at 1024 silently truncated roughly a fifth of the dataset, which meant the model was learning to answer from <em>partial</em> tool lists. Measure your token lengths before you pick this number.</p><p>text_only = True. Muse Glimmer has a perception encoder for vision. We&#39;re not using it, so we skip loading it and save the memory. Unsloth&#39;s own guidance is to leave the vision components frozen unless your data actually needs them.</p><p>offload_embedding = True. Keeps the token embedding table in CPU RAM and only moves the rows a batch actually looks up onto the GPU. Costs a little throughput, buys back a meaningful chunk of VRAM.</p><h3>Step 2: Attach the LoRA adapter</h3><pre>model = FastModel.get_peft_model(<br>    model,<br>    r                          = 16,<br>    lora_alpha                 = 16,<br>    lora_dropout               = 0,<br>    bias                       = &quot;none&quot;,<br>    target_modules             = [&quot;q_proj&quot;, &quot;k_proj&quot;, &quot;v_proj&quot;, &quot;o_proj&quot;,<br>                                  &quot;gate_proj&quot;, &quot;up_proj&quot;, &quot;down_proj&quot;],<br>    use_gradient_checkpointing = &quot;unsloth&quot;,<br>    random_state               = 3407,<br>)</pre><p>The base weights stay frozen and quantized. For each targeted projection we add two thin matrices — a down-projection to rank r and an up-projection back out — and only those learn.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F2T10-zDvWwQ6e99uIe3EQ.png" /><figcaption><em>Frozen base, live adapter. The magenta sliver is everything that gets a gradient.</em></figcaption></figure><p>On this model that works out to about <strong>52 million trainable parameters out of 29.8 billion — 0.18%</strong>.</p><p>Rank 16 is the right ballpark for this task. Rank controls how much <em>new</em> the adapter can express, and we’re not teaching new knowledge here — we’re teaching output discipline. Reaching for r = 64 mostly buys you a slower run and more opportunity to overfit. Save the higher ranks for when you&#39;re teaching genuinely unfamiliar material.</p><h3>Step 3: Load the dataset</h3><pre>from datasets import load_dataset</pre><pre>dataset = load_dataset(<br>    &quot;Salesforce/xlam-function-calling-60k&quot;,<br>    split = &quot;train[:10000]&quot;,<br>)<br>print(dataset[0])</pre><p>Each row has three fields:</p><ul><li><strong>query</strong> — the user&#39;s plain-language request.</li><li><strong>tools</strong> — the available functions, with parameter names, types, descriptions, and required flags. Note that this includes <em>distractor</em> tools that shouldn&#39;t be called. That&#39;s deliberate and it&#39;s the most valuable part of the dataset — it&#39;s what teaches selection, not just formatting.</li><li><strong>answers</strong> — the verified call or calls, each with a name and an arguments object.</li></ul><p>Ten thousand rows is plenty. This is a formatting task, and formatting saturates fast.</p><h3>Step 4: Reshape into a conversation</h3><p>This step is where the actual thinking happens, and it’s the one most tutorials rush.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JxPfS9y2PNrRWEmPz_BcXA.png" /><figcaption><em>Three columns of JSON become one training example.</em></figcaption></figure><p>You have to decide what goes in the prompt and what goes in the target. Tool schemas go in the prompt — at inference time your application supplies them, so the model must learn to <em>read</em> them, not memorize them. The target is the call and only the call.</p><pre>import json<br>from unsloth.chat_templates import standardize_sharegpt</pre><pre>SYSTEM = (<br>    &quot;You are a function-calling agent. Given a user request and a list of &quot;<br>    &quot;available tools, respond with a JSON array of the tool calls required. &quot;<br>    &quot;Respond with JSON only — no prose, no markdown, no explanation.&quot;<br>)</pre><pre>def to_conversation(example):<br>    tools   = json.loads(example[&quot;tools&quot;])<br>    answers = json.loads(example[&quot;answers&quot;])</pre><pre>    user_turn = (<br>        &quot;Available tools:\n&quot;<br>        f&quot;{json.dumps(tools)}\n\n&quot;<br>        f&quot;Request: {example[&#39;query&#39;]}&quot;<br>    )</pre><pre>    return {&quot;conversations&quot;: [<br>        {&quot;from&quot;: &quot;system&quot;, &quot;value&quot;: SYSTEM},<br>        {&quot;from&quot;: &quot;human&quot;,  &quot;value&quot;: user_turn},<br>        {&quot;from&quot;: &quot;gpt&quot;,    &quot;value&quot;: json.dumps(answers, separators=(&quot;,&quot;, &quot;:&quot;))},<br>    ]}</pre><pre>dataset = dataset.map(to_conversation, remove_columns = dataset.column_names)<br>dataset = standardize_sharegpt(dataset)</pre><pre>def formatting_prompts_func(examples):<br>    return {&quot;text&quot;: [<br>        tokenizer.apply_chat_template(convo, tokenize = False)<br>        for convo in examples[&quot;conversations&quot;]<br>    ]}</pre><pre>dataset = dataset.map(formatting_prompts_func, batched = True)</pre><pre>print(dataset[0][&quot;text&quot;])</pre><p><strong>Print that last line and actually read it.</strong> You’re about to run a few hundred GPU-minutes against this exact string. Confirm the special tokens are where you expect, the system prompt survived, and there’s no doubled BOS token.</p><p>One deliberate choice worth calling out: separators=(&quot;,&quot;, &quot;:&quot;) produces compact JSON with no spaces. Pick a serialization and never vary it. If half your targets are pretty-printed and half aren&#39;t, you&#39;ve taught the model that whitespace is a free parameter — and then you&#39;ll spend a week wondering why output formatting is inconsistent.</p><h3>Step 5: Score the loss on the answer only</h3><p>This is the highest-leverage line in the whole notebook, and it’s the one people skip.</p><p>By default the trainer computes loss over the <em>entire</em> sequence — including the system prompt and the several hundred tokens of tool schema you just pasted in. So the model spends most of its gradient budget learning to reproduce JSON schemas that will be handed to it for free at inference time. It’s not just wasted; it actively dilutes the signal you want.</p><pre>from unsloth.chat_templates import train_on_responses_only</pre><pre>trainer = train_on_responses_only(<br>    trainer,<br>    instruction_part = &quot;&lt;|start|&gt;user&lt;|message|&gt;&quot;,<br>    response_part    = &quot;&lt;|start|&gt;assistant&lt;|message|&gt;&quot;,<br>)</pre><p>Those two delimiter strings <strong>must match your chat template exactly</strong>. Don’t copy them from a blog post — including this one. Print a formatted example from Step 4, find the literal markers that open the user turn and the assistant turn, and paste those in. Get them wrong and the masking silently does nothing.</p><p>Sanity check it afterwards by decoding one example’s labels: everything before the assistant turn should be -100.</p><h3>Step 6: Configure the trainer</h3><pre>from trl import SFTTrainer, SFTConfig</pre><pre>trainer = SFTTrainer(<br>    model         = model,<br>    tokenizer     = tokenizer,   # newer TRL versions call this processing_class<br>    train_dataset = dataset,<br>    args = SFTConfig(<br>        dataset_text_field          = &quot;text&quot;,<br>        per_device_train_batch_size = 1,<br>        gradient_accumulation_steps = 4,<br>        warmup_steps                = 10,<br>        max_steps                   = 200,<br>        learning_rate               = 2e-4,<br>        logging_steps               = 1,<br>        optim                       = &quot;adamw_8bit&quot;,<br>        weight_decay                = 0.01,<br>        lr_scheduler_type           = &quot;linear&quot;,<br>        seed                        = 3407,<br>        output_dir                  = &quot;outputs&quot;,<br>        report_to                   = &quot;none&quot;,<br>    ),<br>)</pre><p>Batch size 1 with 4 accumulation steps gives an effective batch of 4 — small, but these sequences are long and VRAM is the binding constraint. adamw_8bit quantizes the optimizer states; with only 52M trainable parameters the memory saving is small in absolute terms, but it&#39;s free.</p><p>2e-4 is the standard LoRA learning rate and a fine default. If your loss spikes and never recovers, halve it before you change anything else.</p><h3>Step 7: Train</h3><pre>trainer_stats = trainer.train()</pre><p>You’ll see Unsloth’s banner confirming the trainable parameter count — check that 0.18% figure, because if it says 100% your LoRA didn&#39;t attach and you&#39;re about to OOM.</p><p>Then the loss log. It will look noisy and that’s normal at an effective batch size of 4; individual steps bounce around a lot. What matters is the trend.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TIxAzV-AYFY8Ay2J5o2GYQ.png" /></figure><p><em>Loss flattens long before the model is actually good.</em></p><p>Which brings me to the thing I want you to take away from this article.</p><h3>Step 8: Loss is not your metric</h3><p>Training loss will look great by step 30. That does not mean you’re done — it mostly means the model has learned the <em>shape</em> of your targets: start with [{, use these key names, end with }]. Getting the shape right is easy. Selecting the correct tool from a list that includes plausible distractors, and filling in every required argument correctly, takes considerably longer.</p><p>So score the thing you care about. On a held-out slice:</p><pre>import json</pre><pre>def normalize(call):<br>    return (call[&quot;name&quot;], json.dumps(call.get(&quot;arguments&quot;, {}), sort_keys=True))</pre><pre>def exact_match(predicted_str, expected):<br>    try:<br>        predicted = json.loads(predicted_str)<br>    except json.JSONDecodeError:<br>        return False                      # unparseable is a failure, full stop<br>    if not isinstance(predicted, list) or len(predicted) != len(expected):<br>        return False<br>    return [normalize(c) for c in predicted] == [normalize(c) for c in expected]</pre><p>Report three numbers, not one:</p><ol><li><strong>Parse rate</strong> — what fraction of outputs are valid JSON at all. This is what the fine-tune fixes most dramatically, and it should approach 100%.</li><li><strong>Function selection accuracy</strong> — right tools chosen, ignoring arguments.</li><li><strong>Exact match</strong> — right tools <em>and</em> right arguments. The number that actually predicts production behaviour.</li></ol><p>Splitting them tells you what to fix. High parse rate with low exact match means an argument problem, and argument problems are usually a max_seq_length problem in disguise — the schema got truncated.</p><h3>Step 9: Prompt it before and after</h3><pre>from transformers import TextStreamer</pre><pre>messages = [<br>    {&quot;role&quot;: &quot;system&quot;, &quot;content&quot;: SYSTEM},<br>    {&quot;role&quot;: &quot;user&quot;,   &quot;content&quot;: user_turn},<br>]</pre><pre>inputs = tokenizer.apply_chat_template(<br>    messages,<br>    add_generation_prompt = True,<br>    return_tensors        = &quot;pt&quot;,<br>).to(&quot;cuda&quot;)</pre><pre>_ = model.generate(<br>    input_ids   = inputs,<br>    max_new_tokens = 256,<br>    temperature = 0.1,<br>    streamer    = TextStreamer(tokenizer, skip_prompt = True),<br>)</pre><p>Keep the temperature low. You want the single most likely call, not a creative one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EH3brVPvz5jOPg_tYmB5Hg.png" /><figcaption><em>Same prompt, 200 steps apart.</em></figcaption></figure><p>The difference isn’t intelligence. The base model understood the request fine — it just answered like a chatbot instead of like an API client, invented key names that weren’t in the schema, and stopped after one call to ask a follow-up question. The tuned model treats the entire response as the payload.</p><h3>Step 10: Save and ship</h3><pre># The adapter alone — a few dozen MB<br>model.save_pretrained(&quot;muse-glimmer-toolcall-lora&quot;)<br>tokenizer.save_pretrained(&quot;muse-glimmer-toolcall-lora&quot;)</pre><pre># Or merge into 16-bit weights for vLLM / SGLang<br>model.save_pretrained_merged(<br>    &quot;muse-glimmer-toolcall-merged&quot;, tokenizer, save_method = &quot;merged_16bit&quot;<br>)</pre><pre># Or export to GGUF for llama.cpp, Ollama, LM Studio<br>model.save_pretrained_gguf(<br>    &quot;muse-glimmer-toolcall&quot;, tokenizer, quantization_method = &quot;q4_k_m&quot;<br>)</pre><p>Keep the adapter, not just the merged model. It’s small enough to version in git-lfs, you can swap adapters against one base at serving time, and if you later need to retrain you’ll want to know exactly what produced it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wxFvxT9z2YBibFgnHYtG1w.png" /><figcaption><em>Why any of this fits on a single card.</em></figcaption></figure><h3>Five things that cost me time</h3><p><strong>1. Sequence length, again.</strong> I’m repeating this because it caused two separate bad runs. Tool schemas are enormous. Tokenize a sample of your dataset, look at the 95th percentile length, and set max_seq_length above it.</p><p><strong>2. Distractor tools are the whole point.</strong> My instinct was to prune the tool list down to just the ones being called — cleaner prompts, shorter sequences, faster training. This produces a model that calls the first tool it sees. The distractors are what teach selection.</p><p><strong>3. TRL renamed things.</strong> Depending on your version, SFTTrainer(tokenizer=...) may need to be processing_class=..., and some TrainingArguments moved into SFTConfig. If you hit a TypeError on an argument that obviously exists, check your TRL version before checking your sanity.</p><p><strong>4. Validate the masking, don’t trust it.</strong> train_on_responses_only fails quietly when the delimiter strings don&#39;t match. Decode one batch&#39;s labels and confirm the prompt region is -100.</p><p><strong>5. A single canonical serialization.</strong> Same key order, same separators, every example. The model will learn whatever inconsistency you give it.</p><h3>When not to do this</h3><p>Fine-tuning is the wrong tool if your function schemas change weekly — you’d be retraining constantly to chase a moving target, and few-shot prompting with a constrained decoder handles that better. It’s also wrong if your real problem is <em>reasoning</em> about which multi-step sequence of calls to make; that’s a capability question, and 200 steps of LoRA won’t manufacture it.</p><p>It’s the right tool when the schemas are stable, the failure mode is formatting rather than comprehension, and you’re paying a latency or reliability tax on repair logic. That describes a lot of production agent code.</p><p>The nice thing about the current generation of open models is that testing this hypothesis costs an afternoon and one GPU rather than a cluster reservation. Muse Glimmer being Apache 2.0 means whatever you build on top is yours to deploy.</p><p><em>Code and diagrams for this post are reproducible as written. If you run it on a different dataset, I’d be curious what your parse-rate delta looks like — that’s usually the number that moves most.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c62bc1a4aa6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Internet Text Becomes an Assistant]]></title>
            <link>https://medium.com/@itissaad25/how-internet-text-becomes-an-assistant-104f508a257c?source=rss-dd23210354df------2</link>
            <guid isPermaLink="false">https://medium.com/p/104f508a257c</guid>
            <category><![CDATA[data-scraping]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[web-data]]></category>
            <category><![CDATA[llm-training-data]]></category>
            <category><![CDATA[llm-training]]></category>
            <dc:creator><![CDATA[Saad]]></dc:creator>
            <pubDate>Tue, 18 Aug 2026 07:20:20 GMT</pubDate>
            <atom:updated>2026-08-18T07:20:20.722Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*eipfCfXZqzokTfdWTjFrSQ@2x.png" /><figcaption>Pre-training builds a document simulator. Post-training turns it into something that answers questions. Neither stage works the way most people assume.</figcaption></figure><p>There is a persistent mental model of large language models as enormous databases , text goes in during training, gets indexed somewhere inside, and gets looked up on request. It is an intuitive picture, and it is wrong in a way that makes almost everything about these systems harder to reason about: why they fabricate citations, why they can be talked into ignoring their instructions, why “just teach it to say I don’t know” turns out to be a research problem rather than a config flag.</p><p>The more useful picture is narrower and stranger. A language model is a fixed mathematical function that takes a one-dimensional sequence of tokens and outputs a probability distribution over which token comes next. That is the entire mechanism. Everything an assistant appears to do, answering, refusing, reasoning, searching the web, having a personality is that one operation, aimed at different training data.</p><p>Building a production assistant means running that operation through two very different stages.</p><p><strong>Pre-training</strong> is the expensive one: months of compute across thousands of GPUs, tens of millions of dollars, and the output is not an assistant at all. It is a <em>base model; </em>an internet document simulator that generates text with the same statistical texture as the web.</p><p><strong>Post-training</strong> is the cheap one. Same algorithm, same architecture, same code but the dataset is swapped out and training continues for a few hours. This is the stage that produces something you can talk to.</p><p>The asymmetry is worth sitting with. Nearly all the capability comes from the first stage. Nearly all the <em>behaviour</em> comes from the second.</p><h3>Part One: Pre-training</h3><h3>Step 1: Downloading the internet, then throwing most of it away</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*LvWDLdc1k92JIeOgF_Pxaw@2x.png" /></figure><p>The goal at this stage is simple to state and hard to execute: acquire an enormous quantity of high-quality, highly diverse text. Quantity determines how much the model can learn. Diversity determines the breadth of what it knows.</p><p>Most efforts begin with <strong>Common Crawl</strong>, a nonprofit that has been crawling the web since 2007. Its method is exactly what you would guess; start from seed pages, follow links, index everything, repeat and its scale is correspondingly vast; a single 2024 snapshot covers on the order of 2.7 billion web pages.</p><p>That raw crawl is unusable as training data. What turns it into a corpus is a filtering pipeline, and Hugging Face’s <strong>FineWeb</strong> dataset is the best public documentation of what one looks like. Every major lab maintains something equivalent, internally and undisclosed.</p><p>The pipeline’s stages, roughly in order:</p><p><strong>URL filtering.</strong> Blocklists eliminate entire domains before anything is downloaded — malware hosts, spam farms, SEO content mills, adult sites, hate sites. Cheapest possible intervention, applied first.</p><p><strong>Text extraction.</strong> Crawlers save raw HTML: markup, CSS, navigation chrome, cookie banners, footers. The useful signal is the article body, and separating it from everything else is a genuinely fiddly heuristic problem that materially affects final data quality.</p><p><strong>Language filtering.</strong> A classifier scores each page’s language. FineWeb keeps pages scoring above 0.65 for English and discards the rest which is not a neutral technical choice but a product decision with consequences that surface much later. Filter out Spanish at this stage and the resulting model will be mediocre at Spanish, permanently, no matter what happens downstream. A corpus’s language mix is a commitment.</p><p><strong>Deduplication.</strong> The web is enormously repetitive. Near-duplicate documents waste compute and cause the model to over-weight whatever happens to be syndicated most widely.</p><p><strong>PII removal.</strong> Detection and removal of pages containing addresses, government identification numbers, and similar personal data.</p><p>What comes out the other end is smaller than most people expect. FineWeb, representative of production-grade corpora, occupies roughly <strong>44 terabytes</strong>. That fits on a single consumer hard drive. The internet is large, but text is compact, and aggressive filtering removes the overwhelming majority of it.</p><p>Sampled directly, the result looks resolutely unglamorous: a news item about tornadoes in 2012, a health article about adrenal glands. Millions of ordinary web pages, stripped to plain text. The magic is entirely in the aggregate.</p><h3>Step 2: Tokenization: why models don’t read characters</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*PaXaE2X4a7ZTXJotOMjeLg@2x.png" /></figure><p>Neural networks require input as a one-dimensional sequence drawn from a finite symbol set. Plain text already satisfies this in principle; UTF-8 encoding turns any document into a bit string, giving a vocabulary of exactly two symbols.</p><p>That representation is technically valid and practically terrible, because <strong>sequence length is the scarcest resource in a transformer</strong>. The attention mechanism compares every position against every other position, so cost scales quadratically with sequence length. Doubling the sequence roughly quadruples attention compute. Representing text as bits produces sequences eight times longer than representing it as bytes, and vastly longer than necessary.</p><p>So there is a trade to be made: a larger vocabulary buys shorter sequences. The standard solution is <strong>byte-pair encoding</strong>, which builds the vocabulary from the data itself. Starting from raw bytes, BPE repeatedly finds the most frequent adjacent pair of symbols in the corpus and merges it into a new single symbol, thousands of times over. Frequent sequences, common words, common suffixes, the, ing collapse into single tokens. Rare strings stay fragmented into pieces.</p><p>The trade does not extend indefinitely in either direction. Vocabulary size sets the width of both the embedding matrix and the output layer, so a very large vocabulary inflates parameter count and starves rare tokens of the gradient updates they need to learn good representations. In practice, production tokenizers settle around <strong>100,000 symbols</strong> for example, GPT-4’s cl100k_base vocabulary contains exactly 100,277.</p><p>Run FineWeb’s 44 terabytes through a tokenizer of that size and it becomes a sequence of roughly <strong>15 trillion tokens</strong>. That number is the real unit of account in this field. It is what “training data” means operationally.</p><p>One consequence worth internalizing: token IDs are arbitrary identifiers. Nothing about the number 3962 encodes anything about the text chunk it stands for. All meaning the model has is meaning it learns.</p><h3>Step 3: Training: one operation, repeated at unimaginable scale</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*euTfJZ5N4enpVboEFya0_A@2x.png" /></figure><p>With a token sequence in hand, the training loop is almost anticlimactic.</p><p>Sample a window of tokens from the corpus, up to some maximum, the <em>context length</em>. Feed it to the network. The network outputs one number for each of the ~100,000 vocabulary entries: the probability that this token comes next.</p><p>At initialization those parameters are random, so the distribution is essentially noise, a few percent here, a couple of percent there, spread across a hundred thousand candidates with no structure.</p><p>But because the window was sampled from real text, the correct answer is already known. It is simply the next token in the document. That gives a supervised label for free, which is the entire trick that made this scalable: no human annotation required, just text and the arrangement it already came in.</p><p>From there, standard gradient descent. <strong>Cross-entropy loss</strong> measures how much probability mass the model assigned to the correct token, high when the model is wrong, near zero when it is confidently right. Backpropagation computes how each parameter should shift to nudge that probability up and competing probabilities down. An optimizer (AdamW, typically, under a decaying learning-rate schedule) applies the update.</p><p>Two details make this vastly more efficient than it first appears.</p><p>First, <strong>every position in the window is a training example simultaneously.</strong> A causal attention mask prevents each position from seeing anything to its right, which means a single forward pass through a 1,024-token window yields 1,024 independent next-token predictions, all contributing to the same gradient.</p><p>Second, windows are processed in large batches, and every one of those predictions is computed in parallel across GPUs.</p><p>Stack these up and a single optimization step consumes on the order of a million tokens at once. Loss falls, monotonically in the long run and noisily in the short. Nothing else is happening. Predictions are being made statistically consistent with the patterns in the corpus, several hundred billion parameters at a time.</p><h3>Step 4: What is actually inside</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*CoFkbdqP7NOqWU7kZFv0wg@2x.png" /></figure><p>The network is a <strong>transformer</strong>, and it is worth being precise about what kind of object that is: a fixed mathematical expression that mixes the input tokens with the model’s parameters through multiplication, addition, exponentiation, and division. Nothing more exotic. Modern instances contain trillions of individual terms, but the primitives are elementary.</p><p>Information flows in one direction. Tokens are first <em>embedded, </em>each vocabulary entry maps to a learned vector, a distributed representation that places tokens in a geometric space where proximity encodes usage similarity. Those vectors pass through repeated blocks, each combining an <strong>attention</strong> operation (positions exchange information, weighted by learned relevance) with a <strong>multilayer perceptron</strong> (per-position transformation), stabilized by layer normalization. At the top, a final projection produces <em>logits</em>, converted by softmax into the next-token distribution.</p><p>Interactive visualizations of small transformers; some with as few as 85,000 parameters make the flow legible in a way equations do not. The architecture in a production model is recognizably the same; the parameter count is six or seven orders of magnitude larger.</p><p>The intermediate values are sometimes described as neuron firing rates, and the analogy invites a specific mistake worth flagging. <strong>These functions are stateless.</strong> Biological neurons are complex dynamical systems with memory. A transformer holds nothing between forward passes, no persistence, no internal scratchpad surviving from one token to the next beyond what is written back into the visible sequence. Input, computation, output, done.</p><p>This distinction between <strong>parameters</strong> and <strong>activations</strong> matters more than it sounds. Parameters are frozen after training; they encode everything the model learned, compressed lossily into fixed weights. Activations are computed fresh on every pass, from whatever is in the context window. Practically the whole design space of prompting, retrieval, and tool use lives in this gap and it is exactly the gap that reappears when hallucination becomes the topic.</p><h3>The compute story</h3><h3>GPT-2 as a measuring stick</h3><p>OpenAI’s <strong>GPT-2</strong>, published in 2019, is a useful reference point because it was the first time the recognizably modern stack came together. Every component in it is still in use. Everything has simply gotten bigger.</p><p>The largest GPT-2 variant had roughly <strong>1.5 billion parameters</strong>, a maximum context length of <strong>1,024 tokens</strong>, and processed on the order of <strong>100 billion tokens</strong> during training.</p><p>Set against current practice, each of those is small. Frontier models run to trillions of parameters. Context windows span hundreds of thousands of tokens and, at the high end, millions and long context is not merely a convenience, since more visible history means strictly more information available for each prediction. Training corpora reach into the tens of trillions of tokens.</p><p>The cost trajectory is the striking part. Training GPT-2 in 2019 has been estimated at around <strong>$40,000</strong>. Andrej Karpathy’s llm.c project reproduced it in roughly a day for about <strong>$600</strong>, without hard optimization, and suggested a determined effort could reach $100.</p><p>Three things drove that collapse, in ascending order of importance. Data curation improved ,better filtering yields more learning per token. Software improved dramatically, as an industry’s worth of engineering attention went into extracting every available FLOP from the hardware. And the hardware itself got much faster.</p><p>There is a fourth factor that is easy to miss: the field learned <em>how to spend</em> a compute budget. Scaling-law work established that model size and dataset size need to grow together, and that many early models were badly over-parameterized relative to the data they saw. Some of the improvement was not better silicon at all. It was no longer wasting the silicon already available.</p><h3>What training actually looks like</h3><p>Watching a training run is undramatic. Each line of output is one optimization step — a million tokens processed, a few seconds elapsed, a marginal parameter update. A run of 32,000 steps at a million tokens each works through roughly 33 billion tokens over a day or two.</p><p>The number that matters is the <strong>loss</strong>: a single scalar summarizing prediction quality, constructed so that lower is better. Watching it descend, and intervening when it stops, is a large fraction of the job.</p><p>Periodic sampling from the partially-trained model makes progress legible. Twenty steps in, output is pure noise, because the parameters are still essentially random. A percent or so into training, something recognizable emerges — not coherent, but locally plausible: real words, plausible short phrases, grammar that holds for a clause and then dissolves. By the end of a full run, the same model produces fluent, well-formed English. The transition happens gradually, and always in that order: local structure before global structure.</p><h3>The hardware</h3><p>Runs like this happen on rented cloud hardware. A standard unit is an <strong>8×H100 node</strong> — eight NVIDIA H100 GPUs in a single machine — available on demand for a few dollars per GPU-hour from providers like Lambda, alongside many others.</p><p>GPUs suit this workload almost perfectly. Training is computationally enormous but overwhelmingly composed of matrix multiplications, which decompose into many independent arithmetic operations that can run simultaneously. GPUs provide thousands of parallel execution units and the memory bandwidth to keep them fed. CPUs, optimized for sequential latency, are the wrong shape entirely.</p><p>Scaling proceeds by composition: one GPU, eight to a node, many nodes to a cluster, clusters to a data center. Frontier training runs now span tens of thousands of accelerators — xAI’s 2024 Colossus build-out, reported at 100,000 GPUs in one facility, made the point publicly — with power and cooling requirements that increasingly determine where such facilities can be built at all.</p><p>The demand this created is why NVIDIA’s market capitalization crossed $3 trillion in 2024, and why GPU allocation became a strategic concern for every major technology company. It is a fair description of the situation to note that all of that capital, silicon, and electricity is dedicated to a single objective: predicting the next token in a sequence, slightly better than before.</p><h3>The output</h3><p>What emerges from pre-training is a <strong>base model</strong> — a setting of parameters, nothing more. It is an internet document simulator. Prompted with text, it continues it in a statistically plausible way, because that is precisely and exclusively what it was optimized to do.</p><p>It is genuinely useful, and it is not an assistant. Ask it a question and it may continue with more questions, because lists of questions are a thing that appears on the internet. There is no notion of a request to be satisfied. That has to be installed.</p><h3>Part Two: Post-training</h3><h3>Programming by example</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*S-Ixsgf4lBuL-Knw0l3xZw@2x.png" /></figure><p>The transition is mechanically almost trivial: discard the internet corpus, substitute a dataset of <strong>conversations</strong>, and continue training with the same algorithm.</p><p>The conversations are structured as multi-turn exchanges between a human and an assistant, and they encode the target behaviour by demonstration:</p><ul><li>A user asks what 2 + 2 is; the assistant answers directly.</li><li>The user follows up — what if it were multiplication instead? — and the assistant handles the referent correctly without restating context.</li><li>Somewhere in the dataset, an assistant response carries a warmth or humour that establishes a consistent character.</li><li>Somewhere else, a user asks for something the developers do not wish to help with, and the assistant declines. This is where <strong>refusal behaviour</strong> is installed.</li></ul><p>Because the system is a neural network, none of this can be written as code. There is no branch to add, no rule to specify. The only available control surface is data. <strong>The assistant is programmed implicitly, by example</strong>, and every trait it exhibits — helpfulness, tone, willingness, unwillingness — traces back to demonstrations someone wrote down.</p><p>Which raises the question of who writes them. Originally, human labellers, working from detailed guideline documents that specify what an ideal response looks like: helpful, truthful, harmless, in that priority order, with extensive elaboration. OpenAI’s <strong>InstructGPT</strong> paper (2022) was the first public account of the process, and remains the clearest.</p><p>This yields the single most clarifying observation about talking to an AI assistant. The response is not the model’s opinion and not a database lookup. It is a <strong>statistical imitation of what a trained human labeller, following a specific company’s written guidelines, would have written in that situation</strong>. The model has learned the distribution of those responses and samples from it. Differences in personality between competing assistants are, to a substantial degree, differences between labelling guidelines.</p><p>Modern pipelines have grown considerably more elaborate — synthetic data generation, model-assisted labelling, reinforcement learning from human and AI feedback — but the underlying logic is unchanged. Behaviour is a data curation problem.</p><h3>Why it’s cheap</h3><p>Pre-training might occupy thousands of machines for three months. Post-training can finish in <strong>hours</strong>.</p><p>The arithmetic explains it. Pre-training consumes something like 15 trillion tokens. A conversation dataset, even a large and carefully constructed one, might contain hundreds of thousands of exchanges — millions to low billions of tokens. Three or four orders of magnitude smaller, at the same cost per token.</p><p>This asymmetry has an important implication. Post-training does not teach the model language, facts, or reasoning; there is nowhere near enough data for that. Those capabilities already exist in the base model. What post-training does is <strong>elicit and shape</strong> them, redirecting an existing document simulator toward one particular genre of document: the helpful-assistant transcript. The base model is where capability lives. Post-training decides what surfaces.</p><h3>Encoding conversations as tokens</h3><p>The model consumes flat token sequences. Conversations are structured objects with roles and turn boundaries. Something has to bridge that, which means defining a protocol — the same problem TCP/IP solves for network data, and solved the same way: agree on a precise layout that both ends can encode and decode reliably.</p><p>The solution is <strong>special tokens</strong>. OpenAI’s ChatML format uses three: a turn-start marker, a role separator, and a turn-end marker, conventionally written &lt;|im_start|&gt;, &lt;|im_sep|&gt;, and &lt;|im_end|&gt;.</p><p>A two-turn exchange serializes as: turn-start, role token (user), separator, the tokenized question, turn-end; then turn-start, role token (assistant), separator, the tokenized answer, turn-end. A short arithmetic exchange lands at around 49 tokens in total.</p><p>The critical technical point about these markers is that <strong>they are not text</strong>. &lt;|im_start|&gt; is not a sequence of characters the model interprets; it is a genuinely new vocabulary entry, introduced at post-training, that appeared nowhere in pre-training. Adding it means appending a fresh row to the embedding matrix and a fresh column to the output projection, initialized randomly and learned during post-training. The model learns from the conversation data what these tokens signify: a turn is beginning, here is whose turn it is, here is where it ends.</p><p>There is no cross-vendor standard. Every model family defines its own markers and layout, and the details are essentially arbitrary. What matters is that whatever protocol was used in training is reproduced exactly at inference; mismatched formatting degrades behaviour in ways that look mysterious until the tokenization is inspected.</p><h3>What happens at inference</h3><p>The serving path follows directly. A user submits a message. The server constructs a token sequence containing the conversation so far, then appends the opening of an assistant turn — turn-start, assistant, separator — and stops.</p><p>The model is then asked for the next token. And the next. Each sampled token is appended and fed back, autoregressively, until an end-of-turn token is generated and the loop halts.</p><p>Nothing is retrieved. The model is completing a document, in exactly the manner pre-training established, on a document whose structure has been arranged to make the natural continuation an assistant response. If similar exchanges appeared in the post-training data, the output will carry their character — not identically, since sampling is stochastic, but recognizably in that register.</p><p>This framing also explains a class of failures that otherwise seem baffling. Because the entire conversation — system instructions, user input, tool output, retrieved documents — is one flat sequence of tokens, the model’s separation between “instructions to follow” and “content to process” is learned and statistical rather than architectural. There is no hardware boundary. <strong>Prompt injection is a structural consequence of this design</strong>, not an implementation bug, which is why mitigation involves training, filtering, and privilege separation at the application layer rather than a single fix. (Related, and standard practice: special tokens are stripped from user-supplied text before tokenization, so that a user cannot type &lt;|im_start|&gt;system and fabricate a turn.)</p><h3>LLM Psychology: Where Hallucinations Come From</h3><p>The training pipeline produces emergent behavioural characteristics, several of them unintuitive. Hallucination is the most consequential.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*o-QJ3e-CYjd1KtmElm5r8Q@2x.png" /></figure><h3>The mechanism</h3><p>Consider what a reasonable post-training dataset contains. Biographical questions — who is Tom Cruise, who is Genghis Khan, who is some sitting senator — each paired with a confident, well-formed, factually correct answer. The labeller either knew the subject or looked them up, then wrote a good response.</p><p>Every one of those examples is individually correct. Collectively, they teach something no one intended.</p><p>The model learns the <em>statistical form</em> of the question-answer pair: when a query matches the pattern “who is [name]”, a confident biographical paragraph follows. That association is what generalizes.</p><p>Now query an invented name. The pattern matches. A confident biographical paragraph is overwhelmingly the most likely continuation. And the model has no mechanism for research — no internet access, no lookup, only a probability distribution to sample from. So it produces a fluent, confident, entirely fabricated biography.</p><p>Older models demonstrate this vividly. Ask Falcon-7B-Instruct about a made-up name and it might report an American science-fiction author. Resample, and the same name becomes a character from a 1950s television show. Resample again: a former minor-league baseball player.</p><p>The variation is the tell. A model retrieving a fact would return the same fact. A model sampling from a distribution returns whatever the temperature-scaled probabilities happen to yield on that pass. Three different confident answers to one question is a direct readout of a model that has no answer at all, generating text that is statistically consistent with the <em>style</em> of an answer.</p><h3>The harder problem underneath</h3><p>Here is what makes this more than a data-coverage gap. There is good evidence that these models <strong>do</strong> internally represent their own uncertainty — that somewhere in the activations, features distinguish familiar entities from unfamiliar ones.</p><p>The problem is that this internal signal <strong>is not wired to the output behaviour</strong>. Nothing in pre-training or naive post-training connects “the uncertainty feature is active” to “produce the tokens <em>I don’t know</em>.” The model has never seen a demonstration of that behaviour, so it does what it has seen: takes its best guess in a confident register.</p><p>The internal knowledge exists. The verbal expression of it was never trained.</p><h3>Mitigation One: teaching the boundary of knowledge</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*L-7nzqOhf0wDXTvyKOf1sQ@2x.png" /></figure><p>The fix follows from the diagnosis: add training examples where the correct assistant response is an admission of ignorance. But this only works if such examples appear <strong>specifically for questions the model genuinely cannot answer</strong>. Train it to disclaim things it actually knows and it becomes uselessly evasive.</p><p>Which requires determining, empirically, where a given model’s knowledge ends. Meta’s Llama 3 paper documents a procedure for exactly this, under the heading of factuality. In outline:</p><ol><li><strong>Sample a document</strong> from the training corpus and extract a paragraph.</li><li><strong>Generate questions automatically.</strong> A language model reads the paragraph and produces specific factual questions with answers. This is reliable because the source text is in the context window — the task is reformulation, not recall.</li><li><strong>Interrogate the target model.</strong> Pose each question to the model being trained, several times, without the source document.</li><li><strong>Grade automatically.</strong> A separate model compares each response against the known answer. No humans in the loop; the correct answer is already available.</li><li><strong>Branch on the result.</strong> If the model answers consistently and correctly across repeated samples, it knows the fact — leave it alone. If it produces varying or wrong answers, it does not.</li><li><strong>For the failures, add a new training example</strong> in which that exact question is paired with an honest disclaimer.</li></ol><p>A worked instance: for a hockey player’s biography, a model might reliably name the correct team across three independent samples — that fact is known. Asked how many championships he won, the same model might answer four, then something else, then claim he never won any, against a true answer of two. That question becomes a training example whose target response is that the model does not remember.</p><p>Done across many documents and question types, this produces something better than a patch. It gives the model the <em>opportunity</em> to learn the association between its own internal uncertainty signal and the verbal act of declining to answer. Empirically, a relatively small number of such examples generalizes surprisingly well — evidence that the uncertainty representation was there all along, waiting to be connected to an output.</p><p>One structural consequence deserves emphasis: <strong>this dataset is model-specific</strong>. It is calibrated to one model’s particular knowledge boundary. A larger model knows more, so its honest-refusal set must be different, and reusing another model’s data would teach systematically wrong disclaimers. The procedure has to be re-run per model.</p><h3>Mitigation Two: giving the model working memory</h3><p>Refusing to answer is honest but unhelpful. There is a better option, and it comes from asking what a person does when they are asked something they do not know: they look it up.</p><p>The framing that makes this precise is an analogy about memory. Knowledge stored in the parameters is a <strong>vague recollection</strong> — like something read once, a month ago. Frequently-encountered material is recalled well; rare material is recalled poorly or confabulated. Knowledge in the <strong>context window</strong> is different in kind. It is working memory: directly visible to the computation, available at full fidelity, requiring no recall at all.</p><p>Looking something up is the act of moving information from the first category into the second. Models can be given the same capability.</p><p>The mechanism is, again, special tokens. Introduce a search-start and search-end marker, then teach the model a protocol: instead of guessing, emit the search-start token, then a query, then search-end.</p><p>The inference loop is what makes this real. When the sampler encounters the search-end token, it <strong>stops generating</strong>. Control passes to the surrounding program, which extracts the query, executes it against a real search engine, retrieves the resulting text, and pastes it into the context window — typically delimited by further special tokens. Generation then resumes.</p><p>The model’s situation is now categorically different. The relevant facts are in the context window, feeding directly into the network on every subsequent forward pass. Answering has become reading rather than remembering.</p><p>Teaching this requires demonstrations, as always: a few thousand conversations showing when a search is warranted, how a query should be phrased, how results get used. That modest number suffices because pre-training already supplied a strong prior — a model trained on the web has extensive implicit knowledge of what search engines are and what a well-formed query looks like. Post-training only needs to connect that understanding to the new tokens.</p><p>The same architecture generalizes to any tool: code execution, calculators, database queries, document retrieval. Retrieval-augmented generation is this principle applied systematically. The pattern is always identical — special tokens, a protocol, a pause in sampling, an external call, results injected into context.</p><p>And the parametric/in-context distinction may be the single most practically useful idea for anyone building on these models. Facts in the context window are read. Facts in the weights are half-remembered. When accuracy matters, put the information in the context.</p><h3>What this adds up to</h3><p>Strip away the layers and the picture is remarkably compact.</p><p>There is one operation: predict the next token in a one-dimensional sequence. There is one expensive stage that gives that operation a rich model of language and the world, and one cheap stage that redirects it toward a particular genre of document. And at every point where the system’s behaviour is decided, the mechanism is the same — not code, but <strong>a choice about what data to train on</strong>.</p><p>Which languages the model speaks is a filtering threshold in a data pipeline. Whether it has a warm personality is a labelling guideline. What it refuses is a set of demonstrations. Whether it admits uncertainty is an empirically-constructed dataset probing the boundary of its own knowledge. Whether it can look things up is a protocol and a few thousand examples.</p><p>None of this diminishes the achievement. It relocates it. The engineering that matters is less about clever architecture — the transformer has been largely stable for years — and more about the far less glamorous work of deciding, at enormous scale, what a model should be shown.</p><p><em>Further reading: Hugging Face’s FineWeb blog post, for the data pipeline in full detail. OpenAI’s InstructGPT paper (2022), for the original account of instruction tuning. Meta’s Llama 3 paper, for the factuality and knowledge-probing procedure. Andrej Karpathy’s </em><em>llm.c repository, for a from-scratch GPT-2 reproduction with costs and logs.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=104f508a257c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Chatbot to Coworker: Building Real AI Agents with Google’s ADK]]></title>
            <link>https://medium.com/@itissaad25/from-chatbot-to-coworker-building-real-ai-agents-with-googles-adk-ff4295001547?source=rss-dd23210354df------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff4295001547</guid>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[google-adk]]></category>
            <category><![CDATA[mcps]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[mcp-protocol]]></category>
            <dc:creator><![CDATA[Saad]]></dc:creator>
            <pubDate>Mon, 17 Aug 2026 06:04:26 GMT</pubDate>
            <atom:updated>2026-08-17T06:04:26.384Z</atom:updated>
            <content:encoded><![CDATA[<h3>Reasoning loops, tools, memory, MCP, and long-running workflows — the pieces that separate a demo from something you can actually ship</h3><p>Most “AI agent” tutorials stop at the interesting part. You get a model, you bolt on a function, it answers a question, and the demo ends. What you don’t get is the part that matters in production: what happens on turn two, what happens after a restart, what happens when the model grades its own work and quietly gives itself an A.</p><p>This guide walks through the full stack of agent engineering using Google’s <strong>Agent Development Kit (ADK)</strong> — starting from the reasoning loop that defines an agent, through tools and multi-agent orchestration, then into the three layers of memory, the Model Context Protocol, and the patterns behind agents that run for days rather than seconds.</p><p>By the end you’ll understand not just how to write agent code, but <em>why</em> each piece exists and which failure it prevents.</p><blockquote><strong><em>A note on code:</em></strong><em> the snippets below are illustrative and follow ADK’s current shape. Agent frameworks move fast — check </em><a href="https://adk.dev/"><em>adk.dev</em></a><em> for the exact signatures in your installed version, and pin a stable model ID rather than a </em><em>latest alias so a model swap doesn&#39;t silently change your agent&#39;s behavior</em></blockquote><h3>1. What an agent actually is</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PreSvlT5GRrg7Dt5tPQ32A.png" /><figcaption><em>A chatbot answers once. An agent reasons, acts, observes, and decides again until the task is done.</em></figcaption></figure><p>An agent is <strong>an LLM equipped with tools, running in a loop, until a task is done.</strong></p><p>That’s the whole definition, and every word of it is load-bearing. A traditional chatbot generates one response and stops. An agent looks at a request, decides what step to take, takes it, looks at the result, and decides again.</p><p>The clearest articulation of this comes from the <strong>ReAct</strong> paper (<em>Synergizing Reasoning and Acting in Language Models</em>). Its insight was simple but structural: models shouldn’t produce answers in a single shot. They can reason about a step, act on it by calling a tool, observe what came back, and adjust.</p><p><strong>Reason → Act → Observe → Adjust.</strong> That cycle is the foundation of every modern agent, and it lines up with how the industry now defines the term: systems with reasoning, planning, and memory, with enough autonomy to make decisions on a user’s behalf.</p><p><strong>Why this matters to you:</strong> once you internalize the loop, framework choice becomes a detail. You’re always building the same four things — you’re just choosing who provides the scaffolding.</p><h3>2. Three agent patterns, and how to pick one</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VThHFK_62hlIynzsVbvu0w.png" /><figcaption><em>Sequential, reactive, and deliberative agents — and the kind of problem each one fits.</em></figcaption></figure><p>Not all agents behave the same way. Three broad patterns cover most of what you’ll build:</p><p>Pattern How it behaves Strength Weakness <strong>Sequential</strong> Runs step 1, then 2, then 3, like an assembly line Predictable, easy to debug Rigid; can’t adapt <strong>Reactive</strong> Decides in the moment: “given the current state, what now?” Tool A this time, tool B next Flexible No foresight <strong>Deliberative (planning)</strong> Sketches a plan first, then executes it Handles dependencies Slower, more expensive</p><p>Booking travel is the intuitive case for planning: you don’t buy a random flight and work backwards. You pick dates, then flights, then hotels — each step constrains the next.</p><p><strong>How to choose:</strong> simple predictable flows → sequential. Dynamic, unpredictable inputs → reactive. Multi-step goals with real dependencies between steps → planning.</p><p>Picking wrong is a common and expensive mistake. A planning agent on a two-step task burns tokens for nothing. A sequential agent on a branching problem will confidently march off a cliff.</p><h3>3. Hello world: your first ADK agent</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HsQ4-b1YZXqHKs-cZ4gvRg.png" /><figcaption><em>The four parameters of an ADK agent, and how a plain Python function becomes a tool schema.</em></figcaption></figure><p>ADK’s value proposition is that it handles the boilerplate — equipping the model with tools, managing the loop, deciding when to stop — and gives you good local testing interfaces on top.</p><p>Setup is minimal. Generate an API key from AI Studio, then install into a virtual environment:</p><pre>pip install google-adk<br>adk create first_agent</pre><p>The scaffolded agent is almost embarrassingly small:</p><pre>from google.adk.agents import Agent</pre><pre>root_agent = Agent(<br>    model=&quot;gemini-2.5-flash&quot;,<br>    name=&quot;getting_started&quot;,<br>    description=&quot;A general-purpose assistant.&quot;,<br>    instruction=&quot;You are an assistant who is helpful but brief.&quot;,<br>)</pre><p>Four parameters: the model that does the reasoning, a name, a human-readable description, and the instruction — the system prompt that shapes behavior.</p><p>Two ways to test it:</p><pre>adk run first_agent   # terminal dialogue<br>adk web               # local web UI at 127.0.0.1:8000</pre><p>The web interface is the one worth knowing about. It shows the full stack trace of every turn — which tools were called, with what arguments, what came back. When an agent misbehaves, that trace is usually the difference between a five-minute fix and an afternoon of guessing.</p><h3>4. Tools: extending what the model can do</h3><p>Right now you have a conversation with an LLM, and that LLM has a hard ceiling. Ask it the current date and the honest answer is that it doesn’t know. Training data has a cutoff.</p><p>Tools remove that ceiling. A tool is just a Python function:</p><pre>from datetime import datetime<br>from google.adk.agents import Agent</pre><pre>def get_current_time() -&gt; str:<br>    &quot;&quot;&quot;Returns the current date and time.&quot;&quot;&quot;<br>    return datetime.now().isoformat()</pre><pre>root_agent = Agent(<br>    model=&quot;gemini-2.5-flash&quot;,<br>    name=&quot;timekeeper&quot;,<br>    description=&quot;An assistant that knows the current time.&quot;,<br>    instruction=&quot;You are a helpful assistant. Use your tools when asked about time.&quot;,<br>    tools=[get_current_time],<br>)</pre><p>That’s the entire change: define the function, add it to the tools list. Ask &quot;what time is it?&quot; and the agent now returns a real answer instead of a plausible-sounding fabrication.</p><p>The docstring is doing real work here. ADK inspects the function signature and docstring to build the tool’s schema automatically — so the docstring <em>is</em> the interface contract the model reads. Vague docstrings produce agents that call tools at the wrong moment.</p><p>ADK also ships built-in tools. Google Search is one import away:</p><pre>from google.adk.tools import google_search</pre><pre>root_agent = Agent(<br>    model=&quot;gemini-2.5-flash&quot;,<br>    name=&quot;search_agent&quot;,<br>    instruction=&quot;Research the user&#39;s question using search before answering.&quot;,<br>    tools=[google_search],<br>)</pre><p>One practical wrinkle: agents default to a single tool call per turn, and search usually needs several to be comprehensive. Configure the agent to allow multiple calls when search is in the mix.</p><p><strong>The catch you should expect.</strong> A search agent will retrieve real sources — and still hallucinate URLs among them. Some of the links it cites will 404. This is not a bug you can prompt your way out of, and it leads directly to the next section.</p><h3>5. Multi-agent systems: agents as tools</h3><p><em>Figure 6 — An orchestrator delegates to specialists, and a separate verifier checks the work.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m8dSyPKKj5K12BAbHLoQyA.png" /></figure><p>The fix for a hallucinating search agent isn’t a better prompt. It’s a second agent whose only job is verification.</p><p>Build a URL verifier equipped with a fetch_url tool that returns page text, and instruct it to answer with exactly one of: verified, not_verified, or inconclusive. This is the <strong>LLM-as-judge</strong> pattern — one model&#39;s output becomes another model&#39;s input, and the judge has the tools to actually check.</p><p>Then wrap both as tools for an orchestrator:</p><pre>from google.adk.agents import Agent<br>from google.adk.tools.agent_tool import AgentTool</pre><pre>researcher = Agent(<br>    model=&quot;gemini-2.5-flash&quot;,<br>    name=&quot;researcher&quot;,<br>    instruction=(<br>        &quot;You are a research assistant. &quot;<br>        &quot;Use search_agent to find information. &quot;<br>        &quot;Then use url_verifier to confirm every source before reporting it.&quot;<br>    ),<br>    tools=[AgentTool(agent=search_agent), AgentTool(agent=url_verifier)],<br>)</pre><p>This is where things get genuinely powerful. The orchestrator’s tools aren’t functions — they’re <strong>other agents</strong>. From the caller’s perspective there’s no difference; AgentTool generates a function declaration just like any other tool.</p><p><strong>Four concrete benefits you get from this structure:</strong></p><ol><li><strong>Each agent has one job</strong>, so each system prompt stays short and testable.</li><li><strong>You can route models by task.</strong> A cheap fast model for classification and summarization; an expensive reasoning model only where reasoning is required. This is often the single largest cost lever in an agent system.</li><li><strong>Failures are localized.</strong> When output is wrong, you know which agent produced it.</li><li><strong>You overcome model limitations structurally</strong> rather than hoping a longer prompt fixes them.</li></ol><h3>6. A real workflow: the blog-writing agent</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PtW2Qpa4vxmAkpA74Kfyxw.png" /><figcaption><em>A LoopAgent pairs a generator with a validator and retries until the output passes.</em></figcaption></figure><p>Here’s a system that puts the pieces together. Give it a topic; it produces an outline, expands the outline into a full post, and suggests alternative titles and hooks.</p><p><strong>Step one — the planner</strong>, with one job: turn a topic into a structured outline.</p><pre>from google.adk.agents import LlmAgent</pre><pre>blog_planner = LlmAgent(<br>    model=MODEL,<br>    name=&quot;blog_planner&quot;,<br>    description=&quot;Turns a topic into a structured blog outline.&quot;,<br>    instruction=(<br>        &quot;Produce a markdown outline with: a title, a short introduction, &quot;<br>        &quot;4–6 sections each with bullet points, and a conclusion.&quot;<br>    ),<br>    output_key=&quot;blog_outline&quot;,<br>)</pre><p>Two details carry disproportionate weight.</p><p>The <strong>instruction is specific about the artifact</strong> — title, intro, four to six sections, bullets, conclusion. Spelling out the shape of the output is the cheapest reliability win available to you. “Write a good outline” produces variance; the above produces something you can validate.</p><p>The <strong>output_key</strong> writes whatever this agent produces into shared session state under blog_outline. The next agent reads it from there. This is how ADK agents pass work to each other without anyone re-reading the entire transcript.</p><p><strong>Step two — the validator.</strong> A second agent that writes nothing and only checks:</p><pre>outline_checker = LlmAgent(<br>    model=MODEL,<br>    name=&quot;outline_checker&quot;,<br>    instruction=(<br>        &quot;Review {blog_outline}. If it has a title, an intro, 4–6 sections, &quot;<br>        &quot;and a conclusion, reply with exactly OK. &quot;<br>        &quot;Otherwise reply RETRY and list what is missing.&quot;<br>    ),<br>    output_key=&quot;outline_feedback&quot;,<br>)</pre><p><strong>Step three — the retry loop.</strong> Wrap both in a LoopAgent, ADK&#39;s workflow (deterministic) agent type:</p><pre>from google.adk.agents import LoopAgent</pre><pre>robust_blog_planner = LoopAgent(<br>    name=&quot;robust_blog_planner&quot;,<br>    sub_agents=[blog_planner, outline_checker],<br>    max_iterations=3,<br>)</pre><p>The loop runs the planner, then the checker. On OK, it&#39;s done. On RETRY, it runs the planner again — up to three attempts. If the model forgets the conclusion, it gets another shot without a human noticing.</p><p>The writer follows the same shape: an LlmAgent that reads {blog_outline} and writes to blog_post, paired with its own validator, wrapped in its own loop. Its instruction specifies audience and depth — write for software engineers, skip the basics, explain the <em>why</em> alongside the <em>how</em>, include short code snippets.</p><p><em>Figure 5 — The full blog agent. The root agent sees two tools; every retry lives one level down.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dAENStmLOPFqwJnI48FZ9A.png" /></figure><p><strong>Step four — the root agent</strong>, which sees only the two loops, exposed as tools:</p><pre>from google.adk.tools.agent_tool import AgentTool</pre><pre>blogger = LlmAgent(<br>    model=MODEL,<br>    name=&quot;blogger&quot;,<br>    instruction=(<br>        &quot;Given a topic: first call the planner tool to build an outline, &quot;<br>        &quot;then call the writer tool to draft the post, &quot;<br>        &quot;then add three alternative titles and two tweet-length hooks.&quot;<br>    ),<br>    tools=[<br>        AgentTool(agent=robust_blog_planner),<br>        AgentTool(agent=robust_blog_writer),<br>    ],<br>)</pre><p>The root agent has access to exactly two tools, so its workflow is constrained and predictable. All the retry complexity is hidden one level down.</p><p><strong>The reusable lesson:</strong> pair every generator with a validator, and wrap the pair in a loop. It costs you one extra agent and buys you a system that self-corrects. If you outgrow the built-in workflow agents, ADK lets you subclass BaseAgent and define arbitrary control flow.</p><h3>7. Memory, layer by layer</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hyr_Ypg-ZMyl27Aodta5IQ.png" /><figcaption><em>Three layers of memory, and the point at which each one stops surviving.</em></figcaption></figure><p>Here’s a failure everyone hits. Turn one: “Plan a two-day trip to Lisbon.” The agent plans day one. Turn two, in a fresh session: “Perfect, plan day two.” The agent has no idea what city you meant.</p><p>Memory isn’t one feature. It’s three layers, each solving a different problem.</p><h3>Layer 1: Sessions and state (working memory)</h3><p>A <strong>session</strong> is one continuous conversation — one thread. ADK’s web UI defaults to InMemorySessionService, which is why creating a new session makes the agent behave like it just met you.</p><p>The fix at this layer is simply to <strong>reuse the same session across turns</strong>. Within one session, the agent can look back at everything and adapt.</p><p>Sessions contain two things worth distinguishing:</p><ul><li><strong>Events</strong> — the transcript. Every user message, every agent reply, tool calls, results, and media inputs like image data. This is what gives the model context.</li><li><strong>State</strong> — a small structured scratchpad. A restaurant name, a confirmation number, a boolean flag.</li></ul><p>Why have both? Because you don’t want the model re-reading fifteen messages to find one value. Store it once in state; read it directly.</p><p>State is also how agents hand off work. Agent A finds a restaurant and writes only the name to destination via output_key; Agent B receives destination as a variable. No transcript scraping required.</p><p><strong>One rule that will save you real debugging time:</strong> never modify the session object directly in your tool code. A direct mutation isn’t recorded in the event log, so a persistent service won’t save it — and it will silently vanish on restart. Always write through the context object ADK gives your tools and callbacks:</p><pre>def save_something(value: str, tool_context) -&gt; dict:<br>    tool_context.state[&quot;confirmation_number&quot;] = value<br>    return {&quot;status&quot;: &quot;saved&quot;}</pre><p>Writing through context records the change as an event, which means it can be stored and recovered later.</p><p>This layer gives your agent RAM: fast, useful, and gone on restart.</p><h3>Layer 2: Persistence (surviving restarts)</h3><p>Two things break when the app restarts: the conversation itself, and anything you knew about the user.</p><p><strong>Fix the conversation</strong> by swapping the storage engine. Your agent logic doesn’t change at all:</p><pre>from google.adk.sessions import DatabaseSessionService</pre><pre>session_service = DatabaseSessionService(db_url=&quot;sqlite:///./sessions.db&quot;)</pre><p>Now every message, reply, and state change is written to disk. When the user returns with the same session ID, the full history and latest state load back and the conversation continues. The usual pattern is a small get_or_create_session helper: try to fetch by ID, resume if it exists, create fresh if it doesn&#39;t.</p><p>Session service Persistence Use it for InMemorySessionService None — clears on restart Local prototyping DatabaseSessionService Your database (SQLite, Postgres) Self-hosted production VertexAiSessionService Managed on Google Cloud Cloud production, pairs with Memory Bank</p><p><strong>Fix personalization</strong> with something separate. Persistent sessions let a user resume <em>the same chat</em>. But when they open a <strong>new</strong> chat next week with a new session ID, there’s no transcript to read.</p><p>So add a small, structured preference store — one row per user_id + preference key. Dietary requirement, favorite museum type, preferred transport. Keep it small and structured so it&#39;s easy to curate and audit, and give the agent two tools:</p><ul><li>recall_user_preferences — read everything saved for this user</li><li>save_user_preference — insert or update a single key</li></ul><p>Both receive a context carrying the current user_id, so reads and writes are tied to the right person. Then instruct the agent explicitly:</p><ol><li><strong>Recall first</strong> — call recall_user_preferences at the very start of the conversation.</li><li><strong>Personalize</strong> using whatever you find.</li><li><strong>Ask</strong> whether there’s anything new worth remembering.</li><li><strong>Save last</strong> — call save_user_preference before finishing.</li></ol><p>The payoff is testable. Turn one, new user: recall returns nothing, agent proposes a plan and asks about preferences. User says they’re vegetarian; the agent saves it. Restart the app. Brand new session next week: recall fires, finds dietary = vegetarian, and the very first plan is already personalized.</p><h3>Layer 3: Memory Bank (long-term, semantic, multimodal)</h3><p>A structured preference table is deliberately narrow. It can’t hold “the user shared a photo of a historical building and seemed to love the architecture.”</p><p>That’s the job of a <strong>memory service</strong>, which is a different role from a session service:</p><ul><li><strong>Session service</strong> — manages <em>active chats</em>. Resume a live conversation.</li><li><strong>Memory service</strong> — manages the <em>long-term archive</em> across all conversations.</li></ul><p>Two options:</p><ul><li><strong>InMemoryMemoryService</strong> — fine for quick local tests. No persistence, basic keyword matching.</li><li><strong>VertexAiMemoryBankService</strong> — cloud-persisted, with semantic search. A query for &quot;two-wheeled vehicle&quot; can surface a note about a bicycle.</li></ul><p>Memory Bank isn’t a table; it’s a service that <em>processes</em> content. You configure an agent engine behind it with a model to extract facts from conversations and media, and a model to embed those facts for meaning-based retrieval. You can also define topics — user preferences, travel experiences — to organize what’s stored.</p><p><strong>Getting memories in.</strong> Two routes:</p><pre># Route 1: archive an entire session at the end of a conversation<br>await memory_service.add_session_to_memory(session)</pre><pre># Route 2: ingest facts directly, including from media files<br>await memory_service.add_memory(...)</pre><p>Route one processes user messages, agent replies, and image, video, and audio references, extracting the key facts. Route two lets you preload from a file — send an image, video, or audio clip with some text context and store the extracted facts directly, even if they never came from a chat.</p><p><strong>Getting memories out</strong>, automatically:</p><pre>from google.adk.agents import Agent<br>from google.adk.tools.preload_memory_tool import PreloadMemoryTool</pre><pre>agent = Agent(<br>    model=&quot;gemini-2.5-flash&quot;,<br>    name=&quot;personal_assistant&quot;,<br>    instruction=&quot;You are a helpful assistant who remembers past conversations.&quot;,<br>    tools=[PreloadMemoryTool()],<br>)</pre><p>PreloadMemoryTool runs at the start of every turn. It reads the user&#39;s new message, runs a semantic search against the memory bank, gathers the most relevant facts, and injects them into the prompt. Your agent needs no special logic — the context arrives enriched. (If you&#39;d rather the agent decide when to search, LoadMemoryTool does the same thing on demand.)</p><p><strong>What this looks like in practice.</strong> Session A: a user shares a photo of a historical building, a short video of the coast, and an audio note from a small town. The session is archived; the engine extracts facts like <em>likes historical architecture</em>, <em>enjoys coastal areas</em>, <em>visited this town</em>. Weeks later, session B — brand new, empty state — the user asks for a cultural destination recommendation “based on what I shared before.” Preload fires, finds those facts, and the agent recommends something that matches. That’s long-term multimodal recall.</p><h3>The three layers together</h3><p>Layer What it holds Survives Session + state Live conversation, working values The current chat only Persistent sessions + preference store Full transcript, curated user facts Restarts and new chats Memory Bank Archived conversations and media, searchable by meaning Weeks, months, any modality</p><h3>8. Long-running agents: the multi-day workflow</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dWVm9rtwVdmFyNmM51kCnw.png" /><figcaption><em>A multi-day onboarding workflow: durable checkpoints, dormant gaps, and zero compute between gates.</em></figcaption></figure><p>Most agent demos are effectively stateless. You ask, the model answers, the conversation ends. Even a fifteen-minute demo lives inside a single context window that eventually fills and gets discarded.</p><p>A <strong>long-running agent</strong> inverts that. It maintains state across sessions and operates over hours, days, or weeks. Its unit of work isn’t a prompt — it’s a <strong>workflow</strong>.</p><h3>The three walls that stop ordinary agents</h3><ol><li><strong>Context degradation.</strong> Long context windows still fill, and quality drops as they do. Without persistence, every session restarts from zero.</li><li><strong>Missing primitives for durable state.</strong> Without external structure, agents drift, break things, or give up because they can’t see the whole problem.</li><li><strong>Self-verification.</strong> An agent that can’t tell whether it’s finished is a problem. Worse, when an agent evaluates its own output it tends to overrate it — a pattern reported consistently across labs, including Anthropic’s research. Using one agent to write code and the same agent to review it produces confident mediocrity.</li></ol><h3>The three conditions for making it work</h3><p><strong>The agent must genuinely sleep.</strong> No active polling, no blocked thread burning compute while it waits. It should be fully dormant until an external event wakes it: a webhook, a schedule, a human approval, a tool callback.</p><p><strong>Every step needs a durable checkpoint.</strong> State must be persisted, not transient. Containers crash. Servers redeploy. A human might take four days to sign a document. The agent has to resume from exactly where it left off — with no hallucinated memory of intermediate steps that never happened.</p><p><strong>Evaluation must be separated.</strong> The state of the art here is a three-agent split: a <strong>planner</strong>, a <strong>generator</strong>, and a <strong>separate evaluator</strong>. Don’t let the author grade the paper.</p><h3>What it looks like in practice</h3><p>Consider an employee onboarding coordinator — a real open-source pattern documented by Google’s ADK team. The agent sends a welcome packet, then pauses. It may wait days for the new hire to sign documents. It delegates IT provisioning to a specialist sub-agent. It waits again for hardware delivery. Only then does it generate a personalized day-one schedule.</p><p>Watch what happens at each pause: the agent calls send_welcome_packet, logs the activity, and <strong>stops</strong>. It&#39;s genuinely dormant — the container can scale down, there&#39;s no polling loop, no spinning thread. It&#39;s waiting for an external event.</p><p>When the new hire signs, an ADK resume turn fires and the state advances. When a carrier webhook confirms laptop delivery (in the demo, a button; in production, a real shipping callback), the state advances again — and only then does the day-one schedule appear.</p><p>That ordering is deliberate. The agent runs steps in the sequence the state machine dictates and <strong>cannot be talked into skipping ahead.</strong></p><h3>The three properties that make this different</h3><ul><li><strong>Durable memory schema.</strong> State is an enum in a database, not raw JSON chat logs in a vector store. No context pollution, no token bloat after weeks of idle time.</li><li><strong>Event-driven dormancy.</strong> Between pause gates the agent is fully at rest, consuming nothing.</li><li><strong>Multi-agent delegation.</strong> The coordinator delegates IT provisioning to a specialist instead of doing everything itself, keeping each reasoning chain narrow and clean.</li></ul><p><strong>Where to apply this:</strong> anything with human-speed dependencies. Loan processing. Onboarding. Compliance review. Procurement. Any workflow where the bottleneck is a person or an external system, not the model.</p><h3>9. MCP: the protocol layer under all of this</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*29WUSDC08KtIOwmz_esJbA.png" /><figcaption><em>Bespoke integrations versus MCP — and the four-step handshake that replaces them.</em></figcaption></figure><h3>The problem with APIs as an integration layer</h3><p>For decades, APIs were the universal handshake. Define an endpoint, send a request, get a predictable response. For deterministic software, perfect.</p><p>Models broke the assumption. They don’t call one endpoint — they chain ten, interpret unstructured results, and ask follow-up questions. They don’t just need <em>access</em> to a tool; they need <strong>context</strong> about it.</p><p>An API is like a locked cabinet: you must already know which drawer to open and what shape the key is. A model is trying to figure out what’s inside without labels. So you hard-code the mapping, and then you explain it again in every prompt.</p><h3>What MCP changes</h3><p><strong>Model Context Protocol (MCP)</strong> is a standard way for agents to talk to external tools. Instead of teaching the model about each endpoint by hand, MCP gives it a machine-readable way to <em>discover</em> what a tool does, what inputs it expects, and what it returns.</p><p>The mechanics:</p><ol><li>The tool runs as its own process.</li><li>The agent connects over stdio (or HTTP/SSE for remote servers).</li><li>The agent asks: <em>what tools do you have?</em> The server replies with names, arguments, and return schemas.</li><li>The agent calls a tool by name with a JSON argument dict. The result comes back as JSON.</li></ol><p>The separation is the point. <strong>The agent doesn’t need to know how the tool is built, what libraries it uses, or what language it’s written in.</strong> If it speaks MCP, the agent can use it.</p><p>That buys you four things:</p><ul><li><strong>Isolation</strong> — a crashing tool doesn’t take the agent down.</li><li><strong>Interoperability</strong> — write tools in Python, Go, or Node; the agent doesn’t care.</li><li><strong>Discoverability</strong> — tools describe themselves, so agents figure out usage at runtime.</li><li><strong>Scalability</strong> — add, swap, or version tools without rewriting agent code.</li></ul><p>If the agent is the brain, MCP is the wire connecting it to hands and eyes.</p><h3>MCP vs. APIs — the framing that actually holds</h3><p>The comparison isn’t a competition. MCP doesn’t replace your backend; it <strong>replaces the bespoke middleware between the model and your API.</strong> An MCP server is a translator that turns existing APIs into something models can consume automatically.</p><p>The real shift is in <strong>who the client is</strong>. With an API, the client is another program. With MCP, the client is the <em>model</em>. That subtle change reframes every design decision:</p><p>API MCP Contract type Code-level, between two applications Semantic, between a model and its environment Built for Deterministic systems Probabilistic systems Client A program or user The model itself Integration cost Bespoke per service Build one interface, any compliant model uses it</p><p>The analogy worth holding onto: before HTTP, every service had its own protocol — FTP, Gopher, Telnet. Standardizing made everything interoperable overnight. MCP is attempting the same thing for AI tooling. Build one connector for your product and any compliant model can use it.</p><p><strong>The honest caveats.</strong> MCP is young. Adoption is the biggest open question — a protocol only works if the ecosystem agrees on it. Security is the second: when models can call tools directly, you need real permission layers, because you don’t want an agent sending an email or dropping a table it shouldn’t. The spec defines capabilities, scopes, and auth methods, and that work is ongoing. Third is mindset — most developers think in endpoints and routes; MCP asks you to think in capabilities and context, describing what a system <em>can do</em> rather than how to do it.</p><h3>Building an MCP server for your ADK agent</h3><p>The blog agent from earlier has a blind spot: it only knows what the model knows. It has no idea what’s trending right now. Connecting it to a Google Trends tool over MCP fixes that.</p><p>Create a server.py that exposes one tool. Think of it as a tiny web service that speaks MCP over stdio instead of HTTP.</p><p><strong>Wrap a plain Python function as an ADK tool:</strong></p><pre>from google.adk.tools.function_tool import FunctionTool</pre><pre>def trends(keyword: str) -&gt; dict:<br>    &quot;&quot;&quot;Fetch currently trending Google search queries for a keyword.&quot;&quot;&quot;<br>    ...<br>    return {&quot;trending&quot;: [...]}</pre><pre>trends_tool = FunctionTool(trends)</pre><p>FunctionTool inspects the signature and docstring and builds the schema for you. No manual schema writing.</p><p><strong>Create the server and handle discovery:</strong></p><pre>from mcp.server.lowlevel import Server<br>from mcp import types as mcp_types<br>from google.adk.tools.mcp_tool.conversion_utils import adk_to_mcp_tool_type</pre><pre>app = Server(&quot;trends-mcp-server&quot;)</pre><pre>@app.list_tools()<br>async def list_tools() -&gt; list[mcp_types.Tool]:<br>    return [adk_to_mcp_tool_type(trends_tool)]</pre><p>list_tools is how the agent discovers what this server can do. adk_to_mcp_tool_type converts the ADK tool&#39;s metadata into exactly what an MCP client expects — name, parameters, types, description. Everything needed to construct a valid call at runtime.</p><p><strong>Handle execution:</strong></p><pre>import json</pre><pre>@app.call_tool()<br>async def call_tool(name: str, arguments: dict) -&gt; list[mcp_types.TextContent]:<br>    if name != trends_tool.name:<br>        return [mcp_types.TextContent(type=&quot;text&quot;, text=json.dumps({&quot;error&quot;: &quot;unknown tool&quot;}))]<br>    try:<br>        result = await trends_tool.run_async(args=arguments, tool_context=None)<br>        return [mcp_types.TextContent(type=&quot;text&quot;, text=json.dumps(result))]<br>    except Exception as e:<br>        return [mcp_types.TextContent(type=&quot;text&quot;, text=json.dumps({&quot;error&quot;: str(e)}))]</pre><p>The protocol is genuinely simple: <strong>name plus arguments in, JSON out.</strong> Errors return small JSON payloads; details go to stderr.</p><p><strong>Attach to stdio and run</strong>, then wire it into your agent. On the client side, ADK’s McpToolset handles connection, discovery, schema adaptation, and call proxying:</p><pre>from google.adk.tools.mcp_tool.mcp_toolset import McpToolset, StdioConnectionParams</pre><pre>trends_mcp = McpToolset(<br>    connection_params=StdioConnectionParams(<br>        server_params={&quot;command&quot;: &quot;python&quot;, &quot;args&quot;: [&quot;server.py&quot;]}<br>    )<br>)</pre><pre>blogger = LlmAgent(<br>    model=MODEL,<br>    name=&quot;blogger&quot;,<br>    instruction=&quot;Check what&#39;s trending before planning the post...&quot;,<br>    tools=[<br>        AgentTool(agent=robust_blog_planner),<br>        AgentTool(agent=robust_blog_writer),<br>        trends_mcp,<br>    ],<br>)</pre><p>From the agent’s perspective, calling trends looks exactly like calling a local function. But now, instead of inventing what&#39;s popular, it fetches real trending queries before writing a word.</p><p><strong>Why this pattern is worth adopting:</strong> it keeps your agent lightweight while letting it reach the real world through swappable external tools. The agent doesn’t grow every time you add a capability.</p><h3>10. Putting it together</h3><p>The through-line across all of this is that reliability in agent systems comes from <strong>structure, not from better prompts</strong>.</p><p>A practical checklist:</p><ul><li><strong>Start with the loop.</strong> Reason, act, observe, adjust. Everything else is scaffolding around it.</li><li><strong>Match the pattern to the problem.</strong> Sequential for predictable, reactive for dynamic, planning for dependent steps.</li><li><strong>Write specific instructions.</strong> Describe the artifact you want — its sections, its length, its audience. Vague instructions are the largest source of variance.</li><li><strong>Pair every generator with a validator, and loop.</strong> Cheap insurance against forgotten conclusions and malformed output.</li><li><strong>Never let an agent grade its own work.</strong> Planner, generator, evaluator — separate.</li><li><strong>Give each agent one job</strong>, then compose with AgentTool. It improves debuggability, cost control, and model routing all at once.</li><li><strong>Choose your memory layer deliberately.</strong> Sessions for the current chat. A database session service plus a preference store for returning users. Memory Bank for semantic, multimodal, long-horizon recall.</li><li><strong>Write state through context</strong>, never by mutating the session directly.</li><li><strong>For long-horizon work, insist on all three:</strong> true dormancy, durable checkpoints, separated evaluation.</li><li><strong>Expose tools over MCP</strong> rather than hard-wiring integrations, and build the connector once.</li></ul><p>None of these are exotic. They’re the difference between an agent that demos well and one that still works on day forty.</p><p>To start building, visit <a href="https://adk.dev/"><strong>adk.dev</strong></a> and work through the getting-started guide. The first agent takes about five minutes. The interesting part starts right after.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff4295001547" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Context Engineering, One Year In: From CLAUDE.md to Dreaming]]></title>
            <link>https://medium.com/@itissaad25/context-engineering-one-year-in-from-claude-md-to-dreaming-75439b1d90a6?source=rss-dd23210354df------2</link>
            <guid isPermaLink="false">https://medium.com/p/75439b1d90a6</guid>
            <category><![CDATA[agent-memory]]></category>
            <category><![CDATA[agentic-workflow]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[intelligence]]></category>
            <dc:creator><![CDATA[Saad]]></dc:creator>
            <pubDate>Mon, 03 Aug 2026 07:31:47 GMT</pubDate>
            <atom:updated>2026-08-03T07:32:16.573Z</atom:updated>
            <content:encoded><![CDATA[<h3>How agent memory systems actually get built, what breaks the moment they hit production, and the out-of-band process designed to fix it</h3><p>Models get better every few months. Agents in production often don’t, and the reason usually has nothing to do with model capability. It’s that the agent has no idea what happened last time.</p><p>The field’s answer to this is context engineering, and it has moved remarkably fast. Roughly twelve months separate the first crude version of agent memory from the architectures being deployed today, and in that time the community has converged on a small set of primitives that hold up, discarded several that don’t, and run headfirst into a category of problems that only appear at scale.</p><h3>Intelligence doesn’t compound. Context does.</h3><p>New models ship constantly, and each one raises the ceiling. But deploy one into a real environment, with its own codebase, users, and internal conventions, and intelligence alone doesn’t compound. The model needs context specific to the work being asked of it.</p><p>Much of that context is essentially orthogonal to intelligence. No frontier model knows, out of the box, what it takes to succeed inside a particular organisation. Additional reasoning capability doesn’t fix that, because it isn’t a reasoning problem. It’s a knowledge problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OkrUtdMTvGOK2YBQo6PAbg.png" /></figure><p><em>Figure 1. Every release lifts the floor for everyone. The gap is what you taught the model about your work.</em></p><p>This is what makes context engineering such a durable investment. It acts as a <em>multiplier</em> on intelligence, and it keeps multiplying as the models underneath improve.</p><p>The symptoms of its absence are familiar to anyone running agents:</p><ul><li>The agent doesn’t know its way around the codebase.</li><li>It doesn’t know user preferences, so the same correction gets made every session.</li><li>Most importantly, it isn’t better at the task the second time than the first. There’s no learning curve. Every session starts from zero.</li></ul><h3>A year of doing the simple thing that works</h3><p>Anthropic has an internal phrase it leans on here: <em>do the simple thing that works.</em> The progression below spans about twelve months, and it’s a fairly clean demonstration of that principle, including the part where each simple thing eventually runs out of room.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1uAGlmlLqSW8LIDdyQyxlg.png" /></figure><p><em>Figure 2. Four primitives in twelve months. Each one solved the previous ceiling, then found its own.</em></p><h3>Step 1: CLAUDE.md</h3><p>Claude Code shipped with support for a CLAUDE.md file: a markdown file in the repo, injected into context at the start of a session, holding a handful of instructions about the codebase, the organisation, and user preferences.</p><p>It was unreasonably effective. A few hundred words of plain markdown proved enough to steer an agent toward what mattered and align its actions with how a team works. No retrieval pipeline, no embeddings, no vector store.</p><p>The limits showed up quickly. Because the file loads up front, every byte is a byte paid for on every session, relevant or not. So:</p><ul><li>The file grows. Someone adds a section. Nobody deletes anything.</li><li>Context fills with instructions that don’t apply to the task at hand.</li><li>There’s no lifecycle. Nothing indicates which lines are still true.</li></ul><p>Static injection has a low ceiling. But the underlying insight held, and it’s worth stating plainly: <strong>a human-readable file that both the human and the agent can write to is a great memory primitive.</strong></p><h3>Step 2: Memory tools, or letting the agent hold the pen</h3><p>The next step was giving agents tools to manage their own memory, deciding when to read, when to write, and when to update.</p><p>This happens <em>in-band</em>, meaning inside a live session. Mid-task, the agent makes judgement calls about what’s worth pulling from memory and what’s worth writing back. Anthropic’s implementation of this is deliberately file-shaped: the memory tool exposes create, read, update, and delete operations over a memory directory, and it runs client-side, so the application decides where the data actually lives.</p><p>The finding was that autonomy works. Given file-shaped operations, models are good at deciding what deserves to be remembered. Notably, the tooling has become <em>less</em> opinionated about the shape of those operations over time, not more.</p><h3>Step 3: Skills, or the bookshelf</h3><p>Skills address the ever-growing-context problem through a mechanism called <strong>progressive disclosure</strong>.</p><p>Skills suit procedural work: cases where there’s a defined view on how a process should run end to end. The clever part is the loading strategy. At startup, only the YAML frontmatter is read, roughly a name and a description of when the skill applies, on the order of a hundred tokens each. The body is read once the skill is judged relevant, and any files the body references are read only if the task reaches for them.</p><p>The result is arbitrarily deep detail without paying for it up front. A project can carry many skills for the price of a table of contents.</p><p>The bookshelf is the analogy that makes it concrete. You can scan the spines of every book on a shelf almost for free, then pull one down when the conversation calls for it. Someone starts speaking French; you notice a French dictionary and reach for it. The context arrives exactly when it becomes useful, rather than having sat through seven years of French lessons and paying to keep all of it resident.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SRbK4cUXaRaKyVEinfZdPQ.png" /></figure><p><em>Figure 3. Three levels of loading. Only the index is always resident.</em></p><p>The bottleneck with skills is that authorship remains a joint human-and-agent activity. Even when agents help write them, someone is still being opinionated about which things deserve a skill in the first place. Someone has to notice the gap.</p><h3>Step 4: The filesystem is the memory system</h3><p>Which leads to what the team describes as current best practice: <strong>model the memory system as a filesystem.</strong></p><p>This aggregates everything above:</p><ul><li>Fill it with markdown. Humans can read it, agents can read it, diffs are legible.</li><li>Let agents use the tools they’re already extremely good at. bash, grep, glob. Don&#39;t invent a bespoke memory API and force the model to learn it.</li><li>Index it well so search is cheap, which reproduces progressive disclosure at the memory layer rather than the skill layer.</li></ul><p>Four things carry over from the whole progression:</p><ol><li><strong>Markdown is the right format</strong> for memories that get read.</li><li><strong>Let memory grow large.</strong> Don’t fight it.</li><li><strong>Give agents fast tools to index and search it</strong> so size never becomes a context cost.</li><li><strong>Give agents autonomy on the write path.</strong></li></ol><p>Build this and it works. The continual-learning effect is real and noticeable: agents get better at the tasks they’re repeatedly asked to do.</p><h3>Then it goes to production</h3><p>Every neat idea meets production eventually. Once many agents run concurrently, over long horizons, against complicated codebases, the failure modes arrive in a queue.</p><p><strong>Concurrent writes.</strong> Two agents update the same memory file at the same time. One of them silently loses. Which one?</p><p><strong>Blast radius.</strong> One agent hits a confusing problem and concludes it should correct the organisation-wide context that every other agent reads from. If that conclusion is wrong, a bad instruction has just been deployed to the entire fleet.</p><p><strong>No audit trail.</strong> Humans and agents both edit the same memory base. Who wrote this line, and on what basis? A week later, nobody can say.</p><p><strong>Staleness.</strong> Something true in March is wrong in August, and nothing in the system notices.</p><p><strong>Memory poisoning.</strong> This is the most serious of the five. If an injected instruction reaches memory, it stops being a single-session problem and becomes persistent. Memory is a write path into every future session and deserves to be treated like one.</p><p>Autonomous memory needs guardrails before it survives real deployment. Four keep recurring in production designs.</p><h3>Four primitives that make autonomous memory safe</h3><h3>1. Versioning</h3><p>Versions need to be stored, so changes are visible and a bad update can be rolled back.</p><p>The important part goes beyond the diff, though: capture <strong>provenance</strong>.</p><ul><li>Which session or transcript produced this update?</li><li>Which actor made it, and was it an agent or a human?</li><li>What was the reasoning?</li></ul><p>A memory entry without provenance is an assertion nobody can audit. With it, the entry becomes evidence that can be evaluated.</p><p>One pattern worth borrowing, visible in how Anthropic’s own Dreams API is built, is treating the input store as immutable. Consolidation reads a store read-only and writes a <em>new</em> output store, which is then adopted deliberately. Nothing gets clobbered in place.</p><h3>2. Concurrency</h3><p>What happens when a thousand agents share one memory store?</p><p>The approach Anthropic uses is hash-based. When an agent wants to write:</p><pre>hash_before = hash(memory_file)      # read<br>edit        = draft_edit(...)        # think<br>hash_after  = hash(memory_file)      # re-read at commit time</pre><pre>if hash_before == hash_after:<br>    commit(edit)                     # nobody moved<br>else:<br>    reload()                         # someone got there first<br>    redraft()                        # rebase the thinking<br>    retry()</pre><p>If the hashes don’t match, something changed while the agent was drafting, and the write is rejected. The agent re-pulls the memory, redrafts against the new state, and tries again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8MKjmbXgKL22GlF-YUct_w.png" /></figure><p><em>Figure 4. The commit is rejected if the file moved while the agent was drafting.</em></p><p>This is optimistic concurrency control, the same shape as an HTTP If-Match header, a compare-and-swap loop, or a git rebase. Which is rather the point: these are ordinary engineering practices, applied to a new kind of writer.</p><h3>3. Permissioning</h3><p>Large memory bases are naturally tiered. At the top sits carefully curated organisation-wide knowledge: what the company is trying to do, hard-won principles about the codebase. At the bottom sits an agent’s scratchpad, which is working memory and nothing more. Team, project, and workspace scopes fall in between.</p><p>Those tiers do not deserve the same write permissions.</p><pre>/memory<br>  /org              # read-only to most agents. High blast radius, human-curated.<br>  /team             # writable by a defined group<br>  /project          # writable by agents on this workspace<br>  /agent/&lt;id&gt;       # scratchpad. Full read/write. Blast radius of one.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zgrOSUwwbYNg86lW8MXU_Q.png" /></figure><p><em>Figure 5. Write access and blast radius should move in opposite directions.</em></p><p>An agent should be able to write freely to its own scratchpad. It should not be able to unilaterally decide the org-wide context was wrong. Where an agent believes a high-tier memory needs changing, the correct output is a <em>proposal</em>, not a commit.</p><h3>4. Portability</h3><p>This one is peripheral to correctness and central to value. Curated memory is likely to become one of the more valuable assets an organisation holds: org, user, and task-specific context, refined over time.</p><p>Given that investment, it should be reachable from every surface and system that could use it, rather than trapped inside one product. Designing it behind a clean API from the start is what makes that possible, and it’s why Anthropic exposes memory as a standalone API outside the agent system itself. Running your own pipelines over memory, scanning it for sensitive data, tidying it periodically, or syncing it elsewhere all follow from that decision.</p><h3>What the payoff looks like</h3><p>Combining creative autonomy with those guardrails produces consistent reported results:</p><p><strong>Better accuracy.</strong> The second attempt is meaningfully better than the first, because the agent wrote down what went wrong.</p><p><strong>Lower cost and latency, as a second-order effect.</strong> Agents that know what they’re doing one-shot more tasks and burn fewer tokens getting there. Better and cheaper usually trade off. Here they don’t.</p><p><strong>Reclaimed attention for the team.</strong> Once agents write their own memories, developers spend their time on product while the learning loop runs underneath. That’s the underrated part. Set the infrastructure up properly and it becomes symbiotic.</p><h3>The ceiling of in-band memory</h3><p>And then comes the next wall.</p><p>Everything so far is <em>in-band</em>: the agent reads and writes memory inside the session it’s working in. A Claude Code session reasons largely about the context in front of it. Architecturally, that carries two limits.</p><p><strong>Split focus and resources.</strong> The agent is asked to do the task <em>and</em> to invest in curating memory that helps some future run. That’s a genuinely awkward optimisation problem. How much capacity should it spend helping future versions of itself versus doing the thing it was actually asked to do? Every token spent on curation is also latency the user feels now.</p><p><strong>No cross-session visibility.</strong> The agent sees only its own session, by construction. It cannot see patterns across sessions. When a user is frustrated that their agent has made the same mistake four days running, the agent has no idea how annoying that is, because it got a fresh context window each time. The same holds across a fleet: one agent has no view of what’s failing for the others.</p><p>Separately, staleness never solves itself. Something has to check that what’s written down is still true.</p><h3>Dreaming: memory curation, out of band</h3><p>Anthropic’s answer is a second-order process over memory, which it calls <strong>dreaming</strong>. It went into research preview in May 2026 for Managed Agents, the company’s hosted agent harness.</p><p>The analogy that makes it click is a school. Students submit a lot of work. Teachers mark it. A head teacher reviews across the whole cohort. That structure exists in the real world for good reasons: some people need dedicated capacity for helping others learn, and someone needs enough visibility across the cohort to spot patterns and adjust the curriculum.</p><p>The resulting stack has three layers:</p><ol><li><strong>Context.</strong> The actual memories agents reference.</li><li><strong>Memory processes.</strong> In-band and autonomous, agents managing their own context as they work.</li><li><strong>Dreaming.</strong> Batch, asynchronous, with its own resource allocation, whose only job is ensuring the memories themselves are effective and current.</li></ol><h3>How a dream works</h3><p>The mechanics are simple to describe. Take an existing memory store and a batch of recent session transcripts, and hand them to an agent whose entire job is reviewing them. In the Dreams API, that means one memory store plus up to a hundred prior sessions, producing a new output store rather than editing the original.</p><p>Crucially, “transcript” means more than the back-and-forth between agent and user. It includes tool calls, tool results, which skills were loaded, and the surrounding metadata. That’s usually where the signal is. A misconfigured tool shows up in the calls long before it shows up in the prose.</p><p>In the production design described at the talk, an orchestrator fans out a fleet of sub-agents to analyse the transcripts, then reviews what comes back and decides where a pattern is prevalent enough to justify changing memory. For each proposed change, it returns:</p><ul><li>the change itself,</li><li>example transcripts where the pattern was observed,</li><li>statistics on how often it occurred and why that justifies an update.</li></ul><p>A human then accepts or rejects. It reads like reviewing a pull request, which is more or less the right mental model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*opqSv4QgYHqE3zsUI2fkeg.png" /></figure><p><em>Figure 6. A dream reads a memory store and a batch of transcripts, then hands back proposed changes with evidence.</em></p><p>One thing worth emphasising: <strong>the process is steerable.</strong> Both the memory-writing agents and the dreaming process take direction about what matters in a given context and what doesn’t. Curating the curator is available, and it should be used.</p><h3>Three things a dream catches</h3><p><strong>A missing topic.</strong> The head teacher notices every geography student answered one question with complete garbage. Checking the curriculum, the topic isn’t in there at all. That’s not a student problem, it’s a curriculum gap. The fix is a new memory, and tomorrow’s cohort has what it needed.</p><p><strong>A misconfiguration.</strong> In a maths exam, every answer is wrong the same way: everyone output radians where degrees were required. One instruction about calculator settings fixes the entire cohort. In agent terms, that’s spotting from the transcripts that a tool is wired up wrong, which no individual session would ever diagnose as systemic.</p><p><strong>A fleet-wide preference.</strong> Every agent overuses em-dashes and the organisation dislikes it. That’s an org-wide context change, and exactly the kind of thing only a fleet-level view surfaces.</p><h3>Two loops, two clock speeds</h3><p>The end state is two processes running in parallel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nn0pjqNjl8hMHd_xJ4w89A.png" /></figure><p><em>Figure 7. Same store, two cadences: one that pays off in the next session, one that pays off across the fleet.</em></p><p><strong>In-band memory</strong> spends session resources writing down what seems important. Fast feedback loop: the very next session is better. But it competes for resources with the task, and it’s blind past its own context window.</p><p><strong>Dreaming</strong> runs out of band with dedicated token budget and fleet-wide visibility. Slower loop, much wider aperture, and its resources aren’t taken from anything user-facing.</p><p>The obvious objection is cost. Why spend extra compute curating memory? But set against what good memory stores do to the numbers, agents one-shot more tasks because they finally have the information they needed. A meaningful share of the spend returns as retries nobody pays for.</p><h3>“Aren’t we just reinventing databases?”</h3><p>The sharpest question from the audience. Versioning, concurrency control, durability, permissions: at what point is this rebuilding a database from first principles?</p><p>The answer, to some extent, yes, and deliberately so. The real work is threading a needle: finding the right boundary between what agents do autonomously and what should simply be baked into the harness deterministically.</p><p>The starting point was agents writing markdown and committing whatever they wanted. Having observed which primitives hold up, those are now being codified in the harness. The hashing and the versioning are software engineering practices that already earned their place, reshaped so an autonomous agent can interact with them cleanly.</p><p>So the convergence back toward established practice is real, and it’s a sign of maturity rather than confusion. There’s now enough signal to know those pieces should be deterministic, and no reason to reinvent the wheel.</p><p>A related audience question: how does dreaming respect permissions when hundreds of users have different access? It composes better than expected, because the operator chooses which session transcripts a dream is allowed to read. A dream doesn’t have to mean “everything from the last 24 hours.” The selection step can mirror whatever permissioning the agents already have, so a dream over a given memory store only ever sees transcripts cleared for that scope.</p><h3>Where to start</h3><p><strong>At minimum, do the simple thing that works.</strong> A CLAUDE.md. A few skills. Autonomous memory management. Context management makes an enormous difference to agent performance and the starting cost is close to zero.</p><p><strong>At scale, add guardrails.</strong> Many agents, long horizons, workspaces under development for months, complex domains: that’s when memory management needs to be safe, verifiable, and auditable. Versioning, concurrency, permissioning, portability.</p><p><strong>Then close the loop out of band.</strong> Add something like dreaming to consolidate: cut what’s no longer relevant, add what agents are missing, reorganise what’s there.</p><p>One clarification, because coding examples dominate this conversation: none of it is coding-specific. Presentation work is a good example of the same pattern, where memory accumulates preferences about phrasing and slide layout and improves over time. Any task performed repeatedly with an agent is a candidate.</p><h3>Where this goes</h3><p>Almost everything described here emerged in the space of twelve months. It remains an open area of research and development rather than a settled playbook, which is precisely what makes it one of the higher-leverage places to be building right now.</p><p>The talk closes on an instruction that fits: keep thinking, keep learning, keep dreaming.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75439b1d90a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Is Actually Happening Inside a Transformer]]></title>
            <link>https://medium.com/@itissaad25/what-is-actually-happening-inside-a-transformer-4bbff6c34033?source=rss-dd23210354df------2</link>
            <guid isPermaLink="false">https://medium.com/p/4bbff6c34033</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[transformers]]></category>
            <category><![CDATA[evolution-of-ai]]></category>
            <dc:creator><![CDATA[Saad]]></dc:creator>
            <pubDate>Thu, 30 Jul 2026 13:10:42 GMT</pubDate>
            <atom:updated>2026-07-30T13:10:42.875Z</atom:updated>
            <content:encoded><![CDATA[<h3>A visual, unhurried walk through the number crunching behind large language models and why it fits a GPU so well</h3><p>I’m going to assume you’re maximally curious. That you actually want to know what the machine is doing, not just what it’s for. Here’s the thing I want you to walk away with.</p><p>Most people know that large language models eat an enormous amount of computation, and anyone who has glanced at NVIDIA’s market cap knows that computation happens on GPUs, because the work is parallelizable. Fine. But “it’s parallelizable” is a label, not an understanding. What I want is for you to have a visceral, down-to-your-bones sense of what those computations <em>are</em> ; what numbers are being multiplied by what, and why that particular shape of arithmetic happens to be a gift to a machine with tens of thousands of cores.</p><p>Transformers were introduced in 2017, in a paper with one of the best titles in the field: <em>Attention Is All You Need</em>. That paper was aimed at machine translation , think Google Translate. Since then the architecture has spread absurdly far: transcription, speech synthesis going the other direction, image classification, protein structure, code. It’s a remarkably flexible frame.</p><p>The model we’ll look at is a little simpler than the one in that paper. It’s the kind that underlies chatbots.</p><h3>Part 1: The whole job is guessing the next token</h3><p>Our model does one thing. You feed it a piece of text, and it predicts what comes next.</p><p>Feed it <em>“To date, the cleverest thinker of all time was”</em> and it will produce a guess. But , and this matters ; it does not produce <em>a</em> guess. It produces a probability distribution over its entire vocabulary. Every possible next token gets a number, and those numbers sum to one.</p><p>For that particular prompt the distribution is fairly spread out, because a lot of continuations are reasonable. Some of the probability mass goes to names. A surprising amount goes to hedging words like <em>probably</em>, <em>arguably</em>, <em>undoubtedly</em> because that’s how humans actually write sentences like that.</p><p>Once you have a model that does this, you get a text generator almost for free:</p><ol><li>Run the model, get a distribution.</li><li>Sample a token from it, weighted by those probabilities.</li><li>Tack that token onto the end of your input.</li><li>Run the whole extended thing through the model again.</li></ol><p>Repeat. That’s it. That’s autoregressive generation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eOUQrdf9wNCeWYhbnTJByQ.png" /></figure><p><em>Every token you see stream onto your screen is one full trip around this loop. Note that the sampled token isn’t the most likely one , that’s temperature at work.</em></p><p>People often ask why you’d ever sample instead of just taking the most likely token. You can — that’s what setting <strong>temperature</strong> to zero does. Formally, temperature T rescales the logits before the softmax, pᵢ ∝ exp(zᵢ / T) so T → 0 collapses the distribution onto its argmax and large T flattens it toward uniform. In practice, greedy decoding gives you prose that is stilted and a little trite. A spark of randomness is what makes the output read as natural, and occasionally as creative.</p><p>To get from “next-token predictor” to “chatbot,” the crudest version is just clever seeding. You write some text establishing a scene: a user talking to a helpful AI assistant. You paste in whatever the person typed. You append the suggestion that what follows is the assistant’s reply. Then you let the model generate, one token at a time.</p><p>I find it genuinely surprising that this works.<em> A machine whose only objective is guess the next word ends up producing text that appears to plan, to hold a thread across paragraphs, to know things.</em> Some of that comes from <em>how</em> it makes the prediction, and how long-range the associations it can draw on are. So let’s get into it.</p><h3>Part 2: The flow, from a great height</h3><p>Before any details, here’s the shape of the pipeline.</p><p><strong>Tokenize.</strong> The input text is chopped into little pieces called <strong>tokens</strong> usually words, fragments of words, or punctuation.</p><p><strong>Embed.</strong> Each token is mapped to a long list of numbers, a vector. Think of that vector as encoding the <em>meaning</em> of the token. At this stage it is literally a lookup table: the same token always starts life as the same vector.</p><p><strong>Attention.</strong> These vectors are passed through an attention block, which lets them talk to each other and pass information around. A vector that started out meaning nothing but “the word <em>mole</em>” can come out the other side meaning something much more specific.</p><p><strong>MLP.</strong> Then each vector, independently, goes through a multi-layer perceptron, a couple of matrix multiplications with a nonlinearity sprinkled between them.</p><p><strong>Repeat, a lot.</strong> Attention, MLP, attention, MLP. GPT-3 does this 96 times. The thing that makes deep learning deep is this stubborn repetition of one kind of operation.</p><p><strong>Unembed and predict.</strong> At the very end, you take the <em>last</em> vector in the sequence, multiply it by one more big matrix to project it back out to vocabulary size, and softmax the result. Out comes your probability distribution.</p><p><em>The one picture I’d want you to keep. Vectors flow left to right down a central lane; each block reads from it, computes a correction, and adds that correction back.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VrhYnFHOZiIDzGp4dMkByA.png" /></figure><p>Two notes on that.</p><p>On attention: the reason you need it at all is that words are ambiguous. Consider <em>American shrew mole</em>, <em>one mole of carbon dioxide</em>, and <em>take a biopsy of the mole</em>. You and I read those and understand three unrelated concepts, entirely because of context. The model’s initial embedding of <em>mole</em> can’t possibly know which one it’s in. So you need a mechanism that lets the surrounding tokens reach over and edit that meaning. And it’s not only disambiguation, ideally you want the essence of the entire passage to become available to whichever vector needs it.</p><p>On only using the last vector: it feels wasteful, given you’ve just computed a whole sequence of context-rich vectors. But during <em>training</em> it isn’t wasteful at all, because every vector in the sequence is simultaneously used to predict the token that follows <em>it</em>. One passage of text becomes thousands of training examples. Hold onto that it’s about to force a design decision on us.</p><h3>Part 3: Why tokens instead of characters?</h3><p>Worth sitting with for a moment. Characters feel like the natural atomic unit of text. There are only a hundred or so of them, the vocabulary is tiny and closed, no weird edge cases. So why doesn’t anyone do it?</p><p>I’ll come back to this once we’ve seen the machinery, because the answer only makes sense afterward. Keep the question warm.</p><h3>Part 4: Meaning as geometry</h3><p>The first step → turning words into vectors → long predates transformers. It’s been part of natural language processing for years.</p><p>One reason you have to do it is mundane: gradient-based learning wants inputs and outputs that live in a continuous space, so you can take derivatives. Words are discrete symbols; vectors are not. Embedding is how you get the problem into a realm where calculus applies.</p><p>But the fun part is what <em>structure</em> shows up in that space once you’ve trained the thing on real language.</p><p>The first pattern is clustering. Look at the nearest neighbors of <em>tower</em> in a simple word2vec model and you get a neighborhood of tall-construction-adjacent words. A region of the space corresponds to a loose idea.</p><p>The second pattern is much stranger and much more useful: <strong>directions carry meaning too.</strong></p><p>The classic demonstration is from a 2013 paper by some Google researchers, <em>Efficient Estimation of Word Representations in Vector Space</em>. Take the embedding of <em>woman</em>, subtract the embedding of <em>man</em>, and you get a difference vector. Add that difference to <em>king</em>, look for the nearest embeddings to where you land, and you find yourself very close to <em>queen</em>.</p><p>It’s a mathematical way of playing the analogy games from an old SAT.</p><p><em>Two dimensions standing in for twelve thousand. The point isn’t where the words sit, it’s that the same short vector connects both pairs.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nWvGZbtrzXo8QxVOlDWZcQ.png" /></figure><p>If you try reproducing this yourself with a small pretrained word2vec model, it’s worth knowing that it works but messily. The literal nearest neighbor to that point is often <em>king</em> itself, with <em>queen</em> a close second. Which, thinking about it, makes sense: <em>queen</em> doesn’t appear in text purely as the feminine of <em>king</em>. There’s the band. There’s <em>drag queen</em>. The word carries baggage in directions that have nothing to do with gender. Family relationships behave much more cleanly the gap between <em>uncle</em> and <em>aunt</em> really does look a lot like the gap between <em>man</em> and <em>woman</em>.</p><p>The upshot is worth stating plainly, because it’s the intuition that everything later depends on: somewhere in the mush of gradient descent, the model came to devote <strong>one specific direction in the space</strong> to something like the notion of gender. Adding a small vector along that direction moves you from a masculine embedding to a feminine one. Nobody designed that. It fell out of the optimization.</p><p>There are dozens of these. <em>Japan</em> → <em>sushi</em> points roughly the same way as <em>Germany</em> → <em>bratwurst</em>.</p><h3>How many ideas fit in 12,288 dimensions?</h3><p>We can draw three-dimensional vectors. These are not three-dimensional. In GPT-3 the embedding has <strong>12,288 coordinates</strong>.</p><p>And you can see why you’d want it big: if distinct concepts want distinct directions, you’d like a generous supply of distinct directions.</p><p>But here’s the thing that makes 12,288 feel small. These vectors are not just holding the meaning of one word. As they flow through the network, they need capacity to absorb whatever is relevant from the context. Take Frost:</p><blockquote><em>Two roads diverged in a wood, and I took the one less traveled by…</em></blockquote><p>The token <em>one</em> enters the transformer as a generic embedding of <em>one, </em>a number, maybe a pronoun, nothing more. To predict what comes next, it would help to know it refers to one of <em>two roads</em>. It would help even more to have soaked up the higher-level, harder-to-articulate content: that this is standing in for choice, and what the choice is between. If those ideas can be written into the vector, they’re available for prediction. And anyone who has spent time with these models has had the uncanny feeling that something like that really is going on.</p><p>Seen that way, 12,288 directions for every concept and shade of concept in human language doesn’t feel like much at all.</p><p>So two questions here:</p><p><strong>Q# 1.</strong> In an n-dimensional space, how many vectors can you fit such that every pair is exactly 90° apart?</p><p><strong>Q# 2.</strong> How many can you fit such that every pair is <em>almost</em> perpendicular — say, anywhere between 88° and 92°?</p><p>To answer the questions, we can fit n vectors such that every pair is exactly 90° apart. That’s essentially what dimension <em>means</em> for a vector space. In 3D, that four-degree slack buys you nothing; one can wiggle three axes a bit and that’s the end of it. The low-dimensional intuition is badly wrong. The answer grows <strong>exponentially in n</strong>.</p><p><em>Note the log scale on the right. Insisting on exact perpendicularity buys you n directions; allowing four degrees of slop buys you a number with dozens of digits.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WSZ-nddrrbC80cxQ8xmxdQ.png" /></figure><p>This is the flavor of the Johnson–Lindenstrauss lemma, play with it numerically: in 100 dimensions you can comfortably pack hundreds of thousands of vectors that are all mutually near-orthogonal. Push to 1,000 dimensions and verifying the packings gets computationally annoying long before you run out of room.</p><p>This explains two things at once.</p><p>It explains how a model can cram far more concepts into a space than that space has dimensions the <strong>superposition hypothesis</strong>, if you want the search term. Features don’t need their own axis; they only need directions that interfere with each other tolerably little.</p><p>And it hints at why scale works so surprisingly well. Going from 10 to 100 dimensions doesn’t give you ten times the room. Going from 100 to 1,000 doesn’t give you ten times the room either. The capacity grows superlinearly, and the exponential regime doesn’t even kick in until you’re reasonably large.</p><p>So for the rest of this piece, when I say “imagine some direction in this space encodes such-and-such an idea,” I’m making up the specific example to motivate the structure but I’m not making up something implausible.</p><h3>Part 5: Inside a single attention head</h3><p>Now the main event. I’m going to tell you a small lie, in the sense that I’ll motivate the mechanism with a tidy example that a real model almost certainly does not implement this tidily. The mechanism is exact; the story about what it’s <em>for</em> is a teaching device.</p><p>Take the phrase:</p><blockquote><em>a fluffy blue creature roamed the verdant forest</em></blockquote><p>I want to think about how the nouns get updated by the adjectives.</p><p>At the start, each vector knows almost nothing. The vector for <em>fluffy</em> is some abstract fluffiness, unattached to anything. The vector for <em>creature</em> is a generic creature. What we want is for those to talk, so that the fluffiness and the blueness get baked into <em>creature</em>.</p><p>One thing to flag first: the initial vectors don’t only encode the word. They also encode <strong>position</strong> in the sequence. (Original transformers added a sinusoidal positional encoding; most modern models use something like rotary embeddings, which rotate the query and key vectors by an angle proportional to position.) This matters philosophically, not just technically. The whole design commitment is that everything stays parallelizable, which means order cannot be something the model infers from the <em>order in which it processes things</em> it never processes things in order. If sequence matters, it has to be readable off the state of the vector itself.</p><p>The second design commitment: express everything as <strong>matrix multiplication</strong>. Not because there’s a law requiring it, but because matrices full of tunable parameters are what gradient descent and backpropagation are good at, and because matrix multiplication is what a GPU is physically built to do. Linear operations also have beautifully simple derivatives, so nothing hairy accumulates.</p><p>So: how do we let one token influence another, using nothing but matrices with learnable weights?</p><p>Three matrices. <strong>Query</strong>, <strong>key</strong>, and <strong>value</strong>.</p><h3>Query</h3><p>Think of the query matrix as letting each token ask a question. <em>Creature</em> would like to ask: “hey! are there any adjectives sitting just in front of me?” Right now it can’t see its context. It knows it’s a noun and it knows where it is.</p><p>Nothing literally asks anything. What happens is that we multiply the embedding by a matrix W₍Q₎ to get a much smaller vector, the <strong>query</strong>. Where the embedding is 12,288-dimensional, queries are typically 64 or 128. In GPT-3, d₍head₎ = 128.</p><p>The hope is that W₍Q₎ has learned to look at a vector and say: this is a noun, in such-and-such position, and the question it should be asking is <em>is there an adjective just before me?</em></p><p>Picture it as projecting from the huge space down into a small space in order to pose the question.</p><p>And you don’t do this to one token. You do it to <em>every</em> token, with the same matrix. Which raises the obvious objection: what is W₍Q₎ producing for all the tokens that aren’t nouns? Honestly: who knows. Presumably something else useful, in parallel. We’re building a toy example to motivate a structure.</p><h3>Key</h3><p>Simultaneously, multiply every embedding by a different matrix W₍K₎ to produce a <strong>key</strong>, living in that same small space.</p><p>Keys are the answers. Keys and queries are trained together, so that if the query from <em>creature</em> encodes “looking for an adjective before me,” then the key produced by <em>fluffy</em> and <em>blue</em> encodes “I am an adjective, and I am there.”</p><p>What does “corresponds to” mean numerically? It means the two vectors <strong>point in the same direction</strong>. That’s why keys and queries have to live in the same space.</p><h3>Measuring alignment: the dot product</h3><p>How do you check whether two vectors point the same way, using only multiplication and addition? Dot product. It’s positive when they align, zero when they’re perpendicular (which we read as <em>unrelated</em>), negative when they oppose.</p><p>So take every query, take every key, and compute the dot product of every possible pair. You get a grid.</p><p>I like to draw that grid as dots, with size standing in for magnitude. In our example, the column belonging to <em>creature</em> would have two fat dots, one in the <em>fluffy</em> row, one in the <em>blue</em> row and small dots everywhere else.</p><p>There’s standard jargon here: we say those tokens <strong>attend to</strong> <em>creature</em>.</p><p><em>Top: how two 12,288-dimensional vectors become a single number between 0 and 1. Bottom: why the value map is split in two rather than left as one enormous square matrix.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VYdF7Lk6fyljc8fNLc60jQ.png" /></figure><h3>Turning scores into weights: softmax</h3><p>What we want to do next is take a weighted sum down each column: the strongly-attending tokens should count a lot, <em>the</em> and <em>roamed</em> should count for essentially nothing.</p><p>But these numbers aren’t weights. They’re dot products, which can be large, negative, anything. To be weights they need to be non-negative and sum to one.</p><p>The tool is the <strong>softmax</strong>. Exponentiate everything, then normalize. Any list of real numbers goes in; a list between 0 and 1 summing to 1 comes out, with big inputs getting most of the mass and small inputs pushed near zero.</p><p>It’s called <em>soft</em>max because if one input dominates, the output is nearly a spike on that entry like taking a maximum. But it’s smooth: nudge the inputs and the output changes continuously. Which, again, is what you need if calculus is going to run through this thing.</p><p>Apply softmax down each column independently.</p><p>One detail I glossed: before the softmax you divide by √dₖ, the square root of the key/query dimension. The reason is scale. If the components of q and k are roughly independent with unit variance, the dot product of two dₖ-dimensional vectors has variance around dₖ, so raw scores grow with dimension, and a softmax on huge inputs saturates and kills its own gradient. Dividing keeps things in a sane range. It’s a numerical-stability fix, not a conceptual one.</p><p>Put together, the whole thing is one line:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aD0gNJljm0ib0Ui3z4RLJg.png" /></figure><p>Every mystery in this section is contained in that formula.</p><h3>The mask</h3><p>One more nuance before we use the pattern, and it comes straight back to that training trick.</p><p>When the model processes <em>the fluffy blue creature roamed the verdant forest</em>, it makes a prediction at <em>every</em> position after <em>the</em>, after <em>fluffy</em>, after <em>blue</em>, and so on. That’s the efficiency win: a context of a few thousand tokens gives you a few thousand training examples on one forward pass, all updating the same weights.</p><p>But if attention lets every vector see every other vector, then when the model is trying to predict what follows <em>creature</em>, the token <em>roamed</em> is sitting right there in the input, and the answer is simply handed over. The exam has the answer key stapled to it.</p><p>So we have to forbid later tokens from influencing earlier ones. Every entry in the grid corresponding to a future token attending to a past position must be zeroed out.</p><p>Naively setting those entries to zero breaks normalization, the columns no longer sum to one. You could zero and then renormalize. The more elegant move is to set them to <strong>negative infinity before the softmax</strong>. Exponentiating −∞ gives exactly 0, and the softmax normalizes what remains automatically. One operation, both problems.</p><p>This gives you a <strong>masked</strong> attention pattern, also called causal self-attention. Causal because the past may shape the future and not the reverse.</p><p><em>One head’s worth of bookkeeping for eight tokens. Read down the highlighted column: only fluffy and blue have any real say in what happens to creature.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rjzDRQ83CJOx71T8TyguOQ.png" /></figure><p>Two things worth pausing on here.</p><p>First, the size of this pattern is n times n for a context of n tokens. It grows <strong>quadratically</strong>. This is exactly why you cannot take a vanilla transformer and casually crank the context window to a million tokens. Every model boasting a very long context is doing something cleverer sparse or sliding-window attention, linear approximations, better memory layouts like FlashAttention, or some combination.</p><p>Second, at generation time there’s massive redundancy. Each new token nominally reruns the entire network over the entire sequence but the keys and values for all the previous tokens are identical to last step’s. So you cache them. That’s the <strong>KV cache</strong>, and it’s why the quadratic blowup bites hardest during training and on the first forward pass over a long prompt, rather than on every token you watch stream onto your screen.</p><h3>Value: actually doing the update</h3><p>We now know which tokens are relevant to which. How does the update happen?</p><p>Throw another matrix at it. The <strong>value</strong> matrix. Multiply it by the embedding of <em>fluffy</em>, and it should produce a vector such that <em>adding</em> that vector to the embedding of a noun nudges that noun in a direction encoding fluffiness. Multiply it by <em>blue</em> and you get a different nudge. Add both to <em>creature</em> and you land somewhere that means, specifically, a fluffy blue creature.</p><p>A naive value matrix would map the embedding space to itself: 12,288 times 12,288 approx 151 million parameters, against about 1.5 million each for W₍Q₎ and W₍K₎. That’s roughly a hundred to one, which is at minimum inelegant.</p><p>So the value map is factored. First down to the small head dimension, then back up to the embedding space. Same overall shape, far fewer parameters, a <strong>low-rank</strong> transformation, if you like linear algebra. In practice the “up” halves of all the heads get concatenated into one output projection matrix W₍O₎, which is why you’ll see four matrices per head in the parameter count. It also happens to be exactly what makes multi-head attention compose neatly, which is next.</p><p>Now: multiply every embedding by the value matrix to get a value per position. Then, down each column, take the weighted sum of those values using the attention weights. For <em>creature</em>, nearly every weight is zero and only the two adjectives contribute.</p><p>Call the result Delta E. What comes out of the attention block at that position is <strong>the original vector plus Delta E</strong>.</p><p>That’s the whole mechanism. Not a replacement, an <em>addition</em>. The vector that flowed in continues to flow, slightly edited. People call this the <strong>residual stream</strong>, and it’s worth noticing that residual connections aren’t bolted onto transformers the way they were retrofitted onto deep convolutional nets to fight vanishing gradients. They’re the load-bearing structure from the start. Every block reads from the stream, computes a correction, and writes it back.</p><h3>Part 6: Now do that a hundred times at once</h3><p>Everything above describes a <strong>single attention head</strong>. Which is already a lot to hold: a query matrix, a key matrix, a value factorization, an n times n pattern, a masked softmax, a weighted sum.</p><p>In one forward pass of a large model, that happens on the order of ten thousand times.</p><p>Each attention block contains many heads running fully in parallel — GPT-3 uses 96 per block each with its own W₍Q₎,W₍K₎ and value maps, each producing its own attention pattern and its own proposed changes. Every one of those proposals gets added to the residual stream.</p><p>Because adjectives-modifying-nouns is just <em>one</em> of countless ways context could matter. Adverbs modifying verbs. Pronouns finding their antecedents. And plenty that isn’t grammatical at all , a name mentioned forty tokens ago, an established tone, a variable defined earlier in a function. Anything where information from one part of a passage needs to reach another part in order to sharpen the next prediction has to happen through this same query/key/value machinery: <em>what is relevant to what</em>, and <em>what change should that relevance produce</em>.</p><p>Then stack blocks. Attention, MLP, attention, MLP, 96 times over. Vectors accumulate richer meanings, drawn from a context that is itself getting richer with every layer. By the end, the last vector isn’t really “the meaning of the last token” anymore. It’s whatever it needs to be to predict what comes next.</p><p>Let’s do the arithmetic for GPT-3, because the numbers are clarifying:</p><ul><li>Per head: four matrices of 12,288 times 128, about 6.3M parameters.</li><li>Per block: × 96 heads ≈ 604M.</li><li>All attention: × 96 layers ≈ 58 billion.</li><li>The MLP expands to 4 × 12,288 = 49,152 and back: about 1.2B per block, so ≈ 116 billion.</li></ul><p>Total: roughly 175 billion. Which means that despite the title of the paper, attention is about <strong>one third</strong> of what you need.</p><p><em>Worth sitting with. The block everyone writes about holds a third of the weights; the block everyone skips holds two thirds.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B61pVQBRrdsPm7rx7xx6CA.png" /></figure><h3>Part 7: So what are the MLPs doing?</h3><p>Two thirds of the parameters live in the block I’ve been waving past, so it deserves a paragraph.</p><p>Structurally it’s simple: project each vector up by a factor of four, apply a nonlinearity (GELU, typically), project back down. Crucially it acts on each position <em>independently</em> , no token talks to any other inside an MLP. All the communication happened in attention.</p><p>What is it <em>for</em>? Hard question, and interpretability research is still chewing on it. But here’s a suggestive result. Have a model autocomplete <em>“Michael Jordan plays the sport of ___”</em> and it correctly says <em>basketball</em>. That answer was nowhere in the context. It cannot have arrived by passing information between tokens, because no token contained it. So somewhere in the weights learned during training sits the fact that Michael Jordan plays basketball. Work probing where athlete-to-sport associations are stored keeps pointing at the MLPs, and the popular picture is that these layers behave something like key-value memories.</p><p>So here’s a useful, if lossy, mental split: insofar as prediction requires <strong>context</strong>, that’s attention. Insofar as it requires <strong>general knowledge about the world</strong>, the MLPs are where there’s room to keep it. Not a hard boundary. But a serviceable one.</p><h3>Part 8: The part where none of this is designed</h3><p>I should be explicit about something, because it changes how you should read everything above.</p><p>At no point does anyone tell the network to look for adjectives. The entire framework of machine learning is the opposite of that. You provide a flexible structure characterized by a large number of tunable real parameters hundreds of billions of them you show it an enormous number of input/output examples, and you have a procedure that says <em>you did badly on this one, shift the weights this way.</em> Run that for long enough and behavior emerges inside the structure.</p><p>The examples, here, are free: snippets of text scraped from the internet, and the word that actually followed.</p><p>The cost on a single example is the negative log of the probability assigned to the token that actually occurred. If the model was confident and right, −log(p) ≈ 0. If it assigned the true token a tiny probability, the cost climbs steeply. Average that over trillions of examples and you have your loss.</p><p>The picture people carry around is a surface. With two input parameters you can plot cost as height and get a landscape, and learning is walking downhill. Now replace two parameters with a hundred and seventy-five billion. The metaphor survives, barely: you are taking small steps downhill on an unimaginably high-dimensional surface, and where you end up is whatever basin you happened to fall into.</p><p>Which is precisely why understanding what a trained model <em>does</em> is a completely separate problem from understanding what the architecture <em>is</em>. This piece has been about the second thing. I’ve used motivating stories about adjectives and nouns because they make the structure memorable, and I want to be honest that they are scaffolding. The question of what these models are actually computing internally remains substantially open, and it’s one of the more interesting scientific problems going.</p><h3>Part 9: The character question, revisited</h3><p>Now we can answer it.</p><p><strong>Context cost.</strong> Characters mean roughly four to five times as many tokens for the same text, and attention scales quadratically in sequence length. That’s a factor of twenty or more in the attention pattern, for the same passage. Brutal.</p><p><strong>Wasted depth.</strong> If a token is a single letter, the first several layers have to be spent assembling letters into anything meaning-bearing before the interesting work can start. Word-ish tokens let the very first embedding lookup jump straight to something meaningful.</p><p>But there’s a balancing act, because tokens can’t be too <em>large</em> either. A token needs to appear often enough in training data for the model to learn a good embedding for it. If your tokens were paragraphs, each one would occur roughly once ever, and you’d learn nothing.</p><p>The compromise that works in practice is <strong>byte pair encoding; </strong>start from bytes, repeatedly merge the most frequent adjacent pair, stop at a vocabulary of some tens of thousands. Out come common words as single tokens, rare words split into fragments, and nothing ever fully unrepresentable. In the back of your mind: words, pieces of words, punctuation.</p><h3>Part 10: Why did this one win?</h3><p>Deep learning has cycled through a lot of architectures. Since 2017, transformers have marched into field after field. A few reasons stand out.</p><p><strong>Scale alone matters.</strong> One of the hard-won lessons of the last decade is that making a model bigger and feeding it more data can produce <em>qualitative</em> improvements, not just marginal ones. There are scaling laws about this, not mathematical laws, more like well-fit empirical regularities that predict loss from parameter count and training compute. And falling loss keeps translating into behavior you can see.</p><p><strong>If scale matters, parallelism matters.</strong> Earlier NLP read text the way you and I do: start at the beginning, move left to right, update as you go. That’s inherently sequential — step t waits on step t-1. Strip that away and leave only attention, and the model ingests the entire passage at once, all positions letting all other positions edit them simultaneously. That’s deeply weird if you try to empathize with it. It is also exactly the shape of computation a GPU wants, which means more useful floating-point operations per second of training time.</p><p><strong>No labels required.</strong> Because the objective is <em>predict the next token</em>, the supervision is already inside the data. No humans labeling images, no annotated corpora. This is why we call it <strong>pre-training, </strong>you burn most of your compute on this unsupervised phase, and only afterward bring humans into the loop with reinforcement learning to shape a raw predictor into something that behaves like an assistant. But the overwhelming majority of the arithmetic is unsupervised, which is what lets scale be the lever.</p><p><strong>Anything can be a token.</strong> We’ve talked about text, but nothing in the mechanism cares. Chop up whatever you have, embed the pieces as vectors, add positional information, and attention will happily let them all talk. Text and images and audio can be equal citizens in a single space, rather than requiring bespoke architectures glued together with a bespoke interface.</p><p>That last point raises a fair objection, which I’ll close on. Text and audio are essentially one-dimensional — you read left to right, you listen through time. Images are not. The pixel above matters more than the pixel at the far end of the same row. How do you tokenize that?</p><p>Roughly: <strong>patches</strong>. Little square tiles of the image become tokens, and the positional encoding carries both x and y, so each patch’s vector knows where it sits in two dimensions. The naive version bloats badly ; you end up with either far too many tokens or tokens too small to be meaningful so real systems get cleverer, and there are variants that factor attention row-wise and column-wise rather than all-pairs. But the two-dimensionality doesn’t get lost. It mostly lives in the positional encoding.</p><p>There’s plenty more to say. We could spend a whole piece on the MLPs. We could dig into superposition and the clever tricks interpretability researchers use to find feature directions when there are far more features than dimensions. We could ask why we’re doing all of this in high-precision digital arithmetic at all, given that the model is fundamentally tolerant of error, a question I don’t have a satisfying answer to beyond noting the enormous head start that decades of optimizing digital matrix multiplication has bought.</p><p>But if you take away one thing, let it be the formula, unpacked:</p><p>Attention(Q, K, V) = softmax((QKᵀ) / √dₖ) V</p><p>Every token proposes a question. Every token advertises an answer. Dot products score the matches, a softmax turns scores into weights, a mask forbids peeking at the future, and a weighted sum of values gets <em>added</em> back into the stream. Do that in a hundred heads at once, stack it ninety-six times, and out the other end comes something that finishes your sentence.</p><p>It’s all just matrices. That’s the point.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4bbff6c34033" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>