<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: soohan abbasi</title>
    <description>The latest articles on DEV Community by soohan abbasi (@soohan_abbasi).</description>
    <link>https://dev.to/soohan_abbasi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3928507%2F0c2e7853-8258-4f70-ae6c-5915eeba921a.png</url>
      <title>DEV Community: soohan abbasi</title>
      <link>https://dev.to/soohan_abbasi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/soohan_abbasi"/>
    <language>en</language>
    <item>
      <title># Agentic AI: Architecture of Autonomous Systems</title>
      <dc:creator>soohan abbasi</dc:creator>
      <pubDate>Sun, 31 May 2026 12:30:00 +0000</pubDate>
      <link>https://dev.to/soohan_abbasi/-agentic-ai-architecture-of-autonomous-systems-1b7d</link>
      <guid>https://dev.to/soohan_abbasi/-agentic-ai-architecture-of-autonomous-systems-1b7d</guid>
      <description>&lt;p&gt;&lt;em&gt;"A language model that answers questions is a tool. A language model that decides which questions to ask and then acts on the answers is something else entirely."&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Introduction: When Models Started Deciding
&lt;/h2&gt;

&lt;p&gt;For the first several years of modern NLP, the task was always the same: given input, produce output. One forward pass. One completion. Done.&lt;/p&gt;

&lt;p&gt;In 2022, a paper from Google Brain asked a different question. What if, instead of producing an answer directly, a model could &lt;em&gt;reason&lt;/em&gt; about what information it needs, &lt;em&gt;act&lt;/em&gt; to retrieve it, and &lt;em&gt;revise&lt;/em&gt; its thinking based on what it found?&lt;/p&gt;

&lt;p&gt;The paper was &lt;strong&gt;ReAct: Synergizing Reasoning and Acting in Language Models&lt;/strong&gt; (Yao et al., 2022). Applying it to an LLM created something qualitatively different: a model that could take real-world actions and adapt its reasoning based on what came back.&lt;/p&gt;

&lt;p&gt;A completion model is a calculator. An agent is a process: it has a goal, takes steps toward it, and updates when things go wrong. This week I went deep on the architecture behind these systems, the frameworks that define them, and what the open problems look like from a research perspective.&lt;/p&gt;




&lt;h2&gt;
  
  
  Part 1: What Makes a System "Agentic"?
&lt;/h2&gt;

&lt;p&gt;The word "agent" gets used loosely in current literature. A clean definition comes from Russell and Norvig's &lt;em&gt;Artificial Intelligence: A Modern Approach&lt;/em&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;An agent is anything that perceives its environment through sensors and acts upon that environment through actuators.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For an LLM-based system, this is a loop: perceive an observation, reason about what to do, act via a tool call or output, observe the result, and loop again. But not every loop qualifies as agentic. Three properties distinguish genuinely agentic systems from tool-augmented chatbots:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Property&lt;/th&gt;
&lt;th&gt;What It Means&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Goal persistence&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Maintains the original goal across multiple steps without re-prompting&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Adaptive planning&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Revises its approach based on intermediate results&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Tool autonomy&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Decides &lt;em&gt;when&lt;/em&gt; and &lt;em&gt;which&lt;/em&gt; tools to use, not just how to use one it was told to call&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Most production systems in 2026 satisfy the first two reliably. The third, genuine tool autonomy where an agent discovers appropriate tools from scratch, is still largely unsolved.&lt;/p&gt;




&lt;h2&gt;
  
  
  Part 2: The Core Frameworks
&lt;/h2&gt;

&lt;h3&gt;
  
  
  ReAct: Reasoning and Acting Together
&lt;/h3&gt;

&lt;p&gt;The core contribution of ReAct (Yao et al., ICLR 2023) is structuring the model's output as alternating Thought and Action blocks.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Thought: I need current statistics on LLM deployment.
Action: search("LLM production deployment 2025")
Observation: 68% of enterprises report using LLMs in production workflows...
Thought: Enough context. I can now answer the original question.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two things happen here that do not happen in single-pass completion. The model commits to a reasoning step before acting, and every action has a traceable reason. The original paper evaluated ReAct on HotpotQA and ALFWorld. On both tasks it outperformed chain-of-thought alone, with the largest gains on problems requiring multiple sequential lookups.&lt;/p&gt;

&lt;p&gt;The intuition: chain-of-thought helps a model reason over information it already has. ReAct helps it &lt;em&gt;acquire&lt;/em&gt; what it needs, then reason over it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What ReAct does not solve.&lt;/strong&gt; It is reactive. If the first three steps go down the wrong path, there is no mechanism to step back and reconsider.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr7ar0ip5ohdd7dnvrxfq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr7ar0ip5ohdd7dnvrxfq.png" alt=" " width="800" height="800"&gt;&lt;/a&gt;)&lt;br&gt;
&lt;em&gt;Figure 1: The ReAct agent loop — Perceive, Reason, Act, Observe. Every action traces back to a reasoning step.&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Reflexion: Learning From Failure Without Gradient Updates
&lt;/h3&gt;

&lt;p&gt;Reflexion (Shinn et al., NeurIPS 2023) addresses exactly that. After each failed attempt, the agent generates a verbal self-reflection analyzing what went wrong. This is stored in a memory buffer and prepended to context at the start of the next episode.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[Episode 1 fails]
Reflection: "I searched by title, which broke on the colon. Next time: search by author and year."

[Episode 2]
Agent searches "Shinn 2023 language agent" and succeeds.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The model improves across attempts through language, not weight updates. On HumanEval, Reflexion improved pass@1 by approximately 10 percentage points over a ReAct baseline. On AlfWorld, after 3 reflection cycles, success rate reached 97% on seen environments.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fol03xnlw47ntr81o6bor.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fol03xnlw47ntr81o6bor.png" alt=" " width="800" height="491"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Figure 2: Reflexion vs ReAct on HumanEval and AlfWorld. Numbers from Shinn et al., NeurIPS 2023.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The fundamental limitation.&lt;/strong&gt; The memory buffer lives in the context window. As episodes accumulate, early reflections get pushed out. True long-term learning from experience requires something outside the context window entirely.&lt;/p&gt;

&lt;h3&gt;
  
  
  Multi-Agent Frameworks
&lt;/h3&gt;

&lt;p&gt;Single-agent systems face one bottleneck: one model handling planning, retrieval, tool use, and synthesis simultaneously. Multi-agent frameworks decompose this. The standard pattern has an orchestrator that breaks the goal into subtasks, specialist agents that handle each, and an aggregator that synthesizes the result.&lt;/p&gt;

&lt;p&gt;The three dominant frameworks take meaningfully different approaches:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Framework&lt;/th&gt;
&lt;th&gt;Communication Model&lt;/th&gt;
&lt;th&gt;Key Distinction&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;AutoGen&lt;/strong&gt; (Microsoft, 2023)&lt;/td&gt;
&lt;td&gt;Agents converse with each other&lt;/td&gt;
&lt;td&gt;Human-in-the-loop as a first-class citizen&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;CrewAI&lt;/strong&gt; (2024)&lt;/td&gt;
&lt;td&gt;Role-based delegation&lt;/td&gt;
&lt;td&gt;Each agent has an explicit role and goal&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;LangGraph&lt;/strong&gt; (LangChain, 2024)&lt;/td&gt;
&lt;td&gt;Directed graph with shared state&lt;/td&gt;
&lt;td&gt;Explicit control flow, most debuggable in production&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;LangGraph models the entire workflow as a directed graph: nodes are agents, edges are transitions. This makes execution paths readable and failures traceable, which matters significantly in production.&lt;/p&gt;




&lt;h2&gt;
  
  
  Part 3: Memory Architecture
&lt;/h2&gt;

&lt;p&gt;Memory is where most agentic systems underperform. The naive approach of keeping everything in context breaks at scale. A well-designed agent needs four distinct memory types:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In-context memory&lt;/strong&gt; is the active context window. Fast and immediate, but size-limited and cleared between sessions. Use for current task state and the ongoing reasoning chain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;External memory&lt;/strong&gt; is a persistent vector database. Facts are stored as embeddings and retrieved by cosine similarity. This is essentially RAG applied to the agent's own accumulated knowledge rather than a document corpus.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Episodic memory&lt;/strong&gt; is a log of past trajectories: what the agent did, what succeeded, what failed. Reflexion's verbal buffer is a simple version. More sophisticated implementations store full (observation, action, outcome) tuples and retrieve by similarity, enabling few-shot learning from experience without retraining.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Procedural memory&lt;/strong&gt; is the agent's fixed capabilities: tool schemas and system prompts. What it contains, particularly how tools are described, has outsized influence on behavior.&lt;/p&gt;

&lt;p&gt;The memory architecture determines the learning capacity of the system. Getting the interaction between these layers right is still an open engineering and research problem.&lt;/p&gt;




&lt;h2&gt;
  
  
  My Experiment: Building the Architecture From Scratch
&lt;/h2&gt;

&lt;p&gt;Most tutorials on agentic AI use LangChain or AutoGen. For this week, I deliberately avoided both and built a minimal ReAct agent using only the Anthropic API. The goal was not to produce novel empirical results — it was to understand what these frameworks are actually abstracting away.&lt;/p&gt;

&lt;p&gt;The pipeline has four tools: &lt;code&gt;web_search&lt;/code&gt;, &lt;code&gt;memory_store&lt;/code&gt;, &lt;code&gt;memory_retrieve&lt;/code&gt;, and &lt;code&gt;final_answer&lt;/code&gt;. The orchestrator is Claude running in tool-use mode. Memory is a simple cosine similarity store over embeddings. Two queries run sequentially, sharing the same memory instance, so facts retrieved in Query 1 are available to Query 2.&lt;/p&gt;

