<?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>Forem: Aagam</title>
    <description>The latest articles on Forem by Aagam (@mangaweeb340521).</description>
    <link>https://forem.com/mangaweeb340521</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%2F3816001%2F3da28988-e822-49ce-9e04-101d238981e2.jpg</url>
      <title>Forem: Aagam</title>
      <link>https://forem.com/mangaweeb340521</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mangaweeb340521"/>
    <language>en</language>
    <item>
      <title>Neural Networks: The First Step Toward Understanding Transformers</title>
      <dc:creator>Aagam</dc:creator>
      <pubDate>Mon, 16 Mar 2026 19:04:51 +0000</pubDate>
      <link>https://forem.com/mangaweeb340521/neural-networks-the-first-step-toward-understanding-transformers-enh</link>
      <guid>https://forem.com/mangaweeb340521/neural-networks-the-first-step-toward-understanding-transformers-enh</guid>
      <description>&lt;h1&gt;
  
  
  Understanding Neural Networks — The Foundation You Need Before Transformers
&lt;/h1&gt;

&lt;p&gt;Whenever we try to start learning about LLMs, the first word we come across is "Transformer," which is based on the paper &lt;em&gt;Attention Is All You Need&lt;/em&gt;. But when we start reading about it, we find it confusing. Do you know why? Because while reading, we come across a popular term — "neural architecture"  and we're like, "Yeah, we understand it," but to be honest, we don't.&lt;/p&gt;

&lt;p&gt;My goal is to make all the basics required to understand Transformers clear. In today's post, we will discuss neural networks, divided into five sections:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What is a neural network?&lt;/li&gt;
&lt;li&gt;Why do we need a neural network?&lt;/li&gt;
&lt;li&gt;How does it work?&lt;/li&gt;
&lt;li&gt;What advantages does it provide, and what are the use cases and limitations?&lt;/li&gt;
&lt;li&gt;What more can be explored in the future — research areas&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  1. What Is a Neural Network?
&lt;/h2&gt;

&lt;p&gt;A neural network, in a very simplified way, is nothing but a way to make our model mimic how our brain functions  or, you could say, how it processes information. It consists of internal units called neurons (nodes) that transform the input data with the help of weighted connections and nonlinear functions to learn patterns from the data.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Why Do We Need a Neural Network?
&lt;/h2&gt;

&lt;p&gt;Now another question arises: why do we even need a neural network? Before neural networks, we were heavily dependent on feature engineering and handcrafted rules for predictions. But this approach struggled when handling complex data, which gave rise to the need for better functionality and that was the neural network.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. How Does a Neural Network Work?
&lt;/h2&gt;

&lt;p&gt;Now the hardest but most exciting part  how does a neural network work exactly? I think this is something that is generally ignored by a lot of people, and that's what I think filters out good and bad engineers in today's era. To understand how it works exactly, we will divide the process into six simple steps.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1 — Input Layer
&lt;/h3&gt;

&lt;p&gt;A neural network does not understand raw images, text, or audio and thus everything must be converted into a numerical vector format. As the name specifies, this layer receives the input data, which can be anything: a video, image, or anything else. It uses multiple features of those inputs and converts them into one single input vector. For example, to predict house prices: &lt;code&gt;Input = [size, rooms, location_score]&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2 — Linear Transformation
&lt;/h3&gt;

&lt;p&gt;Once the input is converted into numerical vector format, we perform a linear combination of inputs. Confused? Yeah, I was too  like, what the hell is a "linear combination of inputs," and why do we do it?&lt;/p&gt;

&lt;p&gt;I had those questions too. I referred to blogs and GPT but couldn't understand it. Let's understand it together.&lt;/p&gt;

&lt;p&gt;So, let's first understand what we have: a vector from the input (image, video, or whatever), which will of course have multiple features. We don't know which features we need to give importance to — even our model doesn't. So we assign weights. How are the weights calculated? That's another big topic, but to simplify: we assign random weights at first, train the model on the input data, calculate the error with our weights, adjust the weights, and repeat the process thousands of times to arrive at valid weight values.&lt;/p&gt;

&lt;p&gt;We then multiply these weights with the input features and sum them up. But why do we do that? Because it tells the system how strongly it should weigh each feature for its prediction. However, it's still linear  we don't really know the true relationship yet. That is why we perform the next step.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3 — Activation Function
&lt;/h3&gt;