&lt;p&gt;To be clear about what this is and is not: this is an architectural walkthrough, not an empirical study. The outcome — that a warm memory store reduces tool calls — is exactly what theory predicts. I was not testing whether it works. I was making visible &lt;em&gt;how&lt;/em&gt; it works, because the mechanism only becomes concrete when you can see every tool call in sequence rather than having a framework handle it silently.&lt;/p&gt;

&lt;p&gt;Two things became clear that I had not fully appreciated from reading papers alone. First, tool description quality matters more than I expected. A vague tool description produces inconsistent selection — the model sometimes calls &lt;code&gt;web_search&lt;/code&gt; when &lt;code&gt;memory_retrieve&lt;/code&gt; was the right first step, purely because the description did not make the priority explicit. This is a grounding problem that frameworks handle through opinionated defaults, which means when their defaults are wrong, you often cannot see why. Second, the memory store without real semantic embeddings is brittle. I used mock embeddings seeded by text hash, which are consistent but not meaningful. On queries where surface-level keyword overlap is low, retrieval fails entirely. The framework abstracts this away. Building without it made the failure visible immediately.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frif1pxxwgf279xim2eel.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frif1pxxwgf279xim2eel.png" alt=" " width="800" height="329"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Figure 3: Agent trace showing cold start (Query 1, 4 steps) vs warm &lt;br&gt;
start (Query 2, 2 steps). Facts stored in Query 1 were retrieved &lt;br&gt;
directly in Query 2, eliminating web search entirely.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The full code is in the GitHub repo linked below. The more interesting exercise, which I plan to run properly in a later week, is a controlled comparison of prompted versus trained agents on a fixed benchmark — ideally reproducing part of the Reflexion evaluation on AlfWorld to see whether my numbers match the paper.&lt;/p&gt;




&lt;h2&gt;
  
  
  Part 4: Failure Modes in Production
&lt;/h2&gt;

&lt;p&gt;Agentic systems fail in ways that single-pass models do not, and the failures follow predictable patterns.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tool call loops.&lt;/strong&gt; The agent calls the same tool repeatedly with slightly different inputs without making progress. This happens when the tool returns unhelpful results and the agent has no mechanism for declaring failure. Step limits and explicit "I cannot find this" states help.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hallucinated observations.&lt;/strong&gt; The model predicts what a tool would return rather than waiting for the actual result. It is a context management error and subtle to catch without logging every call.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Memory poisoning.&lt;/strong&gt; An incorrect fact stored early gets retrieved for related queries and contaminates future reasoning. Errors compound. Confidence-weighted storage and verification before storing are partial mitigations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Goal drift.&lt;/strong&gt; Past roughly 15 steps, agents frequently lose track of the original objective and optimize for the most recent subtask. Re-injecting the original goal into every system prompt turn reduces this.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt injection.&lt;/strong&gt; A web search result or document contains text designed to override the agent's instructions. This is a real attack vector in production, not a theoretical one.&lt;/p&gt;

&lt;p&gt;Each has partial mitigations. None has a clean solution.&lt;/p&gt;




&lt;h2&gt;
  
  
  What We Still Do Not Know
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Is prompting-based agency enough?&lt;/strong&gt; Current agents improve through prompting: ReAct, Reflexion, tool descriptions, with no weight updates. As tasks grow longer and environments more complex, will this hit a ceiling? If training-based agents eventually replace prompted ones, what does that change about interpretability and control?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do you evaluate trustworthiness?&lt;/strong&gt; An agent scoring 80% on SWE-bench may still fail unpredictably on cases outside the benchmark distribution. We do not have frameworks for measuring agent reliability statistically, just average performance on fixed task sets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Memory or fine-tuning for domain adaptation?&lt;/strong&gt; When specializing an agent for a domain, is it better to give it a rich external memory store or to fine-tune on domain trajectories? The tradeoffs in cost, latency, generalization, and catastrophic forgetting are not well characterized.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can we formally bound agent behavior?&lt;/strong&gt; A calculator is provably correct within its domain. An LLM agent is evaluated empirically on benchmarks. There is no formal framework for specifying what an agent will and will not do, analogous to how formal verification works for software. Whether this is achievable for learned systems is an open question.&lt;/p&gt;




&lt;h2&gt;
  
  
  Papers Worth Reading
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Paper&lt;/th&gt;
&lt;th&gt;Contribution&lt;/th&gt;
&lt;th&gt;Venue&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Yao et al. (2022)&lt;/td&gt;
&lt;td&gt;ReAct: Reasoning + Acting loop&lt;/td&gt;
&lt;td&gt;ICLR 2023&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Shinn et al. (2023)&lt;/td&gt;
&lt;td&gt;Reflexion: Verbal self-reflection for improvement&lt;/td&gt;
&lt;td&gt;NeurIPS 2023&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wu et al. (2023)&lt;/td&gt;
&lt;td&gt;AutoGen: Multi-agent conversation framework&lt;/td&gt;
&lt;td&gt;arXiv 2023&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Schick et al. (2023)&lt;/td&gt;
&lt;td&gt;Toolformer: Self-supervised tool learning&lt;/td&gt;
&lt;td&gt;NeurIPS 2023&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Liu et al. (2023)&lt;/td&gt;
&lt;td&gt;AgentBench: Evaluating LLMs as agents&lt;/td&gt;
&lt;td&gt;ICLR 2024&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Park et al. (2023)&lt;/td&gt;
&lt;td&gt;Generative Agents: Simulating believable behavior&lt;/td&gt;
&lt;td&gt;UIST 2023&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Research Groups Doing Interesting Work
&lt;/h2&gt;

&lt;p&gt;Stanford NLP (Yao et al.) is extending agent reasoning with Tree-of-Thought and beyond. Princeton NLP (Shinn et al.) continues on self-improvement mechanisms. Microsoft Research is focused on multi-agent reliability in production. DeepMind is working on agent training at scale through SIMA. LangChain's infrastructure team publishes pragmatic findings on what actually breaks in production.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benchmarks Worth Knowing
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;AgentBench&lt;/strong&gt; evaluates agents across 8 environments including code, database, and web tasks. &lt;strong&gt;WebArena&lt;/strong&gt; tests realistic web navigation. &lt;strong&gt;SWE-bench&lt;/strong&gt; is the most demanding: real GitHub issues requiring working code fixes. &lt;strong&gt;ALFWorld&lt;/strong&gt; is the interactive environment from the original ReAct paper. &lt;strong&gt;ToolBench&lt;/strong&gt; evaluates tool selection across a large library.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Agentic AI is not primarily a model story. The models have not changed fundamentally. What changed is the architecture around them. ReAct gave agents a structured reasoning-action cycle. Reflexion gave them a mechanism to improve from failure within a session. Multi-agent frameworks gave them specialization. Memory systems gave them persistence across queries.&lt;/p&gt;

&lt;p&gt;The hard problems are real. Long-horizon planning still drifts. Memory poisoning is still a live issue. Prompt injection has no clean solution. There is no formal way to guarantee agent behavior.&lt;/p&gt;

&lt;p&gt;But the direction is clear. The next frontier for LLMs is not better completions. It is better decisions.&lt;/p&gt;




&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Yao, S., et al. (2022). ReAct: Synergizing Reasoning and Acting in Language Models. &lt;em&gt;ICLR 2023&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Shinn, N., et al. (2023). Reflexion: Language Agents with Verbal Reinforcement Learning. &lt;em&gt;NeurIPS 2023&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Wu, Q., et al. (2023). AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation. &lt;em&gt;arXiv:2308.08155&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Schick, T., et al. (2023). Toolformer: Language Models Can Teach Themselves to Use Tools. &lt;em&gt;NeurIPS 2023&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Liu, X., et al. (2023). AgentBench: Evaluating LLMs as Agents. &lt;em&gt;ICLR 2024&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Park, J. S., et al. (2023). Generative Agents: Interactive Simulacra of Human Behavior. &lt;em&gt;UIST 2023&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Russell, S., and Norvig, P. (2020). Artificial Intelligence: A Modern Approach, 4th ed. Pearson.&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;em&gt;This is part of a weekly series on AI/ML research. Each post covers theory, recent papers, and experiments I run myself.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Connect on &lt;a href="https://www.linkedin.com/in/soohan-abbasi-36267b183/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;  |     [GitHub]: &lt;a href="https://github.com/soohanAbbasi/weekly-AI-ML-research/tree/main/week3-agentic-ai" rel="noopener noreferrer"&gt;weekly-AI-ML research&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>agenticai</category>
      <category>llmagents</category>
      <category>react</category>
      <category>multiagent</category>
    </item>
    <item>
      <title>Small Language Models: Rethinking What Intelligence Actually Requires</title>
      <dc:creator>soohan abbasi</dc:creator>
      <pubDate>Sun, 24 May 2026 12:30:00 +0000</pubDate>
      <link>https://dev.to/soohan_abbasi/small-language-models-rethinking-what-intelligence-actually-requires-3fjb</link>
      <guid>https://dev.to/soohan_abbasi/small-language-models-rethinking-what-intelligence-actually-requires-3fjb</guid>
      <description>&lt;p&gt;&lt;em&gt;"Scale solves everything — until it doesn't."&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Introduction: A Result Nobody Predicted
&lt;/h2&gt;

&lt;p&gt;In March 2024, Microsoft published a technical report with a claim that most researchers found difficult to take seriously at first. Their new model, Phi-3 Mini, had 3.8 billion parameters. GPT-3 had 175 billion. GPT-4 is estimated at somewhere above a trillion. And yet Phi-3 Mini outperformed GPT-3 on standard benchmarks, approached GPT-3.5 on several tasks, and ran entirely on a laptop with no internet connection.&lt;/p&gt;