&lt;p&gt;So what we currently have is a raw signal — or, for people like me, I'd say a "random value," because I don't really know what the value means after we obtained it from the linear transformation.&lt;/p&gt;

&lt;p&gt;For this particular blog, I'm taking ReLU as the activation function, but there are other activation functions as well. ReLU converts this raw value by turning negative values to 0 and keeping positive values as they are. It basically means: if the answer is 0, don't fire (or use) this neuron; otherwise, fire it. Whatever output we get from the activation function becomes the input for the next step. Why? Let's see and understand together.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4 — Forward Propagation (Information Flows Through the Network)
&lt;/h3&gt;

&lt;p&gt;To understand forward propagation, we need to first understand the structure. Let's take a simple neural network architecture: it consists of multiple layers, each layer extracts meaningful information from the raw data, and each layer has multiple neurons. Each neuron has one job — to check if a particular pattern exists, and if it does, how strongly it exists.&lt;/p&gt;

&lt;p&gt;To make it simple, let's take an example. Suppose I have three layers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Layer 1&lt;/strong&gt; detects simple patterns  one neuron detects edges, another detects corners, and another detects shapes. It then sends the information to Layer 2.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Layer 2&lt;/strong&gt; detects complex shapes and patterns from the previous layer's output. It then forwards the information to Layer 3.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Layer 3&lt;/strong&gt; produces the final output. We apply a softmax function, which converts the raw output into probabilities  for example, detecting whether something is a dog's ear, a cat's ear, or something else.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;(Kindly find the diagram below.)&lt;/em&gt;&lt;br&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%2Fjeg2szh9638qpkdg0e8t.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%2Fjeg2szh9638qpkdg0e8t.png" alt=" " width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5 — Loss Function
&lt;/h3&gt;

&lt;p&gt;Now, once our model makes its prediction after forward propagation, it checks whether its prediction was correct or incorrect. We use &lt;strong&gt;cross-entropy loss&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;L = −∑ y log(ŷ)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Cross-entropy measures how wrong the prediction is. Here, &lt;strong&gt;y&lt;/strong&gt; is the actual class and &lt;strong&gt;ŷ&lt;/strong&gt; is the predicted class. From the log function, we understand that the loss is small when the correct class has a high probability and the loss is large when the correct class has a low probability.&lt;/p&gt;

&lt;p&gt;So our model's end goal is to minimize the loss. Once it gets the value of the loss, it moves to the next step: backward propagation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 6 — Backward Propagation
&lt;/h3&gt;

&lt;p&gt;We all kind of get the gist in backpropagation, the network goes back and finds which layer contributed how much to the error and then adjusts the weights accordingly, right? But have you ever wondered &lt;em&gt;how&lt;/em&gt; it knows who contributed to the error and how much?&lt;/p&gt;

&lt;p&gt;Well, here comes the main part: backward propagation uses the &lt;strong&gt;chain rule&lt;/strong&gt;. Now, I know a lot of us get scared when we hear "chain rule," but let's simplify it together. In the chain rule, we basically ask: "If we change the weight for a particular neuron slightly, how much does it affect the loss function?" We get the derivative using the chain rule, and once that is done, we update the weight using the formula below:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;new_weight = old_weight − learning_rate × gradient&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The gradient here is basically the derivative we found for that particular weight using the chain rule. And yes, generally the learning rate is constant across the whole model, but in practice, we change it during training.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Advantages and Limitations of Neural Networks
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Advantages
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;With the way neural networks adjust weights by themselves and learn patterns, they can definitely handle complex pattern recognition where traditional models used to fail.&lt;/li&gt;
&lt;li&gt;They can extract features automatically without the need for manual feature engineering.&lt;/li&gt;
&lt;li&gt;They became the foundation of modern AI.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Limitations
&lt;/h3&gt;

&lt;p&gt;Although neural networks come with a lot of advantages, there are some limitations too:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;They need a huge amount of data with a small dataset, there is a high chance the model will overfit.&lt;/li&gt;
&lt;li&gt;As we've seen in the "how it works" section, they require high computational cost.&lt;/li&gt;
&lt;li&gt;Lack of interpretability we don't even understand why the model made a specific decision. This same problem continues in today's modern AI, and even the CEOs of big AI companies say they don't fully know how it's working exactly.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  5. What More Can Be Explored — Research Areas
&lt;/h2&gt;

&lt;p&gt;For me personally, one thing that can really be researched is &lt;strong&gt;mechanistic interpretability of neural networks&lt;/strong&gt; understanding how neural networks internally represent concepts and make decisions. To frame it as a question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;How can we automatically discover interpretable functional circuits inside large neural networks instead of relying on manual neuron-level analysis?&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>llm</category>
      <category>ai</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>I Got a Surprise API Bill. So I Built a Runtime That Enforces Agent Budgets.</title>
      <dc:creator>Aagam</dc:creator>
      <pubDate>Tue, 10 Mar 2026 05:35:58 +0000</pubDate>
      <link>https://forem.com/mangaweeb340521/i-got-a-surprise-api-bill-so-i-built-a-runtime-that-enforces-agent-budgets-51p</link>
      <guid>https://forem.com/mangaweeb340521/i-got-a-surprise-api-bill-so-i-built-a-runtime-that-enforces-agent-budgets-51p</guid>
      <description>&lt;p&gt;I was running an AI agent nothing fancy, just a research task. Left it running overnight.&lt;br&gt;
Woke up to a bill I didn't expect.&lt;br&gt;
The agent hadn't done anything malicious. It just... kept going. Looping, retrying, calling the model over and over, because nobody told it to stop. No token cap. No cost limit. No guardrails whatsoever.&lt;br&gt;
That's the thing nobody talks about with AI agents: they're eager. Give them a task and they'll spend whatever it takes to finish it — or to try to finish it. And if you're not watching, you find out the hard way.&lt;br&gt;
That's why I built Joule.&lt;/p&gt;

&lt;p&gt;The Core Problem&lt;br&gt;
Most agent frameworks — LangChain, CrewAI, AutoGen are great at building agents. Defining tools, chaining steps, routing between models. They solve the "how do I make the agent do things" problem well.&lt;br&gt;
But none of them solve the "how do I stop the agent from doing too much" problem.&lt;br&gt;
There's no built-in budget. No hard stop. No governance. You're basically handing your agent a credit card with no limit and hoping for the best.&lt;/p&gt;

&lt;p&gt;What Joule Does Differently&lt;br&gt;
Joule is an agent runtime where every task runs inside a budget envelope. You set limits before execution. The agent operates within them. When a limit is hit, it stops — cleanly, with a structured result.&lt;br&gt;
Here's the simplest usage:&lt;br&gt;
typescriptimport { Joule } from '&lt;a class="mentioned-user" href="https://dev.to/joule"&gt;@joule&lt;/a&gt;/core';&lt;/p&gt;