&lt;p&gt;The response from the research community was not celebration. It was confusion. The scaling laws, the empirical relationships between model size, data, compute, and performance, had held for years. They were the closest thing the field had to a reliable theory of how intelligence emerges in these systems. Phi-3 did not break the scaling laws, but it suggested something the field had underweighted: &lt;strong&gt;the laws describe what scale can do, not what scale is required to do it&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The question Phi-3 raised is not "how small can we go?" It is something more fundamental: &lt;strong&gt;what does a language model actually need in order to reason well?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That is what this post is about. I spent this week reading the papers, running three experiments on Kaggle, and trying to build an honest picture of where SLMs stand today — what they can genuinely do, what they cannot, and why the answer matters more than most benchmark tables suggest.&lt;/p&gt;




&lt;h2&gt;
  
  
  Part 1: Why Small Language Models Exist at All
&lt;/h2&gt;

&lt;p&gt;By 2023, the dominant AI paradigm was clear: train larger models on more data with more compute. GPT-4, PaLM 2, Gemini Ultra — each required infrastructure that only a handful of organizations on earth could afford. Training costs ran into tens or hundreds of millions of dollars.&lt;/p&gt;

&lt;p&gt;This created a real problem. Most AI applications do not need a trillion-parameter model. They need something reliable, fast, cheap, and ideally not dependent on a cloud API that sends data to an external server. Finance, legal, government — domains with the strongest AI use cases are also the ones with the strictest data privacy requirements. There is no local deployment option for GPT-4.&lt;/p&gt;

&lt;p&gt;SLMs emerged as a direct response. Not as a compromise, but as a deliberate design decision: build the smallest model that can reliably do a specific set of tasks.&lt;/p&gt;

&lt;p&gt;Around the same time, a quieter debate was happening in research circles. A group of papers, starting with the original Phi-1 work in 2023, made a provocative argument: the reason large models outperform small ones is not primarily because they are larger. It is because they are trained on more data, and most of that data is low quality. Filter the data aggressively, keep only dense reasoning-heavy content, and a much smaller model performs surprisingly well.&lt;/p&gt;

&lt;p&gt;This is sometimes called the &lt;strong&gt;textbook hypothesis&lt;/strong&gt;: a model trained on textbook-quality material learns to reason better than a model trained on ten times as much internet text. The Phi series became the primary empirical test of this hypothesis, and the results were striking enough that the idea is now taken seriously across the field.&lt;/p&gt;

&lt;p&gt;There is no official definition of small, but the community generally treats anything under 7 billion parameters as an SLM:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Category&lt;/th&gt;
&lt;th&gt;Parameters&lt;/th&gt;
&lt;th&gt;Examples&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Large&lt;/td&gt;
&lt;td&gt;&amp;gt;70B&lt;/td&gt;
&lt;td&gt;GPT-4, Claude 3 Opus, Llama 3 70B&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;7B to 70B&lt;/td&gt;
&lt;td&gt;Mistral 7B, Llama 3 8B&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Small&lt;/td&gt;
&lt;td&gt;&amp;lt;7B&lt;/td&gt;
&lt;td&gt;Phi-3 Mini (3.8B), Gemma 2B, TinyLlama 1.1B&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Part 2: How SLMs Are Actually Built
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Knowledge Distillation
&lt;/h3&gt;

&lt;p&gt;The most important technique behind high-performing SLMs is knowledge distillation, and it is worth understanding properly rather than just naming it.&lt;/p&gt;

&lt;p&gt;Standard training optimizes against ground truth labels: a math problem has a correct answer and the model learns to produce it. But this only tells the model what the right answer is. It says nothing about the shape of the problem space — which wrong answers are close, which are far, what the structure of uncertainty looks like.&lt;/p&gt;

&lt;p&gt;A large teacher model, when it answers a question, produces a full probability distribution over all possible next tokens. If the teacher gives "Paris" 80% probability and "Lyon" 15% for a question about French capitals, that 15% carries real information. These two answers are related in a way that "banana" and "Paris" are not. The distribution encodes structured knowledge about relationships between concepts.&lt;/p&gt;

&lt;p&gt;Distillation trains the student to match the teacher's full distribution, not just the top answer. The student learns from the teacher's uncertainty, not just its correctness. This is why a 3.8B model trained with distillation can outperform a 7B model trained without it.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Orca and Alpaca Results
&lt;/h3&gt;

&lt;p&gt;The most compelling demonstration of distillation's power came from Microsoft's Orca papers in 2023. Orca was a 13B model fine-tuned not just on GPT-4 answers but on GPT-4's full reasoning traces — step-by-step explanations of how it arrived at each answer. Orca outperformed models five times its size on several reasoning benchmarks.&lt;/p&gt;

&lt;p&gt;Orca 2 pushed further and showed that smaller models could be explicitly taught when to use different reasoning strategies — step-by-step for complex problems, direct answers for simple ones. This was not emerging naturally from scale. It was being deliberately taught through the quality of the training signal.&lt;/p&gt;

&lt;p&gt;Stanford's Alpaca showed a related result: a 7B LLaMA model fine-tuned on 52,000 GPT-generated instruction examples matched GPT-3.5 on instruction-following tasks. 52,000 examples, one GPU, a few hours. The gap between open and closed models narrowed overnight.&lt;/p&gt;

&lt;p&gt;The bottleneck was never parameter count. It was training signal quality.&lt;/p&gt;

&lt;h3&gt;
  
  
  Quantization
&lt;/h3&gt;

&lt;p&gt;Running a model locally requires fitting it in memory. A 7B model in 32-bit floating point takes roughly 28GB of RAM. This is where quantization comes in.&lt;/p&gt;

&lt;p&gt;Quantization reduces numerical precision. Instead of storing each parameter as a 32-bit float, you store it as an 8-bit or 4-bit integer. The memory savings are proportional: 8-bit halves the footprint, 4-bit quarters it.&lt;/p&gt;

&lt;p&gt;For most language tasks, 8-bit quantization produces outputs essentially indistinguishable from full precision. 4-bit is where degradation becomes detectable, particularly on tasks requiring precise numerical reasoning. Techniques like GPTQ and AWQ apply quantization non-uniformly, preserving precision in the weights that matter most. My Experiment 3 results below show exactly this tradeoff in practice.&lt;/p&gt;

&lt;h3&gt;
  
  
  Efficient Architectures
&lt;/h3&gt;

&lt;p&gt;Beyond training and quantization, the architecture choices in SLMs reflect deliberate engineering for inference efficiency.&lt;/p&gt;

&lt;p&gt;Grouped query attention shares key and value projections across multiple query heads. Not every attention head needs its own unique representation — sharing costs little in model quality but significantly reduces memory during generation.&lt;/p&gt;

&lt;p&gt;Sliding window attention, used in Mistral, limits each token's attention to a local window rather than the full context. This makes inference cost linear in sequence length rather than quadratic.&lt;/p&gt;

&lt;p&gt;Speculative decoding is one of the more elegant recent ideas. A small draft model generates several tokens quickly. A larger target model then evaluates all of them in a single parallel forward pass, accepting those it would have generated and rejecting the rest. Net result: significantly faster generation with no change in output quality. SLMs become accelerators for larger models rather than replacements.&lt;/p&gt;




&lt;h2&gt;
  
  
  Part 3: What the Benchmarks Actually Show
&lt;/h2&gt;

&lt;p&gt;On general benchmarks, the gap between SLMs and large models is real but not as dramatic as headlines suggest:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Benchmark&lt;/th&gt;
&lt;th&gt;GPT-4&lt;/th&gt;
&lt;th&gt;Phi-3 Mini (3.8B)&lt;/th&gt;
&lt;th&gt;Gemma 2B&lt;/th&gt;
&lt;th&gt;TinyLlama 1.1B&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;MMLU (General)&lt;/td&gt;
&lt;td&gt;~86%&lt;/td&gt;
&lt;td&gt;~69%&lt;/td&gt;
&lt;td&gt;~51%&lt;/td&gt;
&lt;td&gt;~26%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GSM8K (Math)&lt;/td&gt;
&lt;td&gt;~92%&lt;/td&gt;
&lt;td&gt;~78%&lt;/td&gt;
&lt;td&gt;~52%&lt;/td&gt;
&lt;td&gt;~8%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HumanEval (Code)&lt;/td&gt;
&lt;td&gt;~87%&lt;/td&gt;
&lt;td&gt;~59%&lt;/td&gt;
&lt;td&gt;~34%&lt;/td&gt;
&lt;td&gt;~12%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ARC-Challenge&lt;/td&gt;
&lt;td&gt;~96%&lt;/td&gt;
&lt;td&gt;~85%&lt;/td&gt;
&lt;td&gt;~71%&lt;/td&gt;
&lt;td&gt;~45%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Before treating these numbers as deployment guidance, there is a problem worth understanding. Academic benchmarks are published on the internet and may appear in training data. A model that has seen the test set during training is being evaluated on recall, not reasoning. This affects all language model benchmarks. Treat these numbers as upper bounds, not precise measurements.&lt;/p&gt;

&lt;p&gt;Where SLMs genuinely dominate is cost, privacy, and hardware requirements:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;GPT-4 API&lt;/th&gt;
&lt;th&gt;Phi-3 Mini (Local)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Cost per 1M tokens&lt;/td&gt;
&lt;td&gt;~$10 to $30&lt;/td&gt;
&lt;td&gt;$0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;First token latency&lt;/td&gt;
&lt;td&gt;500ms to 2s&lt;/td&gt;
&lt;td&gt;less than 100ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Throughput on GPU&lt;/td&gt;
&lt;td&gt;Cloud only&lt;/td&gt;
&lt;td&gt;200+ tok/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data privacy&lt;/td&gt;
&lt;td&gt;Sent to external server&lt;/td&gt;
&lt;td&gt;Fully on-device&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;And the hardware floor matters enormously. GPT-4 has no local deployment option. Llama 3 70B requires roughly 40GB VRAM. Phi-3 Mini runs on 4GB RAM, which means a MacBook or a Raspberry Pi 5. TinyLlama at 1.1B fits in 700MB, enough for embedded devices.&lt;/p&gt;




&lt;h2&gt;
  
  
  My Own Experiments: Three Tasks, Two Models, Real Numbers
&lt;/h2&gt;

&lt;p&gt;For this week's experiments I ran Phi-3 Mini locally on Kaggle using a T4 GPU and compared it against Llama 3.3 70B via the Groq API. I designed three prompts myself to cover different reasoning types rather than using a standard benchmark dataset. The choice was intentional: I wanted to observe how the models behave on naturally phrased tasks, not just benchmark-formatted questions. For rigorous evaluation at scale, datasets like GSM8K and HumanEval would be the right choice, and that is something I plan to revisit in a later week.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Experiment setup:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Model A&lt;/td&gt;
&lt;td&gt;Microsoft Phi-3 Mini 4k Instruct (3.8B, FP16)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Model B&lt;/td&gt;
&lt;td&gt;Llama 3.3 70B via Groq API&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hardware&lt;/td&gt;
&lt;td&gt;Kaggle T4 GPU&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Framework&lt;/td&gt;
&lt;td&gt;HuggingFace Transformers 4.44.0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Code&lt;/td&gt;
&lt;td&gt;&lt;a href="https://github.com/soohanAbbasi/weekly-AI-ML-research/tree/main/week02-slms" rel="noopener noreferrer"&gt;GitHub → weekly-AI-ML-research/week02-slms&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The three prompts I used:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;ID&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Prompt summary&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;T-001&lt;/td&gt;
&lt;td&gt;Math reasoning&lt;/td&gt;
&lt;td&gt;Multi-step word problem involving apples, oranges, and change calculation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;T-002&lt;/td&gt;
&lt;td&gt;Code understanding&lt;/td&gt;
&lt;td&gt;Identify what a Python function does and spot a hidden bug&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;T-003&lt;/td&gt;
&lt;td&gt;Language reasoning&lt;/td&gt;
&lt;td&gt;Identify the core argument in a technical paragraph&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Experiment 1: Phi-3 Mini Inference
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;ID&lt;/th&gt;
&lt;th&gt;Task&lt;/th&gt;
&lt;th&gt;Latency&lt;/th&gt;
&lt;th&gt;Speed&lt;/th&gt;
&lt;th&gt;Correct?&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;T-001&lt;/td&gt;
&lt;td&gt;Math reasoning&lt;/td&gt;
&lt;td&gt;32.4s&lt;/td&gt;
&lt;td&gt;5.7 tok/s&lt;/td&gt;
&lt;td&gt;Yes, $7.60&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;T-002&lt;/td&gt;
&lt;td&gt;Code understanding&lt;/td&gt;
&lt;td&gt;13.2s&lt;/td&gt;
&lt;td&gt;19.3 tok/s&lt;/td&gt;
&lt;td&gt;Yes, ZeroDivisionError found&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;T-003&lt;/td&gt;
&lt;td&gt;Language reasoning&lt;/td&gt;
&lt;td&gt;1.9s&lt;/td&gt;
&lt;td&gt;19.2 tok/s&lt;/td&gt;
&lt;td&gt;Yes, clean one-sentence summary&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;T-001 was the slowest because the model generated a full step-by-step working, which produced more tokens. T-003 required only one sentence so it finished in under two seconds. All three answers were correct.&lt;/p&gt;

&lt;h3&gt;
  
  
  Experiment 2: Llama 3.3 70B vs Phi-3 Mini
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;ID&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Llama 3.3 70B&lt;/th&gt;
&lt;th&gt;Phi-3 Mini&lt;/th&gt;
&lt;th&gt;Quality gap&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;T-001&lt;/td&gt;
&lt;td&gt;Math reasoning&lt;/td&gt;
&lt;td&gt;0.5s (Cloud)&lt;/td&gt;
&lt;td&gt;13.3s (Local)&lt;/td&gt;
&lt;td&gt;Minimal&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;T-002&lt;/td&gt;
&lt;td&gt;Code understanding&lt;/td&gt;
&lt;td&gt;1.0s (Cloud)&lt;/td&gt;
&lt;td&gt;13.7s (Local)&lt;/td&gt;
&lt;td&gt;Noticeable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;T-003&lt;/td&gt;
&lt;td&gt;Language reasoning&lt;/td&gt;
&lt;td&gt;0.3s (Cloud)&lt;/td&gt;
&lt;td&gt;2.0s (Local)&lt;/td&gt;
&lt;td&gt;Minimal&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Llama 3.3 70B was faster on every task, which is expected since it runs on Groq's optimized cloud infrastructure. But the quality gap was smaller than I expected. Both models got the correct answers on T-001 and T-003. On T-002, Llama gave a richer explanation of why the ZeroDivisionError occurs. Phi-3 identified the bug correctly but explained it more shallowly. For use cases where correctness is what matters rather than explanation depth, Phi-3 holds up well. For use cases where explanation quality matters, the gap is real.&lt;/p&gt;

&lt;p&gt;The more important comparison is not latency but deployment context. Llama 3.3 70B through Groq costs money and sends your data to an external server. Phi-3 Mini costs nothing after hardware and never leaves your machine.&lt;/p&gt;

&lt;h3&gt;
  
  
  Experiment 3: Quantization in Practice
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Config&lt;/th&gt;
&lt;th&gt;VRAM&lt;/th&gt;
&lt;th&gt;Latency&lt;/th&gt;
&lt;th&gt;Speed&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;FP16 (baseline)&lt;/td&gt;
&lt;td&gt;3.89 GB&lt;/td&gt;
&lt;td&gt;16.9s&lt;/td&gt;
&lt;td&gt;11.8 tok/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;8-bit&lt;/td&gt;
&lt;td&gt;1.86 GB&lt;/td&gt;
&lt;td&gt;23.1s&lt;/td&gt;
&lt;td&gt;8.6 tok/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4-bit NF4&lt;/td&gt;
&lt;td&gt;1.08 GB&lt;/td&gt;
&lt;td&gt;13.9s&lt;/td&gt;
&lt;td&gt;13.1 tok/s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The 8-bit result is the practical takeaway: VRAM drops by more than half with no meaningful quality loss on these tasks. 4-bit was the most surprising result. It used the least memory (1.08 GB) and was actually faster than FP16 on this task (13.1 vs 11.8 tok/s). The response quality on a conceptual explanation task was comparable across all three configurations. The degradation from quantization shows up more clearly on tasks requiring precise multi-step numerical reasoning, which is exactly where SLMs are already weakest.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg5k1yiza4q4rl6zd9ml7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg5k1yiza4q4rl6zd9ml7.png" alt="Experiment Results" width="800" height="587"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Part 4: The Emergent Capabilities Problem
&lt;/h2&gt;

&lt;p&gt;One of the more surprising findings in scaling research was the concept of emergent capabilities: abilities that appear suddenly in large models and are essentially absent in smaller ones. Few-shot learning, multi-step arithmetic, chain-of-thought reasoning were all identified as capabilities that emerge with scale.&lt;/p&gt;

&lt;p&gt;SLMs challenge this picture but do not fully overturn it. What the Phi and Orca results show is that some apparently emergent capabilities can be induced in smaller models through better training. The capability was not truly emergent — it was underspecified by the training data. Give the model a better signal and the capability appears at smaller scale.&lt;/p&gt;

&lt;p&gt;But some capabilities appear to be genuinely scale-dependent. Complex multi-step mathematical reasoning, reliable code generation for non-trivial programs, coherent reasoning across very long contexts — these degrade noticeably as model size decreases, even with high-quality training and distillation.&lt;/p&gt;

&lt;p&gt;The uncomfortable implication is that we do not have a reliable theory for which capabilities are genuinely scale-dependent and which are just undertrained in smaller models. The only way to find out is to try empirically for your specific task.&lt;/p&gt;




&lt;h2&gt;
  
  
  Part 5: The On-Device AI Movement
&lt;/h2&gt;

&lt;p&gt;The most significant infrastructure shift happening around SLMs is not in data centers. It is on consumer devices.&lt;/p&gt;

&lt;p&gt;Apple's Neural Engine, present in every iPhone since the A11 chip, is now powerful enough to run models in the 1 to 3B parameter range at reasonable speeds. Apple Intelligence uses a 3B on-device model for most tasks, calling a larger cloud model only when necessary. The privacy argument is central: your data never leaves the device.&lt;/p&gt;

&lt;p&gt;Qualcomm's Snapdragon X Elite, targeting Windows laptops, includes dedicated NPU hardware rated for 45 TOPS. Microsoft's Copilot+ PC initiative is built around this, with on-device models handling real-time summarization and other features locally.&lt;/p&gt;

&lt;p&gt;Google's Gemini Nano runs on Pixel phones and recent Android devices, enabling on-device summarization and voice transcription without cloud calls.&lt;/p&gt;

&lt;p&gt;This hardware push reflects a bet that the next generation of AI features will be defined not by which cloud model is most capable but by which on-device model is fast, private, and reliable enough to be always available. SLMs are the only class of model that can compete in this environment.&lt;/p&gt;




&lt;h2&gt;
  
  
  Part 6: Fine-Tuning — Power and Trap
&lt;/h2&gt;

&lt;p&gt;A base SLM is a generalist with limited specialized knowledge. Fine-tuning on domain-specific data produces dramatic improvements on narrow tasks. Parameter-efficient methods like LoRA make this practical: instead of updating all model weights, LoRA introduces small trainable matrices that approximate the updates. A LoRA fine-tune of a 7B model can be done in a few hours on a single consumer GPU with a few thousand examples.&lt;/p&gt;

&lt;p&gt;The trap is catastrophic forgetting. When you fine-tune on domain-specific data, the model improves on that domain at the cost of general capability. It overwrites some prior knowledge with new patterns. A model fine-tuned aggressively on legal documents may produce excellent legal summaries and poor responses to everything else.&lt;/p&gt;