&lt;p&gt;const answer = await Joule.simple("Summarize the top 3 HN stories today");&lt;br&gt;
console.log(answer);&lt;br&gt;
Auto-detects your API keys. Applies a sensible default budget. Returns a string. No surprises.&lt;br&gt;
For production, you take control:&lt;br&gt;
typescriptconst joule = new Joule({&lt;br&gt;
  providers: { anthropic: { enabled: true } },&lt;br&gt;
  budget: {&lt;br&gt;
    maxTokens: 50_000,&lt;br&gt;
    maxCostUsd: 0.50,&lt;br&gt;
  },&lt;br&gt;
  governance: {&lt;br&gt;
    constitution: 'default',&lt;br&gt;
    requireApproval: ['shell_exec'],&lt;br&gt;
  },&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;const result = await joule.execute({&lt;br&gt;
  description: "Analyze our Q4 metrics and draft a summary",&lt;br&gt;
  budget: 'medium',&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;console.log(result.result);&lt;br&gt;
console.log(&lt;code&gt;Cost: $${result.budgetUsed.costUsd} | Tokens: ${result.budgetUsed.tokensUsed}&lt;/code&gt;);&lt;br&gt;
The agent runs. Hits a step where it would exceed $0.50. Stops. Returns what it has. You get a budgetUsed breakdown with every execution — token count, dollar cost, latency, tool calls.&lt;/p&gt;

&lt;p&gt;Budget Enforcement Across 7 Dimensions&lt;br&gt;
One thing I wanted to get right was what gets budgeted. Token and cost limits are obvious. But agents can go wrong in other ways too.&lt;br&gt;
Joule tracks and enforces limits across:&lt;br&gt;
DimensionWhat it limitsTokensTotal LLM tokens consumedCost (USD)Dollar spend on API callsLatencyWall-clock timeTool callsNumber of tool invocationsEscalationsUpgrades from cheap → expensive modelsEnergy (Wh)Estimated compute energyCarbon (gCO₂)Estimated emissions&lt;br&gt;
The energy and carbon tracking came from my other research in LLM inference optimization — it felt wrong to build a "cost-aware" runtime that ignored the environmental cost. So those dimensions are first-class.&lt;/p&gt;

&lt;p&gt;Smart Routing: Start Cheap, Escalate Only When Needed&lt;br&gt;
One of the key things that makes Joule efficient is the model router. By default, it picks the smallest model that can handle the task — local Ollama, gpt-4o-mini, Haiku — and only escalates to a larger model if the task genuinely needs it and the budget allows it.&lt;br&gt;
For simple tasks, the planning prompt drops from ~2900 tokens to ~50 by stripping tool descriptions entirely. It's not a trick — it's just: don't send information the model doesn't need.&lt;br&gt;
The result: in benchmarks against CrewAI across 30 tasks, Joule was 1.5x faster on average, with the biggest gap on generation tasks (1.8x). And that's before counting the budget enforcement and governance that CrewAI doesn't do at all.&lt;/p&gt;

&lt;p&gt;Governance: What the Agent Is Allowed to Do&lt;br&gt;
Budget is about how much. Governance is about what.&lt;br&gt;
Joule has a constitutional layer — three tiers of rules:&lt;/p&gt;

&lt;p&gt;Hard boundaries — never violated, no override. ("Never expose PII.")&lt;br&gt;
Soft boundaries — can be overridden with authority + audit trail. ("Prefer local models.")&lt;br&gt;
Aspirational principles — guide behavior, don't block execution. ("Minimize token usage.")&lt;/p&gt;

&lt;p&gt;You configure it in YAML:&lt;br&gt;
yamlgovernance:&lt;br&gt;
  constitution: default&lt;br&gt;
  requireApproval:&lt;br&gt;
    - shell_exec       # human-in-the-loop before running shell commands&lt;br&gt;
    - file_delete      # prevent accidental data loss&lt;br&gt;
  budget:&lt;br&gt;
    maxCostUsd: 1.00   # hard stop&lt;br&gt;
And there's a trust scoring system — agents earn autonomy through clean behavior. New agents get watched closely. Clean track record → more tools unlocked, less oversight. A violation → demotion, increased scrutiny, or quarantine.&lt;br&gt;
It sounds elaborate, but it basically answers the question: if I'm running 10 agents in parallel, how do I know they're not doing something I didn't ask for?&lt;/p&gt;

&lt;p&gt;Current Status&lt;br&gt;
The runtime is in active development. 1140 tests passing across 91 files. The core — task execution, budget enforcement, model routing, governance, multi-agent crews — is solid. The observability layer (React dashboard, Prometheus metrics, OTLP/Langfuse export) is working.&lt;br&gt;
Known rough edges: the computer/desktop automation agent is good for Office tasks but struggles with complex browser workflows. The governance layer is implemented but still maturing.&lt;/p&gt;

&lt;p&gt;Why This Matters Now&lt;br&gt;
Agent frameworks are everywhere. The "build an agent in 10 lines" demo is easy. Shipping an agent to production — one that doesn't blow your budget, doesn't do things you didn't authorize, and that you can debug after the fact is still genuinely hard.&lt;br&gt;
That's the gap Joule is trying to close.&lt;br&gt;
If you've ever woken up to a surprise API bill, you already understand the problem. The solution shouldn't be "just remember to add a token limit." It should be baked into the runtime.&lt;/p&gt;

&lt;p&gt;GitHub: github.com/Aagam-Bothara/Joule&lt;br&gt;
Feedback, issues, and contributions very welcome. Still early — but the foundation is there.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>aiops</category>
      <category>agents</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