&lt;p&gt;LoRA mitigates this significantly because you are not modifying base weights directly. But it does not eliminate the problem entirely. Fine-tuning requires evaluating not just the target task but also the general capabilities you want to preserve.&lt;/p&gt;




&lt;h2&gt;
  
  
  Part 7: Where SLMs Genuinely Cannot Compete
&lt;/h2&gt;

&lt;p&gt;Being honest about hard limits is more useful than optimism.&lt;/p&gt;

&lt;p&gt;For problems requiring many intermediate results held simultaneously — advanced mathematics, multi-constraint planning — large models are meaningfully better and fine-tuning does not close the gap. Maintaining complex internal state during long reasoning chains appears to benefit from scale in ways data quality alone does not address.&lt;/p&gt;

&lt;p&gt;When a task requires combining skills in configurations the model has not seen before — not applying a familiar pattern but genuinely constructing a new approach — smaller models are more brittle than benchmark numbers suggest.&lt;/p&gt;

&lt;p&gt;Maintaining a coherent thread across 100,000+ tokens is qualitatively harder for smaller models even when they technically support the context window. The model loses track of earlier constraints in ways that compound over long sequences.&lt;/p&gt;

&lt;p&gt;Large models follow a wider range of novel instructions reliably. Smaller models are more sensitive to exact prompt phrasing — small wording changes produce larger output quality changes than you would expect.&lt;/p&gt;




&lt;h2&gt;
  
  
  Part 8: Open Questions
&lt;/h2&gt;

&lt;p&gt;Is the textbook hypothesis general? Phi-3's data approach worked for reasoning tasks. Does it transfer to less structured domains such as creative writing, open-ended dialogue, or cultural reasoning? The hypothesis has not been tested rigorously outside its original domain.&lt;/p&gt;

&lt;p&gt;Where is the true capability floor? We know some capabilities emerge with scale. We do not know the minimum scale at which each reliably appears as a deployment characteristic rather than a benchmark number.&lt;/p&gt;

&lt;p&gt;Can quantization go further? 2-bit and 1-bit quantization have been explored experimentally. The results are not yet good enough for general deployment. Whether this is a fundamental limit or an engineering problem is not resolved.&lt;/p&gt;

&lt;p&gt;What happens when SLMs are wrong? Error analysis for SLMs in production is underdeveloped. Large model failures tend to be graceful — wrong but coherent. SLM failures can be less graceful. A systematic understanding of failure modes across task types would be practically valuable and is mostly absent from the literature.&lt;/p&gt;

&lt;p&gt;How does on-device AI change development practices? If inference moves to the edge, evaluation, updating, and monitoring all change significantly. The MLOps infrastructure built around centralized cloud inference does not translate directly to a world where models run on millions of individual devices.&lt;/p&gt;




&lt;h2&gt;
  
  
  Papers Worth Reading
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Paper&lt;/th&gt;
&lt;th&gt;What It Contributes&lt;/th&gt;
&lt;th&gt;Venue&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Gunasekar et al. (2023)&lt;/td&gt;
&lt;td&gt;Phi-1: the textbook hypothesis&lt;/td&gt;
&lt;td&gt;NeurIPS 2023&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Abdin et al. (2024)&lt;/td&gt;
&lt;td&gt;Phi-3 technical report&lt;/td&gt;
&lt;td&gt;arXiv 2404&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mukherjee et al. (2023)&lt;/td&gt;
&lt;td&gt;Orca: learning from GPT-4 explanations&lt;/td&gt;
&lt;td&gt;arXiv 2306&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mitra et al. (2023)&lt;/td&gt;
&lt;td&gt;Orca 2: teaching reasoning strategies&lt;/td&gt;
&lt;td&gt;arXiv 2311&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Taori et al. (2023)&lt;/td&gt;
&lt;td&gt;Alpaca: instruction following at 7B&lt;/td&gt;
&lt;td&gt;Stanford HAI&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Zhang et al. (2024)&lt;/td&gt;
&lt;td&gt;TinyLlama: pretraining at 1.1B&lt;/td&gt;
&lt;td&gt;arXiv 2401&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Frantar et al. (2022)&lt;/td&gt;
&lt;td&gt;GPTQ: post-training quantization&lt;/td&gt;
&lt;td&gt;arXiv 2210&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lin et al. (2023)&lt;/td&gt;
&lt;td&gt;AWQ: activation-aware weight quantization&lt;/td&gt;
&lt;td&gt;arXiv 2306&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Leviathan et al. (2023)&lt;/td&gt;
&lt;td&gt;Speculative decoding&lt;/td&gt;
&lt;td&gt;ICML 2023&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hu et al. (2021)&lt;/td&gt;
&lt;td&gt;LoRA: low-rank adaptation&lt;/td&gt;
&lt;td&gt;ICLR 2022&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Research Groups Doing Relevant Work
&lt;/h2&gt;

&lt;p&gt;Microsoft Research's Phi team has produced the most sustained empirical investigation of the data quality hypothesis. Meta's LLaMA team made open weights standard practice and enabled the fine-tuning ecosystem most SLM work depends on. Hugging Face's evaluation team, particularly the Open LLM Leaderboard and their contamination research, is essential for understanding what benchmark numbers actually mean. On hardware, Qualcomm Research and Apple's ML team are defining what on-device inference looks like in practice. MIT's Han Lab has done foundational work on quantization and efficient inference.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benchmarks You Should Know
&lt;/h2&gt;

&lt;p&gt;MMLU covers 57 subjects across multiple domains and is useful for measuring breadth but is known to have contamination issues. ARC-Challenge focuses on scientific reasoning that requires inference rather than recall. GSM8K has 8,500 grade school math problems requiring multi-step reasoning and is the most widely used reasoning benchmark. HumanEval tests code generation with 164 programming problems across different difficulty levels. BIG-Bench Hard collects 23 tasks specifically designed to resist current models. HELM provides a more structured evaluation framework with explicit contamination controls. For any production decision, treat published benchmark numbers as approximate and build an evaluation set from your actual task distribution.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The SLM story is not about building smaller versions of large models. It is about a set of discoveries that have changed what we understand about the relationship between model size and capability.&lt;/p&gt;

&lt;p&gt;Data quality can substitute for scale to a remarkable degree. Distillation can transfer knowledge across size boundaries in ways flat training data cannot. Efficient architectures reduce the hardware floor without meaningful capability loss. And the on-device movement is creating a deployment environment where the question is not "what is the best model?" but "what is the best model that fits this constraint set?"&lt;/p&gt;

&lt;p&gt;Running these experiments myself made the tradeoffs concrete in a way that reading papers alone does not. Phi-3 Mini got every answer right. It was slower than the cloud alternative, but it ran locally, cost nothing per query, and required no data to leave the machine. For many real applications, that is not a compromise. It is exactly what you need.&lt;/p&gt;

&lt;p&gt;The scaling laws are not wrong. But they were describing one path to capability. The research of the last two years has found that there are others, and some of them are more practical for the problems most people actually need to solve.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next week:&lt;/strong&gt; Retrieval-Augmented Generation. How do you give a language model access to knowledge it was never trained on? What actually happens when retrieval goes wrong? And does RAG actually solve the hallucination problem, or just change where the failures occur?&lt;/p&gt;




&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Gunasekar, S., et al. (2023). Textbooks Are All You Need. &lt;em&gt;NeurIPS 2023&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Abdin, M., et al. (2024). Phi-3 Technical Report. &lt;em&gt;arXiv:2404.14219&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Mukherjee, S., et al. (2023). Orca: Progressive Learning from Complex Explanation Traces. &lt;em&gt;arXiv:2306.02707&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Mitra, A., et al. (2023). Orca 2: Teaching Small Language Models How to Reason. &lt;em&gt;arXiv:2311.11045&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Taori, R., et al. (2023). Stanford Alpaca: An Instruction-following LLaMA Model. &lt;em&gt;Stanford HAI&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Zhang, P., et al. (2024). TinyLlama: An Open-Source Small Language Model. &lt;em&gt;arXiv:2401.02385&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Frantar, E., et al. (2022). GPTQ: Accurate Post-Training Quantization for GPT. &lt;em&gt;arXiv:2210.17323&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Lin, J., et al. (2023). AWQ: Activation-aware Weight Quantization for LLM Compression. &lt;em&gt;arXiv:2306.00978&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Leviathan, Y., et al. (2023). Fast Inference from Transformers via Speculative Decoding. &lt;em&gt;ICML 2023&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Hu, E., et al. (2021). LoRA: Low-Rank Adaptation of Large Language Models. &lt;em&gt;ICLR 2022&lt;/em&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;em&gt;Experiment code: &lt;a href="https://github.com/soohanAbbasi/weekly-AI-ML-research/tree/main/week02-slms" rel="noopener noreferrer"&gt;GitHub → weekly-AI-ML-research/week02-slms&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is part of a weekly series on AI/ML research. Each post covers theory, recent papers, and experiments I run myself.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Connect on LinkedIn: &lt;a href="https://www.linkedin.com/in/soohan-abbasi-36267b183/" rel="noopener noreferrer"&gt;Soohan Abbasi&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>machinelearning</category>
      <category>microsoft</category>
    </item>
    <item>
      <title>Chain-of-Thought and Beyond: How LLMs Actually Learn to Reason</title>
      <dc:creator>soohan abbasi</dc:creator>
      <pubDate>Sat, 16 May 2026 12:30:00 +0000</pubDate>
      <link>https://dev.to/soohan_abbasi/chain-of-thought-and-beyond-how-llms-actually-learn-to-reason-3kk4</link>
      <guid>https://dev.to/soohan_abbasi/chain-of-thought-and-beyond-how-llms-actually-learn-to-reason-3kk4</guid>
      <description>&lt;p&gt;&lt;em&gt;"The ability to reason step-by-step is not just a feature. It might be the difference between a language model that sounds intelligent and one that actually is."&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Introduction: When AI Started Thinking
&lt;/h2&gt;

&lt;p&gt;In 2022, researchers at Google Brain published a paper titled &lt;strong&gt;"Chain-of-Thought Prompting Elicits Reasoning in Large Language Models"&lt;/strong&gt;. At the time, nobody quite anticipated it would mark the beginning of a shift that would reshape the entire AI field.&lt;/p&gt;

&lt;p&gt;The idea was simple: instead of asking a model to answer directly, give it time to think. Ask it to write out intermediate steps. Accuracy improves dramatically.&lt;/p&gt;

&lt;p&gt;That paper now sits at over 10,000 citations. But the question it raised has never been fully answered:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do LLMs actually think? Or do they create a very convincing illusion of thinking?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That is what this blog is about. And as someone preparing for a PhD in AI, it is a question I keep coming back to.&lt;/p&gt;




&lt;h2&gt;
  
  
  Part 1: What Is Chain-of-Thought?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Standard Prompting vs. CoT Prompting
&lt;/h3&gt;

&lt;p&gt;Imagine asking a model this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls. How many does he have now?"&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;With standard prompting, the model jumps straight to: "11"&lt;/p&gt;

&lt;p&gt;With chain-of-thought prompting, the model works through it first:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Roger starts with 5 balls.
2 cans × 3 balls = 6 balls.
5 + 6 = 11 balls.
Answer: 11
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both get the same answer. So what is the point?&lt;/p&gt;

&lt;p&gt;The gap shows up on harder problems. Models that reason through steps outperform those that answer directly on multi-step math, symbolic reasoning, and commonsense problems. The more complex the task, the bigger the difference.&lt;/p&gt;

&lt;h3&gt;
  
  
  Zero-Shot CoT: One Phrase Changes Everything
&lt;/h3&gt;

&lt;p&gt;In the same year, researchers discovered something even more surprising. Simply adding the phrase &lt;strong&gt;"Let's think step by step"&lt;/strong&gt; to a question, without any examples, significantly improved reasoning accuracy.&lt;/p&gt;

&lt;p&gt;No demonstrations. No fine-tuning. Just those five words.&lt;/p&gt;

&lt;p&gt;This became known as zero-shot CoT. And the obvious follow-up question is: why does this even work?&lt;/p&gt;




&lt;h2&gt;
  
  
  My Own Experiment: Testing CoT on GSM8K
&lt;/h2&gt;

&lt;p&gt;Before going deeper into the theory, I wanted to test this myself. So I ran a small experiment using an open-source model on a standard benchmark.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setup:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Model:&lt;/strong&gt; Qwen 2.5 1.5B Instruct (free, runs on Kaggle GPU)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dataset:&lt;/strong&gt; GSM8K (grade school math problems)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test:&lt;/strong&gt; Standard prompting vs. "Let's think step by step"&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sample:&lt;/strong&gt; 10 problems&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Results:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Approach&lt;/th&gt;
&lt;th&gt;Correct&lt;/th&gt;
&lt;th&gt;Accuracy&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Without CoT&lt;/td&gt;
&lt;td&gt;2/10&lt;/td&gt;
&lt;td&gt;20%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;With CoT&lt;/td&gt;
&lt;td&gt;3/10&lt;/td&gt;
&lt;td&gt;30%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;[CoT vs No-CoT Results on GSM8K]&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmz4somay658v8xjhnbld.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmz4somay658v8xjhnbld.png" alt=" " width="800" height="341"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Even on a model roughly 360 times smaller than the one used in the original paper, the improvement showed up. A single phrase shifted accuracy by 10%.&lt;/p&gt;

&lt;p&gt;A few things stood out from the per-problem breakdown:&lt;/p&gt;

&lt;p&gt;Problem 1 was solved correctly with CoT, but not without it. Problem 7 showed the same pattern. Problem 4 was solved correctly either way. But Problem 6 was actually solved correctly without CoT and incorrectly with it. The model overthought a straightforward calculation and got it wrong.&lt;/p&gt;

&lt;p&gt;That last observation matters and connects to something I discuss in Part 4.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Quick note: the overall accuracy numbers look low because this model is tiny compared to what the original paper used. The point here is the relative difference, not the absolute numbers.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Part 2: What Is Actually Happening Inside the Model?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  More Than Pattern Matching
&lt;/h3&gt;

&lt;p&gt;The common criticism of LLMs is that they are sophisticated autocomplete. They match patterns from training data rather than genuinely reasoning. This criticism is not entirely wrong, but it is incomplete.&lt;/p&gt;

&lt;p&gt;Between 2023 and 2024, researchers doing mechanistic interpretability work found some interesting things inside these models.&lt;/p&gt;

&lt;p&gt;LLMs contain specific reasoning circuits: groups of neurons and attention heads that work together to perform logical operations. They use something called induction heads, which are attention patterns that identify sequences in context and predict what follows. Some models have developed implicit world models, meaning they internally represent concepts like spatial relationships, time, and causality.&lt;/p&gt;

&lt;p&gt;None of this was explicitly programmed. It emerged from training on text.&lt;/p&gt;

&lt;p&gt;The picture that comes out of this research is more interesting than "just pattern matching." These models have developed internal structures that support reasoning-like behavior. Whether that constitutes real reasoning is a separate philosophical question, but it is clearly more than autocomplete.&lt;/p&gt;

&lt;h3&gt;
  
  
  Process Reward Models: Grading the Work, Not Just the Answer
&lt;/h3&gt;

&lt;p&gt;Here is an idea that changed how reasoning models are trained. Instead of grading only the final answer, what if you graded every individual reasoning step?&lt;/p&gt;

&lt;p&gt;That is the core of a Process Reward Model (PRM).&lt;/p&gt;

&lt;p&gt;In standard training, the model produces an answer and gets told whether it was right or wrong. In PRM-based training, each step in the reasoning chain gets its own score. A wrong step gets flagged early, before it derails the rest of the solution.&lt;/p&gt;

&lt;p&gt;OpenAI's 2023 paper "Let's Verify Step by Step" showed that PRMs significantly outperform outcome-based reward models on mathematical reasoning tasks.&lt;/p&gt;

&lt;p&gt;This idea became the foundation for something much bigger, which I will cover in Week 12 when we get to test-time compute scaling.&lt;/p&gt;




&lt;h2&gt;
  
  
  Part 3: OpenAI o1 and DeepSeek-R1
&lt;/h2&gt;

&lt;h3&gt;
  
  
  OpenAI o1: Giving Models Time to Think
&lt;/h3&gt;

&lt;p&gt;In September 2024, OpenAI released o1, and the response from the research community was immediate.&lt;/p&gt;

&lt;p&gt;The idea behind o1 is straightforward. Give the model more time to think about the inference. Before producing an answer, o1 generates a hidden chain of thought that the user never sees, but the model uses internally. This chain is trained with reinforcement learning: the model gets rewarded for reaching correct answers, which teaches it to develop better internal reasoning strategies.&lt;/p&gt;

&lt;p&gt;The results on AIME 2024, a notoriously difficult high school math competition, were striking. GPT-4o scored 12%. o1 scored 74%.&lt;/p&gt;

&lt;p&gt;That is not a small improvement. That is a different class of performance, driven almost entirely by letting the model think longer.&lt;/p&gt;

&lt;h3&gt;
  
  
  DeepSeek-R1: The Open Source Answer
&lt;/h3&gt;

&lt;p&gt;In January 2025, a Chinese startup called DeepSeek released R1, and it caused genuine disruption in the Western AI community.&lt;/p&gt;

&lt;p&gt;DeepSeek-R1 matched o1-level performance at a fraction of the training cost. And it was fully open source.&lt;/p&gt;

&lt;p&gt;Three technical contributions made this possible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Group Relative Policy Optimization (GRPO):&lt;/strong&gt; Standard RLHF needs a separate critic model to score responses, which adds significant overhead. GRPO removes that requirement. Instead, the model generates multiple responses to the same question, compares them against each other, and rewards the best one. No criticism needed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Warm Start Before RL:&lt;/strong&gt; Training a model from scratch with pure reinforcement learning is unstable because the model starts random. DeepSeek's approach was to first run supervised fine-tuning to give the model a reasonable starting point, then apply RL on top of that. A sensible idea that turned out to matter a lot.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Emergent Reasoning Behaviors:&lt;/strong&gt; During training, R1 developed behaviors that were never explicitly programmed. The model began catching its own mistakes mid-reasoning and reconsidering. It started verifying its own answers before finalizing them. It explored alternative solution paths. These behaviors just appeared from the training process. For researchers trying to understand what is happening inside these models, this is genuinely interesting territory.&lt;/p&gt;




&lt;h2&gt;
  
  
  Part 4: Where CoT Fails
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Unfaithful Reasoning
&lt;/h3&gt;

&lt;p&gt;One of the more unsettling findings in recent research is that CoT explanations do not always reflect what the model actually computed.&lt;/p&gt;

&lt;p&gt;Anthropic's 2023 research showed that models sometimes produce post-hoc rationalizations. They settle on an answer through some internal process, then construct a reasoning chain that appears to justify it. The explanation and the computation are decoupled.&lt;/p&gt;

&lt;p&gt;What the model writes as its reasoning may not be what actually happened.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reasoning or Memorization?
&lt;/h3&gt;

&lt;p&gt;There is a deeper question underneath CoT performance: is the model actually reasoning, or is it recalling reasoning-shaped patterns from its training data?&lt;/p&gt;

&lt;p&gt;Researchers created a symbolic variant of GSM8K where the logic of each problem stayed the same, but surface features like numbers and names were changed. Performance dropped significantly. If the model were truly reasoning about the structure of the problem, this change should not matter. The fact that it does suggests some of the apparent reasoning is memorization in disguise.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Overthinking Problem
&lt;/h3&gt;

&lt;p&gt;My experiment showed a small version of this. On Problem 6, the model solved it correctly without CoT. With CoT, it added extra steps, got confused, and got it wrong.&lt;/p&gt;

&lt;p&gt;Researchers have documented this pattern at scale. Longer reasoning chains are not always better. Past a certain point, additional steps introduce errors rather than correct them. This has been called "overthinking" or the "lost in the middle" problem.&lt;/p&gt;

&lt;h3&gt;
  
  
  Compositional Generalization
&lt;/h3&gt;

&lt;p&gt;LLMs also struggle when they need to combine reasoning skills in novel ways. They can handle familiar patterns well. But put two familiar patterns together in a configuration the model has not seen, and performance degrades. This suggests the reasoning ability is less flexible and generalizable than it might appear from benchmark numbers.&lt;/p&gt;




&lt;h2&gt;
  
  
  Part 5: What We Still Do Not Know
&lt;/h2&gt;

&lt;p&gt;CoT has genuinely advanced what language models can do. But there are open questions that the field has not resolved.&lt;/p&gt;

&lt;h3&gt;
  
  
  Are the Explanations Honest?
&lt;/h3&gt;

&lt;p&gt;When a model shows its reasoning, is that actually what happened computationally? The unfaithful reasoning research says it often is not. We do not have reliable tools to check whether a model's stated reasoning matches its internal computation. This matters a lot if you want to trust the reasoning, not just the answer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where Does Reasoning End and Memorization Begin?
&lt;/h3&gt;

&lt;p&gt;The symbolic variant experiments raise a question that nobody has cleanly answered yet. For any given correct reasoning chain, how much of it reflects genuine logical inference versus pattern recall? The boundary is not well defined.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Does CoT Work in English and Struggle Elsewhere?
&lt;/h3&gt;

&lt;p&gt;Almost all CoT research was conducted in English. When you apply the same techniques to Arabic, Urdu, or other lower-resource languages, performance drops noticeably. Whether this is primarily a data coverage problem or something more structural about how reasoning transfers across language families is still an open question.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can We Formally Verify a Reasoning Step?
&lt;/h3&gt;

&lt;p&gt;A calculator gives you a provably correct answer. An LLM gives you a confident one. There is currently no reliable way to formally verify whether an individual step in an LLM's reasoning chain is logically valid. Researchers are exploring integrations with formal theorem provers such as Lean4, but this remains largely unsolved.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does Interpretability Scale?
&lt;/h3&gt;

&lt;p&gt;Mechanistic interpretability research has produced real insights at small model scales: specific circuits identified, specific behaviors localized. But as models grow to hundreds of billions of parameters, these techniques become computationally impractical. How interpretability research keeps pace with model scale is an open problem.&lt;/p&gt;




&lt;h2&gt;
  
  
  Papers Worth Reading
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Paper&lt;/th&gt;
&lt;th&gt;What It Contributes&lt;/th&gt;
&lt;th&gt;Venue&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Wei et al. (2022)&lt;/td&gt;
&lt;td&gt;Original CoT paper&lt;/td&gt;
&lt;td&gt;NeurIPS 2022&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Kojima et al. (2022)&lt;/td&gt;
&lt;td&gt;Zero-shot CoT discovery&lt;/td&gt;
&lt;td&gt;NeurIPS 2022&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lightman et al. (2023)&lt;/td&gt;
&lt;td&gt;Process Reward Models&lt;/td&gt;
&lt;td&gt;OpenAI Tech Report&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DeepSeek-AI (2025)&lt;/td&gt;
&lt;td&gt;GRPO and DeepSeek-R1&lt;/td&gt;
&lt;td&gt;arXiv 2501&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Turpin et al. (2023)&lt;/td&gt;
&lt;td&gt;Unfaithful reasoning&lt;/td&gt;
&lt;td&gt;NeurIPS 2023&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wang et al. (2022)&lt;/td&gt;
&lt;td&gt;Self-consistency via majority voting&lt;/td&gt;
&lt;td&gt;ICLR 2023&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Research Groups Doing Interesting Work Here
&lt;/h2&gt;

&lt;p&gt;Anthropic's interpretability team is doing some of the most rigorous work on understanding what is happening inside these models. DeepMind's Gemini team is pushing multimodal reasoning. MIT's BCS and CSAIL groups are connecting cognitive science with language model research. Peking University's NLP group has produced strong work on multilingual reasoning.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benchmarks You Should Know
&lt;/h2&gt;

&lt;p&gt;GSM8K covers grade school math with 8,500 problems. MATH is competition-level with 12,500 problems. MMLU covers broad knowledge across many domains. ARC-Challenge focuses on scientific reasoning. BIG-Bench Hard collects 23 tasks specifically designed to be difficult for current models.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Chain-of-thought prompting is one of the more surprising ideas in recent AI research. A single phrase, added to a prompt, unlocks reasoning capabilities that were already there but not being used.&lt;/p&gt;

&lt;p&gt;And yet the central question it raised remains unanswered. Do these models actually reason, or do they produce sophisticated simulations of reasoning? The honest answer is that we do not fully know.&lt;/p&gt;

&lt;p&gt;The gap between sounding intelligent and being intelligent is where the most interesting work in this field is happening right now.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next week:&lt;/strong&gt; Small Language Models. How models like Phi-3 and Gemma became serious competitors to GPT-4, and what the research landscape looks like when you do not need a data center to run your model.&lt;/p&gt;




&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;p&gt;1.Wei, J., et al. (2022). Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. &lt;em&gt;NeurIPS 2022&lt;/em&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Kojima, T., et al. (2022). Large Language Models are Zero-Shot Reasoners. &lt;em&gt;NeurIPS 2022&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Lightman, H., et al. (2023). Let's Verify Step by Step. &lt;em&gt;arXiv:2305.20050&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;DeepSeek-AI. (2025). DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning. &lt;em&gt;arXiv:2501.12948&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Turpin, M., et al. (2023). Language Models Don't Always Say What They Think. &lt;em&gt;NeurIPS 2023&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Wang, X., et al. (2022). Self-Consistency Improves Chain-of-Thought Reasoning in Language Models. &lt;em&gt;ICLR 2023&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Elhage, N., et al. (2021). A Mathematical Framework for Transformer Circuits. &lt;em&gt;Anthropic&lt;/em&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;em&gt;Code for this experiment is available on GitHub: &lt;a href="https://github.com/soohanAbbasi/weekly-AI-ML-research/tree/main/week01-chain-of-thought" rel="noopener noreferrer"&gt;Week 01 Code&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is part of a weekly series on AI/ML research. Each post covers theory, recent work, and experiments I run myself.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Connect on LinkedIn &lt;a href="https://www.linkedin.com/in/soohan-abbasi-36267b183/" rel="noopener noreferrer"&gt;Soohan Abbasi&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>machinelearning</category>
      <category>deeplearning</category>
    </item>
    <item>
      <title>I Built an Offline AI Career Advisor Using Gemma 4 — Here's Exactly How It Works</title>
      <dc:creator>soohan abbasi</dc:creator>
      <pubDate>Wed, 13 May 2026 06:04:46 +0000</pubDate>
      <link>https://dev.to/soohan_abbasi/i-built-an-offline-ai-career-advisor-using-gemma-4-heres-exactly-how-it-works-3hgc</link>
      <guid>https://dev.to/soohan_abbasi/i-built-an-offline-ai-career-advisor-using-gemma-4-heres-exactly-how-it-works-3hgc</guid>
      <description>&lt;h1&gt;
  
  
  I Built an Offline AI Career Advisor Using Gemma 4 — Here's Exactly How It Works
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;A technical walkthrough of GuidanceOS: from model loading to multi-agent orchestration, running entirely on a Kaggle T4 GPU with no internet at inference time.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;I teach Computer Science. Over the years, one thing I kept seeing was students who had decent skills but no idea what to do with them. They didn't know what jobs matched their profile, what courses to take next, or how to position themselves for a career. Career guidance platforms exist, sure — but they're mostly behind paywalls, require accounts, and need a stable internet connection.&lt;/p&gt;

&lt;p&gt;So I built GuidanceOS for the Gemma 4 Good Hackathon. The goal was simple: a fully offline AI system that takes your resume, figures out your skills, and gives you a complete career analysis — job matches, course recommendations, a 3-month learning plan, and an ATS score — all running locally on a GPU, no API calls at inference time.&lt;/p&gt;

&lt;p&gt;Here's exactly how I built it.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Model Choice: Why Gemma 4 e4b-it
&lt;/h2&gt;

&lt;p&gt;The hackathon required using Gemma 4. Google released four variants: 2B, 4B (edge), 26B MoE, and 31B Dense. I went with &lt;strong&gt;gemma-4-e4b-it&lt;/strong&gt; for a specific reason.&lt;/p&gt;

&lt;p&gt;The "e" stands for edge-optimized. The "it" stands for instruction-tuned. On Kaggle's free T4 GPU (15GB VRAM), a naive load of even a 4B model can fail if quantization isn't handled right. With 4-bit NF4 quantization via BitsAndBytes, gemma-4-e4b-it loads in about 8.7GB — leaving headroom for inference.&lt;/p&gt;

&lt;p&gt;One problem I ran into immediately: the stable release of Hugging Face Transformers (5.0.0 at the time) didn't recognize the &lt;code&gt;gemma4&lt;/code&gt; architecture. Loading the model threw:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ValueError: The checkpoint you are trying to load has model type `gemma4`
but Transformers does not recognize this architecture.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The fix was straightforward — install Transformers from the GitHub dev branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="sb"&gt;`&lt;/span&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;git+https://github.com/huggingface/transformers.git&lt;span class="sb"&gt;`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This bumped the version to &lt;code&gt;5.8.0.dev0&lt;/code&gt;, which includes the Gemma 4 model class.&lt;/p&gt;

&lt;p&gt;The second issue was GPU memory management. Using &lt;code&gt;device_map="auto"&lt;/code&gt; caused BitsAndBytes to split the model across CPU and GPU, which it doesn't allow in 4-bit mode:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ValueError: Some modules are dispatched on the CPU or the disk.
Make sure you have enough GPU RAM to fit the quantized model.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Solution: pin everything to a single GPU.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;AutoModelForImageTextToText&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_pretrained&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;MODEL_PATH&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;quantization_config&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;bnb_config&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;device_map&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cuda:0&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;dtype&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bfloat16&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that, the model loaded cleanly in about 3 minutes and sat at 8.7GB on GPU 0.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Knowledge Base: TF-IDF Over 130K Records
&lt;/h2&gt;

&lt;p&gt;I used two datasets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;LinkedIn Job Postings&lt;/strong&gt; — 123,849 jobs with title, description, skills, location, experience level, and salary&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Coursera Courses 2024&lt;/strong&gt; — 6,645 courses with title, skills, description, level, rating, and URL&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For job and course matching, I built a TF-IDF index over combined text fields. For jobs, I concatenated the job title, skills description, and the first 300 characters of the full description. For courses, I combined the title, skills tags, and description.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;jobs_clean&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;combined_text&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;jobs_clean&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;title&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
    &lt;span class="n"&gt;jobs_clean&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;skills_desc&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
    &lt;span class="n"&gt;jobs_clean&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;description&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;[:&lt;/span&gt;&lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then I fit a TfidfVectorizer with bigrams and 10,000 features:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;jobs_vectorizer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;TfidfVectorizer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;max_features&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;stop_words&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;english&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;ngram_range&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;jobs_tfidf_matrix&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;jobs_vectorizer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit_transform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;jobs_clean&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;combined_text&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At query time, the user's skill string gets transformed by the same vectorizer and compared against the full matrix using cosine similarity. The top-k results come back in milliseconds — no GPU needed, no network call.&lt;/p&gt;

&lt;p&gt;I chose TF-IDF over dense vector search (FAISS + sentence embeddings) deliberately. Dense search needs an embedding model at query time, which adds latency and memory. TF-IDF is deterministic, fast, and reproducible — important when the whole point is offline-first operation.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Inference Helper
&lt;/h2&gt;

&lt;p&gt;Before building agents, I needed a clean wrapper around Gemma 4's generation. The model uses a specific chat format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;ask_gemma&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.7&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;formatted&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;&amp;lt;bos&amp;gt;&amp;lt;start_of_turn&amp;gt;user&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;&amp;lt;end_of_turn&amp;gt;&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;&amp;lt;start_of_turn&amp;gt;model&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

    &lt;span class="n"&gt;inputs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;tokenizer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;formatted&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;return_tensors&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;add_special_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;
    &lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cuda:0&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;no_grad&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="n"&gt;outputs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;generate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;inputs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;max_new_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;max_tokens&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;do_sample&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;top_p&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;repetition_penalty&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;1.3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;pad_token_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;tokenizer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;eos_token_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;eos_token_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;tokenizer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;eos_token_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;input_len&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;inputs&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;input_ids&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tokenizer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;outputs&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;input_len&lt;/span&gt;&lt;span class="p"&gt;:],&lt;/span&gt; &lt;span class="n"&gt;skip_special_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;&amp;lt;end_of_turn&amp;gt;&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;&amp;lt;end_of_turn&amp;gt;&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A few things worth noting here:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;add_special_tokens=False&lt;/code&gt;&lt;/strong&gt; — because I'm manually prepending &lt;code&gt;&amp;lt;bos&amp;gt;&lt;/code&gt; in the prompt string. If you let the tokenizer add it automatically as well, you get a duplicate BOS token which confuses the model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;repetition_penalty=1.3&lt;/code&gt;&lt;/strong&gt; — without this, the model loops. I found this out the hard way when my first test response was 200 repetitions of "matched matched matched".&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Decoding only new tokens&lt;/strong&gt; — &lt;code&gt;outputs[0][input_len:]&lt;/code&gt; strips the input tokens from the output before decoding. Otherwise you get the full prompt echoed back before the response.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Four Agents
&lt;/h2&gt;

&lt;p&gt;Each agent is a focused prompt sent to &lt;code&gt;ask_gemma&lt;/code&gt;. The agents run sequentially, not in parallel — this keeps memory usage flat and avoids context window issues.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Agent 1 — Skills Analyzer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Takes the raw resume text and returns a structured output in a fixed format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TECHNICAL SKILLS: Python, NLP, LangChain, ...
SOFT SKILLS: Communication, Teaching, ...
EXPERIENCE: 5 years
LEVEL: mid
DOMAINS: Artificial Intelligence, NLP, Education
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I enforce the format in the prompt rather than post-processing with regex. Gemma 4 follows structured output instructions reliably when you give it an exact template to fill.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Agent 2 — Career Path Advisor&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Takes the extracted skills string and returns three career paths with job titles, required additional skills, USD salary ranges, and a growth potential score out of 10.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Agent 3 — Learning Plan Designer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Takes the skills and target role and returns a 3-month plan broken down by month — foundation topics in month 1, intermediate topics in month 2, advanced topics and portfolio projects in month 3.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Agent 4 — Resume and ATS Analyst&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Takes the resume text and target role and returns an ATS score out of 100, three strengths, three improvement areas, missing keywords, and a suggested rewrite for the professional summary.&lt;/p&gt;

&lt;p&gt;The skills string extracted by Agent 1 is passed directly into Agents 2 and 3, creating a lightweight chain without needing LangChain or CrewAI overhead.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Gradio Interface
&lt;/h2&gt;

&lt;p&gt;I used Gradio instead of Streamlit for one reason: on Kaggle, &lt;code&gt;app.launch(share=True)&lt;/code&gt; generates a public ngrok URL in a single line. No tunnel setup, no separate process.&lt;/p&gt;

&lt;p&gt;The interface has two inputs — resume text and target role — and six output tabs, one per agent plus job matches and course recommendations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;gr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Blocks&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GuidanceOS&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;gr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Row&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;gr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Column&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;scale&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="n"&gt;resume_input&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;gr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Textbox&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Resume Text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lines&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;role_input&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;gr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Textbox&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Target Role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;submit_btn&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;gr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Analyze My Profile&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;variant&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;primary&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;gr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Column&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;scale&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;gr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Tab&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Skills Analysis&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
                &lt;span class="n"&gt;skills_out&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;gr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Textbox&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lines&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="c1"&gt;# ... five more tabs
&lt;/span&gt;
&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;launch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;share&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I added &lt;code&gt;gr.Progress()&lt;/code&gt; to the main function so the UI shows which agent is running instead of just freezing. Each agent call takes 30-90 seconds on T4 — the progress bar makes it feel responsive.&lt;/p&gt;




&lt;h2&gt;
  
  
  End-to-End Flow
&lt;/h2&gt;

&lt;p&gt;When a user clicks Analyze:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Resume text → Agent 1 → structured skills profile&lt;/li&gt;
&lt;li&gt;Skills string → TF-IDF search → top 5 jobs from 123K LinkedIn postings&lt;/li&gt;
&lt;li&gt;Skills string → TF-IDF search → top 5 courses from 6.6K Coursera courses&lt;/li&gt;
&lt;li&gt;Skills string → Agent 2 → three career paths with salaries&lt;/li&gt;
&lt;li&gt;Skills string + target role → Agent 3 → 3-month learning roadmap&lt;/li&gt;
&lt;li&gt;Resume text + target role → Agent 4 → ATS score and improvements&lt;/li&gt;
&lt;li&gt;All outputs → six Gradio tabs&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Total time: 3-5 minutes on a T4 GPU. All computation on-device. Zero external API calls.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I Would Do Differently
&lt;/h2&gt;

&lt;p&gt;A few things I'd change with more time:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Structured JSON output from agents.&lt;/strong&gt; Right now the agents return free-form text. Enforcing JSON output would make the results easier to display in a proper UI — cards instead of plain text boxes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;FAISS for course search.&lt;/strong&gt; TF-IDF misses semantic similarity — "data analysis" and "analytics" are treated as different terms. Sentence embeddings with FAISS would improve course matching quality significantly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Session persistence with SQLite.&lt;/strong&gt; The current setup doesn't remember previous conversations. Adding a lightweight SQLite store would let users build on previous sessions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SHAP explainability.&lt;/strong&gt; I had planned to add a SHAP chart showing which skills drove each job recommendation using a Random Forest trained on the jobs dataset. It didn't make the deadline but the data pipeline supports it cleanly.&lt;/p&gt;




&lt;h2&gt;
  
  
  Running It Yourself
&lt;/h2&gt;

&lt;p&gt;The full notebook is on Kaggle:&lt;br&gt;
&lt;a href="https://www.kaggle.com/code/abbasi110/guidanceos-gemma4-offline-career-advisor" rel="noopener noreferrer"&gt;kaggle.com/code/abbasi110/guidanceos-gemma4-offline-career-advisor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Source code on GitHub:&lt;br&gt;
&lt;a href="https://github.com/soohanAbbasi/GuidanceOS" rel="noopener noreferrer"&gt;github.com/soohanAbbasi/GuidanceOS&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You need a Kaggle account to run it. Add the gemma-4-e4b-it model and both datasets, set the accelerator to GPU T4 x2, and run all cells in order. The Gradio URL prints in the last cell.&lt;/p&gt;




&lt;p&gt;That's the full build. If you have questions about any part of it — the quantization setup, the prompt templates, or the TF-IDF indexing — leave a comment and I'll answer.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>career</category>
      <category>llm</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
