<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Ai Agents]]></title><description><![CDATA[Ai Agents]]></description><link>https://connectai.blog</link><generator>RSS for Node</generator><lastBuildDate>Wed, 08 Apr 2026 10:57:53 GMT</lastBuildDate><atom:link href="https://connectai.blog/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Agents : Architecture and Design]]></title><description><![CDATA[The term “agent” can have multiple interpretations. Some define agents as fully autonomous systems that operate independently over extended periods, leveraging various tools to complete complex tasks. Others use the term to refer to more structured i...]]></description><link>https://connectai.blog/agents-architecture-and-design</link><guid isPermaLink="true">https://connectai.blog/agents-architecture-and-design</guid><category><![CDATA[AI]]></category><category><![CDATA[llm]]></category><category><![CDATA[agentic AI]]></category><category><![CDATA[agents]]></category><category><![CDATA[#anthropic]]></category><dc:creator><![CDATA[Harshit Sharma]]></dc:creator><pubDate>Sat, 15 Mar 2025 07:56:10 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/gPASJNVOuM0/upload/579463eb79393c45fe6c0884bece67fa.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The term <strong>“agent”</strong> can have multiple interpretations. Some define agents as fully autonomous systems that operate independently over extended periods, leveraging various tools to complete complex tasks. Others use the term to refer to more structured implementations that adhere to predefined workflows.</p>
<p>We categorize all these variations as <strong>agentic systems</strong>, but we draw an important architectural distinction between <strong>workflows</strong> and <strong>agents</strong>:</p>
<p>• <strong>Workflows</strong> are structured systems where LLMs and tools operate through predefined code paths.</p>
<p>• <strong>Agents</strong>, in contrast, dynamically determine their own processes and tool usage, maintaining control over how they accomplish tasks.</p>
<h3 id="heading-workflows">Workflows</h3>
<p>When complexity increases, <strong>workflows</strong> offer predictability and consistency for well-defined tasks, whereas <strong>agents</strong>excel when flexibility and model-driven decision-making are needed at scale.</p>
<p><strong>Types of Workflows</strong></p>
<p><strong>Prompt Chaining</strong></p>
<p>A structured sequence of LLM interactions, where each step builds on the previous one.</p>
<p><a target="_blank" href="https://www.anthropic.com/engineering/building-effective-agents"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742024937135/49858a9a-d5c5-4fdd-8623-21a8e1ef741e.webp" alt class="image--center mx-auto" /></a></p>
<p><strong>Routing</strong></p>
<p><a target="_blank" href="https://www.anthropic.com/engineering/building-effective-agents"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742024967579/a61185ce-774b-4a5d-9717-8e82738adcae.webp" alt class="image--center mx-auto" /></a></p>
<p><strong>When to use it:</strong> Best suited for complex tasks that require distinct handling for different categories. This workflow relies on classification—either by an LLM or a traditional model/algorithm—to direct tasks down the appropriate paths.</p>
<p><strong>Parallelization</strong></p>
<p><a target="_blank" href="https://www.anthropic.com/engineering/building-effective-agents"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742024989364/bb53ff6d-9b8e-4a78-9694-ed04305fad6c.webp" alt class="image--center mx-auto" /></a></p>
<p><strong>When to use it:</strong> Ideal when subtasks can be executed simultaneously for increased speed or when multiple perspectives or attempts improve accuracy. LLMs tend to perform better when each consideration in a complex task is handled through a separate LLM call.</p>
<p><strong>Orchestrator-Workers</strong></p>
<p><a target="_blank" href="https://www.anthropic.com/engineering/building-effective-agents"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742025005956/43ca6c93-d7f9-4ee0-8b4d-c2fcd8704623.webp" alt class="image--center mx-auto" /></a></p>
<p><strong>When to use it:</strong> This workflow is effective for complex tasks where the necessary subtasks cannot be predicted in advance. Unlike parallelization, where tasks are predefined, an <strong>orchestrator</strong> determines which subtasks are needed based on input.</p>
<p>Example: Coding tools that modify multiple files dynamically, depending on the nature of the requested changes.</p>
<p><strong>Evaluator-Optimizer</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742025046703/8785de29-1b9f-465c-b27e-df09dd65a7c4.webp" alt class="image--center mx-auto" /></p>
<p>In this iterative workflow, one LLM generates a response while another evaluates and refines it in a feedback loop.</p>
<h3 id="heading-agents">Agents</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742025065836/87c91a26-055b-4f1c-906c-0996c1f51572.webp" alt class="image--center mx-auto" /></p>
<p><strong>When to use agents:</strong> Agents are ideal for open-ended problems where the number of required steps is unpredictable, and a fixed process cannot be hardcoded. They enable LLMs to operate autonomously over multiple turns, making them well-suited for scaling tasks in trusted environments where decision-making flexibility is essential.</p>
<h3 id="heading-summary">Summary</h3>
<p>We often mistake workflows for agents, assuming they operate the same way. However, when I started using <a target="_blank" href="https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview">Claude Code,</a> I truly understood what an agent actually is. Many times, we’re using workflows but believe there’s an agent working behind the scenes.</p>
<p>Above definitions and diagrams are from Anthropic guidelines towards building effective agents <a target="_blank" href="https://www.anthropic.com/engineering/building-effective-agents">https://www.anthropic.com/engineering/building-effective-agents</a></p>
]]></content:encoded></item><item><title><![CDATA[Agents : Memory]]></title><description><![CDATA[Implementing Long-Term Memory in AI Agents (Semantic, Episodic, Procedural) with LangMem
AI agents powered by large language models (LLMs) can appear more intelligent and personalized when they remember information over time. By equipping agents with...]]></description><link>https://connectai.blog/agents-memory</link><guid isPermaLink="true">https://connectai.blog/agents-memory</guid><category><![CDATA[llm]]></category><category><![CDATA[agentic AI]]></category><category><![CDATA[agents]]></category><category><![CDATA[Machine Learning]]></category><category><![CDATA[AI]]></category><category><![CDATA[langgraph]]></category><dc:creator><![CDATA[Harshit Sharma]]></dc:creator><pubDate>Mon, 10 Mar 2025 06:01:22 GMT</pubDate><content:encoded><![CDATA[<p><strong>Implementing Long-Term Memory in AI Agents (Semantic, Episodic, Procedural) with</strong> <a target="_blank" href="https://langchain-ai.github.io/langmem/"><strong>LangMem</strong></a></p>
<p>AI agents powered by large language models (LLMs) can appear more intelligent and personalized when they <strong>remember</strong> information over time. By equipping agents with long-term memory, developers enable them to recall facts, past interactions, and learned skills beyond a single chat session. In this article, we’ll conduct a deep dive into the role of memory in AI agents, focusing on the three key types of memory – <strong>semantic, episodic, and procedural</strong> – and how to implement each.</p>
<p>We’ll explore conceptual differences between these memory types, practical strategies for integrating memory into AI systems, and specific techniques using the <a target="_blank" href="https://blog.langchain.dev/langmem-sdk-launch/"><strong>LangMem</strong></a> framework (a toolkit for long-term memory in LangChain). We’ll also discuss optimization techniques like delayed memory processing, dynamic namespaces, efficient retrieval, and the performance trade-offs involved in giving your AI a long-term memory.</p>
<h3 id="heading-conceptual-understanding-memory-types-in-ai-agents"><strong>Conceptual Understanding: Memory Types in AI Agents</strong></h3>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Memory Type</td><td>Purpose</td><td>Agent Example</td><td>Human Example</td><td>Typical Storage Pattern</td></tr>
</thead>
<tbody>
<tr>
<td>Semantic</td><td>Facts &amp; Knowledge</td><td>User preferences; knowledge triplets</td><td>Knowing Python is a programming language</td><td>Profile or Collection</td></tr>
<tr>
<td>Episodic</td><td>Past Experiences</td><td>Few-shot examples; Summaries of past conversations</td><td>Remembering your first day at work</td><td>Collection</td></tr>
<tr>
<td>Procedural</td><td>System Behavior</td><td>Core personality and response patterns</td><td>Knowing how to ride a bicycle</td><td>Prompt rules or Collection</td></tr>
</tbody>
</table>
</div><p><strong>Source :</strong> <a target="_blank" href="https://blog.langchain.dev/langmem-sdk-launch/">https://blog.langchain.dev/langmem-sdk-launch/</a></p>
<p>Just as humans have multiple forms of memory, AI agents can benefit from different memory types for different purposes . In cognitive terms, we can draw analogies to human memory when designing AI agent memory:</p>
<p>• <strong>Semantic Memory (Facts &amp; Knowledge):</strong> Semantic memory is about storing factual information or general knowledge an agent has learned . In humans, this is like remembering that <em>Paris is the capital of France</em> or <em>Python is a programming language</em>. For AI, semantic memory might include <strong>facts about the user or world</strong> that were learned during interactions or provided as data (e.g. a user’s name, preferences, key domain facts) . This memory enables the agent to ground its responses with correct details and personalization. <em>Example:</em> A virtual assistant’s semantic memory could store that the user’s favorite cuisine is Italian and their birthday is July 20th, so it can later recommend Italian restaurants or send birthday wishes.</p>
<p>• <strong>Episodic Memory (Events &amp; Experiences):</strong> Episodic memory records specific experiences or past events . For humans, episodic memories might be <em>recollections of your first day at work or a memorable trip</em>. In AI agents, episodic memory means remembering <strong>past dialogues or problem-solving episodes</strong> – essentially the agent’s own experiences in dealing with certain situations . This could include summaries of previous conversations, successful task outcomes, or mistakes made, along with the context in which they occurred.</p>
<p>Episodic memory helps the agent recall <em>“how did I handle this before?”</em> and apply that experience to guide future behavior . <em>Example:</em> A customer support chatbot’s episodic memory might include a summary of the last support session with a user, so if the user returns, the bot remembers what was tried before and what the result was.</p>
<p>• <strong>Procedural Memory (Skills &amp; Behaviors):</strong> Procedural memory captures the <strong>know-how for performing tasks</strong>, encompassing rules, skills, or policies the agent follows . In humans, this is like the ingrained skill of <em>riding a bicycle</em> or <em>playing the piano</em> – you might not recall a specific event, but you have internalized how to do it. For AI agents, procedural memory manifests in the agent’s core behavior: it can be encoded in the model’s weights, in the agent’s code, or importantly in the <strong>system prompts and instructions</strong> that guide its responses . By updating its procedural memory, an agent can <strong>learn new behaviors or refine its style over time</strong> without changing its underlying model weights . <em>Example:</em> An AI coding assistant might learn over time to adopt a more detailed code commenting style after it consistently gets user feedback asking for more explanation. This learned behavior is stored as an adjustment to its system prompt (procedural memory), so future code outputs include better comments by default.</p>
<p><strong>Semantic memory</strong> gives the agent a knowledge base of facts (the <em>“<strong>**what”</strong></em>)<br /><strong>Episodic memory</strong> provides it with personal experiences (the <strong><em>“when and how”</em></strong> of past events)<br /><strong>Procedural memory</strong> governs its inherent skills or behaviors (the <strong><em>“how to do”</em></strong> rules).</p>
<p>In practice, an AI agent will typically use a combination of all three to achieve more intelligent and personalized interactions. For example, a sophisticated personal assistant might use semantic memory to recall a user’s preferences, episodic memory to remember the context of previous conversations with that user, and procedural memory to adapt its tone or strategy based on what has been effective in the past.</p>
<h3 id="heading-implementation-strategies-for-ai-agent-memory">Implementation Strategies for AI Agent Memory</h3>
<p>How can developers equip AI agents with these forms of memory? Implementing memory in AI systems involves deciding <strong>what information to store</strong>, <strong>how to store it</strong>, and <strong>when to retrieve or update it</strong> during conversations . Below, we outline strategies for integrating each type of memory into an AI agent, along with real-world use cases and best practices. There are implementations using Langmem , do checkout some examples here : <a target="_blank" href="https://github.com/linux-devil/llm_learning/tree/main/agent_memory">https://github.com/linux-devil/llm_learning/tree/main/agent_memory</a></p>
<h3 id="heading-semantic-memory-implementation-facts-amp-knowledge">Semantic Memory Implementation (Facts &amp; Knowledge)</h3>
<p>To give an AI agent semantic memory, you need a mechanism to <strong>capture facts or details</strong> and store them in a retrievable format. A common strategy is to use a <strong>knowledge base or database</strong> (often vector databases for semantic search) to store facts extracted from interactions:</p>
<p>• <strong>Extracting Facts:</strong> After or during a conversation, you can run a process to <strong>extract key facts or data points</strong> that emerged. This could be done by calling an LLM to summarize the conversation or pull out structured facts (e.g. in JSON). For example, if a user mentions their birthday or a new preference, the agent should record that fact. Many developers implement this by writing a prompt like <em>“List any new facts the user stated about themselves”</em> and having the LLM output those facts for storage.</p>
<p>To use it, you create a memory manager specifying the LLM and optionally a schema for the information you want to extract. For example, if you want to store user preferences as facts, you might define a Pydantic model for a UserPreference or UserProfile and pass that schema to the manager. Below is an example of setting up a memory manager to extract a user’s profile information (name, preferred name, style, skills, etc.) from a conversation:</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> pydantic <span class="hljs-keyword">import</span> BaseModel, Field
<span class="hljs-keyword">from</span> langmem <span class="hljs-keyword">import</span> create_memory_manager

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">UserProfile</span>(<span class="hljs-params">BaseModel</span>):</span>
    <span class="hljs-string">"""Save the user's preferences and traits."""</span>
    name: str
    preferred_name: str
    response_style_preference: str
    special_skills: list[str]
    other_preferences: list[str]

manager = create_memory_manager(
    <span class="hljs-string">"anthropic:claude-3-5"</span>,  <span class="hljs-comment"># LLM to use for extraction</span>
    schemas=[UserProfile],
    instructions=<span class="hljs-string">"Extract user preferences and settings"</span>,
    enable_inserts=<span class="hljs-literal">False</span>  <span class="hljs-comment"># We'll update one profile document</span>
)
<span class="hljs-comment"># Assume we have a conversation list of messages (user and assistant turns)</span>
profile_memories = manager.invoke({<span class="hljs-string">"messages"</span>: conversation})
profile = profile_memories[<span class="hljs-number">0</span>].content  <span class="hljs-comment"># This is a UserProfile object</span>
print(profile)
</code></pre>
<p>In this snippet, the memory manager is instructed to extract the user’s preferences and settings from a conversation. When invoke is called with the conversation, the LLM processes it according to the schema and instructions, returning a UserProfile object filled with information gleaned from the dialogue . For example, if the user said “Hi! I’m Alex but please call me Lex. I’m a wizard at Python and love making AI systems that don’t sound like boring corporate robots…” and so on, the memory manager might produce a profile like:</p>
<pre><code class="lang-python">name=<span class="hljs-string">"Alex"</span>,
preferred_name=<span class="hljs-string">"Lex"</span>,
response_style_preference=<span class="hljs-string">"casual and witty with appropriate emojis"</span>,
special_skills=[<span class="hljs-string">"Python programming"</span>, <span class="hljs-string">"AI development"</span>, <span class="hljs-string">"competitive speedcubing"</span>],
other_preferences=[<span class="hljs-string">"prefers informal communication"</span>, <span class="hljs-string">"dislikes corporate-style interactions"</span>]
</code></pre>
<p>• <strong>Retrieving and Using Facts:</strong> When the agent is generating a response, relevant facts from semantic memory should be retrieved and injected into the prompt (often as part of the system message or additional context). This retrieval is typically done via <strong>semantic search</strong>: comparing the current query or conversation context with stored memory embeddings to find related info . For instance, if the user asks <em>“Can you recommend a restaurant for tonight?”</em>, the agent might query the memory store for the user’s known food preferences or past restaurant conversations, then use those facts (e.g. <em>“user likes Italian”</em>) to tailor its answer. Efficient retrieval may involve filtering by user or category and then ranking by similarity to ensure only the most relevant facts are included.</p>
<h3 id="heading-episodic-memory-implementation-past-experiences">Episodic Memory Implementation (Past Experiences)</h3>
<p>Episodic memory in AI agents refers to preserving the context and outcomes of past interactions – essentially, <strong>remembering stories or episodes</strong> from the agent’s experience. Implementing episodic memory often involves capturing <strong>conversation transcripts or distilled “experience logs”</strong> that the agent can refer to in the future:</p>
<p>• <strong>Capturing Episodes:</strong> Not every interaction needs to become an episodic memory. A typical approach is to store <strong>notable interactions</strong>, such as successful problem-solving sessions, important user interactions, or failures that the agent should learn from. One way to do this is by summarizing entire conversations or critical segments into a concise narrative. For instance, after a support chat that ends with a satisfied user, the system can summarize: <em>“User had issue X, agent walked them through steps Y, issue resolved and user was happy”</em> – this summary becomes an episodic memory. Some frameworks treat this like an <strong>“experience replay”</strong> concept, similar to reinforcement learning, where the agent writes down the key situation, the actions it took, and the result .</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Episode</span>(<span class="hljs-params">BaseModel</span>):</span>  <span class="hljs-comment"># </span>
    <span class="hljs-string">"""Write the episode from the perspective of the agent within it. Use the benefit of hindsight to record the memory, saving the agent's key internal thought process so it can learn over time."""</span>

    observation: str = Field(..., description=<span class="hljs-string">"The context and setup - what happened"</span>)
    thoughts: str = Field(
        ...,
        description=<span class="hljs-string">"Internal reasoning process and observations of the agent in the episode that let it arrive"</span>
        <span class="hljs-string">' at the correct action and result. "I ..."'</span>,
    )
    action: str = Field(
        ...,
        description=<span class="hljs-string">"What was done, how, and in what format. (Include whatever is salient to the success of the action). I .."</span>,
    )
    result: str = Field(
        ...,
        description=<span class="hljs-string">"Outcome and retrospective. What did you do well? What could you do better next time? I ..."</span>,
    )

<span class="hljs-comment">#  The Episode schema becomes part of the memory manager's prompt,</span>
<span class="hljs-comment"># helping it extract complete reasoning chains that guide future responses</span>
manager = create_memory_manager(
    <span class="hljs-string">"openai:gpt-4o-mini"</span>,
    schemas=[Episode],
    instructions=<span class="hljs-string">"Extract examples of successful explanations, capturing the full chain of reasoning. Be concise in your explanations and precise in the logic of your reasoning."</span>,
    enable_inserts=<span class="hljs-literal">True</span>,
)

<span class="hljs-comment"># Configure memory manager with storage</span>
manager = create_memory_store_manager(
    <span class="hljs-string">"openai:gpt-4o-mini"</span>,
    namespace=(<span class="hljs-string">"memories"</span>, <span class="hljs-string">"episodes"</span>),
    schemas=[Episode],
    instructions=<span class="hljs-string">"Extract exceptional examples of noteworthy problem-solving scenarios, including what made them effective."</span>,
    enable_inserts=<span class="hljs-literal">True</span>,
)
</code></pre>
<p>• <strong>Structured Experience Logs:</strong> It can help to structure episodic memories for consistency. For example, you might define an <em>Episode</em> record with fields such as situation/context, action_taken (or chain of thought), and outcome . This is akin to a journal entry that explains <em>how</em> the agent approached a problem and what happened. By storing the agent’s internal reasoning along with the outcome, the agent can later analyze what strategies work well. This technique was demonstrated by the LangMem framework, which allows defining a Pydantic schema for an Episode and using an LLM to fill it out after an interaction . The episodic memory entry essentially captures <em>“how did I get to a good answer and what was the result?”</em> in a given scenario.</p>
<p>• <strong>Using Episodes for Learning:</strong> When faced with a new task, an agent can retrieve relevant episodes to guide its behavior. This often takes the form of <strong>few-shot prompting</strong>: supplying the model with examples from past episodes that are similar to the current context . Typically, episodic memories are retrieved by similarity (e.g., via an embedding search on the episode descriptions) or by tagging (metadata indicating the type of scenario). Including a highly relevant past example in the prompt can significantly improve performance on tasks that are similar to what the agent has seen before.</p>
<p><strong>Real-world use case:</strong> Consider an AI tutoring system that helps students solve math problems. It can maintain episodic memories of each tutoring session: what problems were attempted, which hints helped, and where the student struggled. Later, if the same student (or even another student) faces a similar problem, the agent can recall the episode to avoid ineffective hints and apply strategies that proved successful. Another example: in AI game agents, episodic memory could be used to remember sequences of moves that led to victory or defeat, informing future decision-making.</p>
<h3 id="heading-procedural-memory-implementation-skills-amp-behaviors"><strong>Procedural Memory Implementation (Skills &amp; Behaviors)</strong></h3>
<p>Procedural memory is about <strong>how an agent does things</strong> – its ingrained skills or policies. Implementing procedural memory in AI agents often means enabling the agent to <strong>learn from feedback and change its core behavior</strong> (usually its system prompt or internal rules) over time . Unlike semantic or episodic memory which store content to <em>inject</em>, procedural memory updates how the agent formulates responses. Here are strategies to implement it:</p>
<p>• <strong>Prompt Refinement (“Self-Improvement”):</strong> A straightforward way for an agent to adjust its behavior is to refine its system prompt or instructions based on experience. For example, suppose an agent consistently gets feedback that its answers are too verbose. The developer could manually edit the system prompt to say “be concise”, but with procedural memory, the agent can learn this itself. One technique is <strong>reflective prompt optimization</strong> – after some interactions, run a process where the agent (or a separate LLM) reviews conversation transcripts and feedback to propose an updated prompt or new rules for itself. This is sometimes called <em>meta-prompting</em> or the <em>“reflect, then improve”</em> approach . The agent essentially asks <em>“How can I do better next time?”</em> and writes an improved instruction set.</p>
<p>• <strong>Feedback Loops:</strong> To know how to change its behavior, the agent needs feedback or a measure of success. This can come from explicit user feedback (thumbs-up/down, corrections) or an automated evaluation of the agent’s responses (a reward score). Developers can implement a loop where after each interaction (or batch of interactions), if the outcome was poor, the agent’s procedural memory is updated. For instance, an agent that failed a task might add a rule <em>“If the user asks X, remember to do Y first”</em> to avoid repeating the mistake. If it succeeded, it might strengthen the behavior that led to success (like <em>“Always double-check the user’s question for ambiguities”</em>). This is analogous to <strong>Reinforcement Learning from Human Feedback (RLHF)</strong>, but can be done on the fly with prompt engineering rather than weight tuning – by adding or adjusting instructions.</p>
<p><strong>Real-world use case:</strong> An AI content generator might notice that its user prefers outputs in a certain style (e.g. with more humor). Procedural memory allows it to internalize this style guideline. Over time and with subtle feedback (the user tends to regenerate content until a humorous one appears, etc.), the agent can adapt its core writing style to be more humorous by default, without being explicitly told on each request. Another scenario: a multi-step task-solving agent (like those using ReAct or tool use) can refine its approach to using tools. If it observes that a particular sequence of tool uses leads to better outcomes (say, always do a web search before answering a question about current events), it can incorporate that as a new step in its policy through procedural memory.</p>
<h3 id="heading-using-the-langmem-framework-for-ai-agent-memory"><strong>Using the LangMem Framework for AI Agent Memory</strong></h3>
<p>Manually implementing the above memory mechanisms can be complex, but there are frameworks designed to simplify this. <a target="_blank" href="https://langchain-ai.github.io/langmem/"><strong>LangMem</strong></a> is a recently introduced SDK specifically for managing long-term memory in AI agents . It is part of the LangChain ecosystem and provides out-of-the-box tools to handle semantic, episodic, and procedural memory for agents. Let’s explore how LangMem supports these memory types and how developers can use it in practice.</p>
<p><strong>Memory Tools and Integration</strong></p>
<p>Beyond the core APIs, LangMem also provides <strong>memory tools</strong> that integrate into an agent’s reasoning loop. If you’re using a LangChain agent (like a ReAct agent), you can give the agent tools such as <strong>ManageMemory</strong> and <strong>SearchMemory</strong> so that the agent can decide when to store or retrieve memories during conversation . For example:</p>
<p>• create_manage_memory_tool(namespace=...) creates a tool that the agent can invoke to save new information. The agent would invoke this when it deems something worth remembering (perhaps guided by its prompt or chain logic).</p>
<p>• create_search_memory_tool(namespace=...) allows the agent to query its long-term memory. The agent might use this tool when it faces a question and wants to see if it “knows” something from before.</p>
<h3 id="heading-summary">Summary</h3>
<p>In summary, adding long-term memory to AI agents is extremely promising for creating more capable and personalized systems, but it requires careful thought to get right. By understanding the types of memory (semantic for facts, episodic for experiences, procedural for skills), using frameworks like LangMem to implement them, and applying optimization techniques, developers can build agents that <strong>learn and improve over time</strong>. The trade-offs can be managed by smart design: isolate and target what to remember, update memories at the right moments, and retrieve information efficiently. With these practices, you can give your AI agent a robust memory that significantly enhances its performance and user experience, while keeping the system scalable and cost-effective.</p>
]]></content:encoded></item><item><title><![CDATA[DeepGEMM: Clean and Efficient FP8 GEMM Library]]></title><description><![CDATA[Introduction
DeepGEMM is a clean and efficient FP8 General Matrix Multiplication (GEMM) library with fine-grained scaling, released by DeepSeek as part of their "Open Source Week" in February 2025. It supports both normal dense GEMMs and Mixture-of-E...]]></description><link>https://connectai.blog/deepgemm-clean-and-efficient-fp8-gemm-library</link><guid isPermaLink="true">https://connectai.blog/deepgemm-clean-and-efficient-fp8-gemm-library</guid><category><![CDATA[AI]]></category><category><![CDATA[llm]]></category><category><![CDATA[Deepseek]]></category><dc:creator><![CDATA[Harshit Sharma]]></dc:creator><pubDate>Sat, 08 Mar 2025 17:54:19 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction</h2>
<p>DeepGEMM is a clean and efficient FP8 General Matrix Multiplication (GEMM) library with fine-grained scaling, released by DeepSeek as part of their "Open Source Week" in February 2025. It supports both normal dense GEMMs and Mixture-of-Experts (MoE) grouped GEMMs, providing high-performance matrix operations critical for modern AI models.</p>
<h2 id="heading-background-and-motivation">Background and Motivation</h2>
<p>Matrix multiplication is at the heart of deep learning computations, particularly in transformer-based models. As models continue to scale, there's an increasing need for more efficient matrix operations that can leverage hardware capabilities while maintaining numerical stability. FP8 (8-bit floating point) has emerged as a promising data format that offers a balance between precision and computational efficiency.</p>
<p>However, implementing efficient FP8 GEMM operations is challenging, especially when considering the complexities of modern GPU architectures and the need for fine-grained scaling to maintain numerical stability. Existing libraries often involve complex template metaprogramming that makes them difficult to understand and modify.</p>
<p>DeepGEMM was developed to address these challenges by providing a clean, efficient, and accessible implementation of FP8 GEMM operations that achieves high performance while maintaining readability and extensibility.</p>
<h2 id="heading-key-features-and-capabilities">Key Features and Capabilities</h2>
<p>DeepGEMM offers several key features that make it valuable for AI model development:</p>
<ol>
<li><p><strong>Lightweight Design</strong>: Core kernel function of only ~300 lines of code, making it accessible as a learning resource while still delivering high performance.</p>
</li>
<li><p><strong>Just-In-Time (JIT) Compilation</strong>: No compilation needed during installation, as kernels are compiled at runtime using a lightweight JIT module.</p>
</li>
<li><p><strong>FP8 Support with Fine-Grained Scaling</strong>: Implements efficient FP8 operations with fine-grained scaling to maintain numerical stability.</p>
</li>
<li><p><strong>Multiple GEMM Formats</strong>:</p>
<ul>
<li><p>Normal dense GEMM for standard matrix operations</p>
</li>
<li><p>Grouped contiguous GEMM for MoE models with contiguous layout</p>
</li>
<li><p>Grouped masked GEMM for MoE models with masked layout</p>
</li>
</ul>
</li>
<li><p><strong>High Performance</strong>: Achieves up to 1350+ FP8 TFLOPS on Hopper GPUs, matching or exceeding expert-tuned libraries across various matrix shapes.</p>
</li>
<li><p><strong>Auto-Tuning</strong>: Automatically selects optimal kernel configurations for different matrix shapes and hardware setups.</p>
</li>
</ol>
<h2 id="heading-technical-implementation">Technical Implementation</h2>
<p>DeepGEMM is implemented as a combination of Python and CUDA components with a focus on clean design and runtime optimization. The implementation consists of several key components:</p>
<ol>
<li><p><strong>JIT Compilation System</strong>:</p>
<ul>
<li><p>Compiles CUDA kernels at runtime using templates</p>
</li>
<li><p>Caches compiled kernels for reuse</p>
</li>
<li><p>Supports FFMA interleaving optimization for better performance</p>
</li>
</ul>
</li>
<li><p><strong>GEMM Kernels</strong>:</p>
<ul>
<li><p>Normal dense GEMM: <code>gemm_fp8_fp8_bf16_nt</code></p>
</li>
<li><p>Grouped contiguous GEMM: <code>m_grouped_gemm_fp8_fp8_bf16_nt_contiguous</code></p>
</li>
<li><p>Grouped masked GEMM: <code>m_grouped_gemm_fp8_fp8_bf16_nt_masked</code></p>
</li>
</ul>
</li>
<li><p><strong>Auto-Tuning System</strong>:</p>
<ul>
<li><p>Automatically selects optimal kernel configurations</p>
</li>
<li><p>Tunes parameters like block sizes, number of stages, and TMA multicast</p>
</li>
</ul>
</li>
<li><p><strong>Fine-Grained Scaling</strong>:</p>
<ul>
<li><p>Supports 1x128 LHS scaling and 128x128 RHS scaling</p>
</li>
<li><p>Implements efficient TMA-aligned tensor handling</p>
</li>
</ul>
</li>
</ol>
<p>The library addresses the imprecise FP8 tensor core accumulation issue by implementing CUDA-core two-level accumulation (promotion), ensuring numerical stability without sacrificing performance.</p>
<h2 id="heading-performance-and-benchmarks">Performance and Benchmarks</h2>
<p>DeepGEMM demonstrates impressive performance across a wide range of matrix shapes and configurations:</p>
<h3 id="heading-normal-gemms-for-dense-models">Normal GEMMs for dense models</h3>
<ul>
<li><p>Achieves up to 1358 TFLOPS for large matrices (4096x7168x16384)</p>
</li>
<li><p>Provides 1.1x-2.7x speedup compared to optimized CUTLASS implementation</p>
</li>
<li><p>Excellent performance for both memory-bound and compute-bound configurations</p>
</li>
</ul>
<h3 id="heading-grouped-gemms-for-moe-models">Grouped GEMMs for MoE models</h3>
<ul>
<li><p>Supports both contiguous and masked layouts</p>
</li>
<li><p>Achieves up to 1297 TFLOPS for grouped contiguous layout</p>
</li>
<li><p>Provides 1.1x-1.2x speedup compared to optimized implementations</p>
</li>
</ul>
<p>These performance characteristics make DeepGEMM particularly well-suited for large-scale models like DeepSeek-V3/R1, where efficient matrix operations are crucial for both training and inference.</p>
<h2 id="heading-integration-and-usage">Integration and Usage</h2>
<p>DeepGEMM is designed to be easily integrated into existing deep learning frameworks. It provides a PyTorch-compatible interface that can be used to replace standard matrix multiplication operations with optimized FP8 implementations. The typical usage pattern involves:</p>
<ol>
<li><p>Preparing input tensors in the appropriate format (FP8 with scaling factors)</p>
</li>
<li><p>Calling the appropriate GEMM function based on the operation type (normal, grouped contiguous, or grouped masked)</p>
</li>
<li><p>Processing the output tensor (BF16) as needed</p>
</li>
</ol>
<p>The library also provides utility functions for tensor format conversion and configuration management.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>DeepGEMM represents a significant advancement in optimizing matrix operations for modern AI models. By providing a clean, efficient implementation of FP8 GEMM operations, it addresses one of the key computational bottlenecks in large-scale models. Its support for both normal dense GEMMs and MoE grouped GEMMs makes it versatile for a wide range of model architectures, while its optimization for modern hardware ensures it can deliver maximum performance on current and future systems.</p>
<p>What sets DeepGEMM apart is its balance of performance and accessibility. While achieving performance that matches or exceeds expert-tuned libraries, it maintains a clean, readable codebase that serves as both a practical tool and an educational resource for understanding GPU optimization techniques. As AI models continue to scale and efficiency becomes increasingly critical, tools like DeepGEMM will play an essential role in pushing the boundaries of what's possible.</p>
]]></content:encoded></item><item><title><![CDATA[Understanding Load Balancing and Expert Parallelism in AI Models]]></title><description><![CDATA[Expert Parallelism Load Balancer (EPLB)
In the world of AI and deep learning, managing the computational load efficiently is a critical task. Models, especially large-scale ones like those used in Natural Language Processing (NLP) or computer vision,...]]></description><link>https://connectai.blog/understanding-load-balancing-and-expert-parallelism-in-ai-models</link><guid isPermaLink="true">https://connectai.blog/understanding-load-balancing-and-expert-parallelism-in-ai-models</guid><category><![CDATA[AI]]></category><category><![CDATA[Machine Learning]]></category><category><![CDATA[llm]]></category><category><![CDATA[mlops]]></category><dc:creator><![CDATA[Harshit Sharma]]></dc:creator><pubDate>Wed, 05 Mar 2025 19:33:11 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/tikhtH3QRSQ/upload/d94d24c605cea9ae2d22cbe615b13cf0.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-expert-parallelism-load-balancer-eplb">Expert Parallelism Load Balancer (EPLB)</h1>
<p>In the world of AI and deep learning, managing the computational load efficiently is a critical task. Models, especially large-scale ones like those used in Natural Language Processing (NLP) or computer vision, require handling massive amounts of data and computation across multiple computing resources such as GPUs or server nodes. This task often involves <strong>parallelism</strong>, which is the strategy of dividing the workload into smaller chunks and processing them simultaneously. Recently DeepSeek open sourced their EPLB algorithm : https://github.com/deepseek-ai/EPLB</p>
<p>A central concept in parallelism, especially for models with large parameters (such as mixture-of-experts or MoE models), is <strong>expert parallelism</strong>, where we distribute expert models (or parts of a model) across different resources. This helps to balance the computational load across multiple GPUs, nodes, or physical experts while optimizing performance and minimizing bottlenecks.</p>
<p>Let's explore the code snippet that handles <strong>expert parallelism</strong> load balancing through <strong>replication and rebalancing</strong> in a hierarchical structure.</p>
<h4 id="heading-1-packing-objects-with-balanced-weights">1. <strong>Packing Objects with Balanced Weights</strong></h4>
<p>The first step in this parallelism process involves packing objects (data or model components) into groups (or "packs"). This ensures that each group has an approximately equal weight distribution, minimizing the chance of overloading any one pack.</p>
<h5 id="heading-function-balancedpacking">Function: <code>balanced_packing</code></h5>
<p>This function's goal is to divide <code>n</code> weighted objects into <code>m</code> groups or "packs" such that the distribution of weight in each pack is as balanced as possible. Here's a breakdown of its core logic:</p>
<ul>
<li><p><strong>Input</strong>: A tensor <code>weight</code> of size <code>[X, n]</code>, where <code>X</code> is the number of layers, and <code>n</code> is the number of objects to pack. Additionally, <code>num_packs</code> specifies how many packs or groups to create.</p>
</li>
<li><p><strong>Output</strong>:</p>
<ul>
<li><p><code>pack_index</code>: Tensor showing which pack each object belongs to.</p>
</li>
<li><p><code>rank_in_pack</code>: Tensor showing the rank (or position) of the item within its respective pack.</p>
</li>
</ul>
</li>
</ul>
<p>The function first checks if the number of groups divides evenly into the number of packs. If this is true, it proceeds to <strong>sort the objects by weight</strong> and assigns them to packs, ensuring that each pack's weight is as balanced as possible.</p>
<h4 id="heading-2-replicating-experts-to-minimize-load">2. <strong>Replicating Experts to Minimize Load</strong></h4>
<p>Once the objects are packed, the next step is to <strong>replicate</strong> these "logical experts" (think of these as model components or neurons) into <strong>physical experts</strong>. The goal here is to distribute the computational load evenly across physical devices like GPUs.</p>
<h5 id="heading-function-replicateexperts">Function: <code>replicate_experts</code></h5>
<p>This function replicates logical experts (model components) into physical experts, minimizing the load imbalance across the physical replicas:</p>
<ul>
<li><p><strong>Input</strong>:</p>
<ul>
<li><p><code>weight</code>: A tensor representing the weight of each logical expert.</p>
</li>
<li><p><code>num_phy</code>: The total number of physical experts (often corresponds to available GPUs).</p>
</li>
</ul>
</li>
<li><p><strong>Output</strong>:</p>
<ul>
<li><p><code>phy2log</code>: Mapping from physical expert IDs to logical expert IDs.</p>
</li>
<li><p><code>rank</code>: The rank (or order) of each replica within its physical expert.</p>
</li>
<li><p><code>logcnt</code>: Number of replicas each logical expert has across physical experts.</p>
</li>
</ul>
</li>
</ul>
<p>The idea here is that when we replicate a logical expert across multiple physical devices, we aim to minimize the <strong>maximum load</strong> (or number of tasks) that each physical expert carries. By distributing the work evenly, we ensure better resource utilization and prevent some devices from being overloaded while others are underutilized.</p>
<h4 id="heading-3-hierarchical-rebalancing-for-optimal-distribution">3. <strong>Hierarchical Rebalancing for Optimal Distribution</strong></h4>
<p>In more complex scenarios where multiple <strong>nodes</strong> or <strong>GPUs</strong> are involved, we need to rethink the way experts are distributed across devices. A hierarchical structure allows for the efficient distribution of logical experts across various levels, starting from <strong>nodes</strong> down to <strong>GPUs</strong>, ensuring optimal use of available resources.</p>
<h5 id="heading-function-rebalanceexpertshierarchical">Function: <code>rebalance_experts_hierarchical</code></h5>
<p>This function deals with <strong>rebalancing experts in a hierarchical fashion</strong>. It distributes logical experts across multiple <strong>server nodes</strong>, and within each node, it ensures that they are evenly distributed across <strong>GPUs</strong>:</p>
<ul>
<li><p><strong>Input</strong>:</p>
<ul>
<li><p><code>weight</code>: The load statistics for all logical experts.</p>
</li>
<li><p>Other parameters define the hardware layout: <code>num_physical_experts</code>, <code>num_groups</code>, <code>num_nodes</code>, <code>num_gpus</code>.</p>
</li>
</ul>
</li>
<li><p><strong>Output</strong>:</p>
<ul>
<li><p><code>physical_to_logical_map</code>: A mapping from physical experts to logical experts.</p>
</li>
<li><p><code>logical_to_physical_map</code>: A mapping from logical experts to physical experts.</p>
</li>
<li><p><code>logical_count</code>: The count of replicas per logical expert.</p>
</li>
</ul>
</li>
</ul>
<h4 id="heading-4-main-function-rebalance-experts">4. <strong>Main Function: Rebalance Experts</strong></h4>
<p>The main function, <code>rebalance_experts</code>, serves as the entry point for balancing the load across multiple replicas, groups, nodes, and GPUs:</p>
<ul>
<li><p><strong>Input</strong>: Similar to the hierarchical function, this function takes a tensor of weights for logical experts and distributes them across multiple replicas, nodes, and GPUs.</p>
</li>
<li><p><strong>Output</strong>:</p>
<ul>
<li><p><code>physical_to_logical_map</code>: Mapping physical experts to logical ones.</p>
</li>
<li><p><code>logical_to_physical_map</code>: Detailed mapping for each logical expert to all its corresponding physical replicas.</p>
</li>
<li><p><code>logcnt</code>: Tracks the number of replicas for each logical expert.</p>
</li>
</ul>
</li>
</ul>
<h4 id="heading-why-is-this-approach-useful">Why Is This Approach Useful?</h4>
<p>This hierarchical load-balancing strategy is essential when dealing with large-scale models, particularly in <strong>mixture-of-experts (MoE)</strong> models, where only a subset of experts are active at any given time.</p>
<ol>
<li><p><strong>Efficient Resource Usage</strong>: By evenly distributing the computational load, this method ensures no single GPU or node becomes a bottleneck.</p>
</li>
<li><p><strong>Scalability</strong>: As the number of nodes, GPUs, or experts grows, the system can scale without introducing inefficiencies or resource underutilization.</p>
</li>
<li><p><strong>Minimal Load Imbalance</strong>: Using AI-based strategies like packing, ranking, and replicating ensures that the maximum load per physical expert is minimized, improving overall training and inference performance.</p>
</li>
</ol>
<h4 id="heading-conclusion">Conclusion</h4>
<p>Efficient expert parallelism is a cornerstone of scaling AI models across large clusters of GPUs and nodes. This load-balancing strategy, incorporating techniques like <strong>balanced packing</strong> and <strong>hierarchical expert distribution</strong>, ensures that computational resources are used optimally, preventing resource contention and ensuring fast and efficient model training. The implementation described is just one approach to managing expert parallelism, but it highlights the importance of balancing the workload in distributed AI systems, especially as model sizes continue to grow.</p>
<p>By applying these methods, AI engineers can take full advantage of multi-GPU and multi-node environments, ensuring that large models can be trained efficiently and at scale.</p>
]]></content:encoded></item><item><title><![CDATA[Course Review : Fundamentals of Reinforcement Learning [Coursera]]]></title><description><![CDATA[Reinforcement Learning is one of the machine learning technique which is getting lot of attention recently. I really get excited when I get to learn something new and exciting and especially if something is related to machine learning.
I have been tr...]]></description><link>https://connectai.blog/course-review-fundamentals-of-reinforcement-learning-coursera</link><guid isPermaLink="true">https://connectai.blog/course-review-fundamentals-of-reinforcement-learning-coursera</guid><category><![CDATA[Reinforcement Learning in Machine Learning]]></category><category><![CDATA[AI]]></category><category><![CDATA[Machine Learning]]></category><dc:creator><![CDATA[Harshit Sharma]]></dc:creator><pubDate>Wed, 05 Mar 2025 19:02:38 GMT</pubDate><content:encoded><![CDATA[<p>Reinforcement Learning is one of the machine learning technique which is getting lot of attention recently. I really get excited when I get to learn something new and exciting and especially if something is related to machine learning.</p>
<p>I have been trying to start learning the fundamentals of reinforcement learning for quite some time and like every other such plan this was just logged in my Bookmark list waiting for an action. Recently <a target="_blank" href="https://medium.com/u/a53939629311?source=post_page---user_mention--594aac05d1d4---------------------------------------">University of Alberta</a> started Reinforcement Learning specialization course on <a target="_blank" href="https://medium.com/u/99c0fb464c1f?source=post_page---user_mention--594aac05d1d4---------------------------------------">Coursera</a>which allows one to deep dive and understand the fundamentals of reinforcement learning. Instructors Martha White and Adam White did a great job in explaining the fundamentals of reinforcement learning. For someone who is interested in this area of machine learning and waiting to get a kick start, must give this course a try.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:328/1*nz9e5yIVGewrQVRzgNJkQw.png" alt /></p>
<p>So what is reinforcement learning? As we start thinking more and more about it , it more or less feels like our conscience which helps to take actions in our day to day life. Don’t get confused with the word conscience. What I mean is for every action that we take there might be some reward involved in it. For example when we play games on our consoles there is one clear end goal which is to complete mission and our action and movements determines how soon we finish a mission, at the same point of time there is some reward involved for every action or series of action which reinforces the importance of those actions at particular stage.</p>
<p>Likewise in reinforcement learning we have Environment , Action , Reward and State is involved which is very similar to Game(Environment), action or series of actions which we take while playing games (such as movements), points/gems (Rewards) and stages (State) .</p>
<p><img src="https://miro.medium.com/v2/resize:fit:700/1*2rmKGjZOv5pGkLLVt-EuMA.png" alt /></p>
<p>Reinforcement learning allows us to improve learning algorithm by trying different types of algorithms which carefully assess the final reward due to series of action which we take in an environment in different states. How can we do it better? How do we frame problems on the same lines such that we can improve them through reinforcement learning.</p>
<p>As you start this course you will understand it requires one to go through reading materials. They give you a confidence and personally this course is one of my favorite, unlike all other courses this course focuses on understanding concept on your own by going through a reading material first and then follow up video which reinforces those concepts. Not sure how many courses out there follow similar course structure but I personally liked this approach.</p>
<p><strong>Week1</strong> focuses on K-Armed Bandit problem and exploration/exploitation tradeoff. Hands down this is like an entry into the world of reinforcement learning. Its very important to set the intuition right and understand why do we need reinforcement learning in the first place .</p>
<p><img src="https://miro.medium.com/v2/resize:fit:700/1*I2Ox0vphfe6miMwlGUzg0Q.png" alt /></p>
<p><strong>Week2</strong> focuses on Markov Decision Process (MDP) and different type of tasks such as episodic and continuous task. If you are familiar with reinforcement learning or you further proceed in this course , you will realise MDP is one of the foundation and will never your side.</p>
<p><strong>Week3</strong> introduces Policies and Value functions , Bellman equation and optimalilty. After defining task its also important to calculate value at each state and to calculate if the value is optimal or not. If not we might need to change or try different policy.</p>
<p><strong>Week4</strong> focuses on Dynamic Programming and using same technique for policy evaluation and policy iteration. Followed by assignment to find optimal policy using dynamic programming. I really enjoyed this assignment, Coursera provides model for parking demand with a reward function that reflects its preferences and the task is to determine optimal policy.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:700/1*vOWHbhJ2hKSV-lpnibyPlA.png" alt /></p>
<p>After you are done with course you just cannot wait to start next part in the series . Super excited to give it a try and explore more in reinforcement learning.</p>
]]></content:encoded></item><item><title><![CDATA[56: Safety Operating System]]></title><description><![CDATA[Re-imagining Security and Safety

Introduction
At 56, we believe that everyone should have access to world-class physical security. 56 has built the first safety operating system for homes and businesses which leverages an interconnected network of g...]]></description><link>https://connectai.blog/56-safety-operating-system</link><guid isPermaLink="true">https://connectai.blog/56-safety-operating-system</guid><dc:creator><![CDATA[Harshit Sharma]]></dc:creator><pubDate>Wed, 05 Mar 2025 19:00:55 GMT</pubDate><content:encoded><![CDATA[<p>Re-imagining Security and Safety</p>
<p><img src="https://miro.medium.com/v2/resize:fit:700/1*z-LNzD8nJIrQ2adirspRIg.png" alt /></p>
<h1 id="heading-introduction"><strong>Introduction</strong></h1>
<p>At <a target="_blank" href="https://56secure.com/">56</a>, we believe that everyone should have access to world-class physical security. <a target="_blank" href="https://56secure.com/">56</a> has built the first safety operating system for homes and businesses which leverages an interconnected network of guards and AI smart cameras to deliver an efficient safety experience to our customers. We’re doing this primarily by developing location services, machine learning and hardware running deep learning models. In the last year, we have resolved more than 2,000 SOS calls, installed 1,500 AI cameras and secured thousands of Bengalureans with the help of our platform and network of guards. Our Guardian360 platform takes signals from the connected network of the guards and smart AI cameras to deliver end to end safety experience to our users.</p>
<p>Our eyes and ears aren’t designed to scan an area, looking for suspicious activity. Our perception abilities are too easily manipulated, resulting in a false sense of security. Maintaining private spaces is a demanding task. Keeping an eye on the residents, visitors, customers and employees requires adequate surveillance and security. Manual monitoring of the livestream from the CCTV camera in real time is error prone and adds to cognitive fatigue. In a traditional physical security setup there is no monitoring layer over physical security guards and thus leading to zero visibility on security infrastructure which makes the traditional security eco-system reactive in nature.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:700/1*FeRV61pjD5nCPq1f7gIHhg.gif" alt /></p>
<p>We want to transform the way security and process monitoring is achieved, via deep integration between computer vision, advanced location services and real-time physical intervention. It doesn’t matter where you are: on the street, at home or at work: our connected Guardian360 platform provides our users with peace of mind round the clock. Our users also can rest assured that our safety agents are always just a few minutes away.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:700/1*V2unPw17VbskW57mP8MuLA.png" alt /></p>
<blockquote>
<p>Safety agents on the ground, AI on the edge camera and Secure App are three main pillars that enable us to give peace of mind to our users.</p>
</blockquote>
<p>56combines safety agents , machine learning and video intelligence powered by AI cameras to give users complete protection in real time. Wireless smart AI cameras run deep learning models and support advance recognition of events such as Known / Unknown visitor , Pet and Vehicle detection. Users can setup camera assisted alerts to the guards and request for “SOS” immediate assistance using our application. Network of trained and PSARA certified safety agents are assisted by clustering and dynamic patrol route allocation which ensures availability of the safety agents in a locality. Geofencing and real time video intelligence helps us to track processes and workflows . 56 seamlessly combine it all to give users a peace of mind .</p>
<h1 id="heading-infrastructure-that-ingests-millions-of-signals-to-keep-users-safe"><strong>Infrastructure that ingests millions of signals to keep users safe</strong></h1>
<p>Our <a target="_blank" href="https://56secure.com/">Guardian360</a> platform uses signal from the connected network of the smart AI cameras and safety agents to deliver end to end safety experience to our users. We process more than a million events in a day. From the engineering side, we’re striving to make 56 reliability a reality 99.99% of the time for our users. With millions of events coming into our platform, it’s important to keep on top of what’s going on across the board.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:600/1*SKoKuA-9vlzK0XnbRFh_cQ.gif" alt /></p>
<h1 id="heading-context-engine-service-vision"><strong>Context Engine Service : Vision</strong></h1>
<p>AI on the edge enabled cameras can proactively detect incidents in real time. Smart AI camera powered by deep learning detect events including person , pet and vehicle with high accuracy. Real time event analysis, anomaly detection using machine learning and 24X7 camera uptime monitoring adds an extra layer of visibility which is very critical when it comes to security. Unlike traditional CCTV our platform can help to deter crimes before they escalate. Vision service assisted with AI camera also enables security related workflows for homes , businesses and apartments.</p>
<h1 id="heading-intelligent-location-service-cerebro"><strong>Intelligent Location Service : Cerebro</strong></h1>
<p>Our vision is to not only to keep our users safe in their premises but also act as their first responders whenever they are in need even if they are outside their house. It becomes super critical to monitor and track safety agents in real time . Platform assisted with clustering algorithms leverages location signals to enable risk based dynamic deployment in an area and alerts our in-house war-room team in case of any anomaly.</p>
<p>In case of any emergency , we use our interconnected network of safety agents and broadcast any critical information that can be useful to avert any threat in real time. At the same time we can track and monitor workflows and policies assigned to the guards in apartments and business and report them to the users.</p>
<h1 id="heading-secure-app"><strong>Secure App</strong></h1>
<p>Secure App enables users to check and get updates on live security status of their home and their locality. It also helps user to raise “SOS” to the network of safety agents in case of security emergency . Users can also request for specific action, view feeds , play archive and approve / reject visitors. Users can check security status at home &amp; outside , flag security threats and report incidents using app.</p>
<blockquote>
<p><strong><em>If a culture of problem solving resonates with you, and if you like having an impact on millions of people, you might be a great fit for</em></strong> <a target="_blank" href="https://56secure.com/"><strong><em>56</em></strong></a><strong><em>. We’re currently hiring for a variety of technical roles, so do check out our</em></strong> <a target="_blank" href="https://www.linkedin.com/company/56secure"><strong><em>Linkedin</em></strong></a> <strong><em>page for more information.</em></strong></p>
</blockquote>
<h1 id="heading-impact"><strong>Impact</strong></h1>
<p>Over the past year we managed to create an impact by averting numerous incidents in localities . Check out what our subscribers have to say .</p>
]]></content:encoded></item><item><title><![CDATA[56: How we utilise millions of location signals to provide proactive security]]></title><description><![CDATA[Re-imagining Security and Safety

Introduction
At 56, we leverage an interconnected real-time network of guards and AI smart cameras to deliver an efficient safety experience to our users. We’re doing this primarily by developing location services, a...]]></description><link>https://connectai.blog/56-how-we-utilise-millions-of-location-signals-to-provide-proactive-security</link><guid isPermaLink="true">https://connectai.blog/56-how-we-utilise-millions-of-location-signals-to-provide-proactive-security</guid><category><![CDATA[AI]]></category><category><![CDATA[Machine Learning]]></category><dc:creator><![CDATA[Harshit Sharma]]></dc:creator><pubDate>Wed, 05 Mar 2025 18:59:34 GMT</pubDate><content:encoded><![CDATA[<p>Re-imagining Security and Safety</p>
<p><img src="https://miro.medium.com/v2/resize:fit:700/1*tP-_k7XFMtXHPsFF1O61mA.png" alt /></p>
<h2 id="heading-introduction"><strong>Introduction</strong></h2>
<p>At <a target="_blank" href="http://www.56secure.com/">56</a>, we leverage an interconnected real-time network of guards and AI smart cameras to deliver an efficient safety experience to our users. We’re doing this primarily by developing location services, algorithms and AI cameras running deep learning models on edge. 56 combines pro-active safety agents on the ground running street specific algorithmic routes and video intelligence powered by AI cameras to give its users complete protection. As a result, 56 is a pro-active and adaptable safety network operating 24X7.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:700/1*FeRV61pjD5nCPq1f7gIHhg.gif" alt /></p>
<h2 id="heading-sos"><strong>SOS</strong></h2>
<p>If you have pressed <strong>SOS</strong> on the <a target="_blank" href="https://secure56.page.link/download">56Secure</a> app, you might know how simple the process is. Just press our <strong>SOS</strong> button, and based on your location, our nearest safety agent will reach you within minutes for any safety or security assistance. The process is simple, but a lot is happening behind the scenes.</p>
<p>The secret behind <strong>SOS</strong> is our platform which leverages our safety agent’s location data for insightful and intelligent decision-making. While safety agents are on the move, millions of events move into our system, which ultimately helps our safety agents to locate and reach our users within minutes.</p>
<p>When a user presses the SOS button on our <a target="_blank" href="https://secure56.page.link/download">56Secure</a> application, we immediately connect the nearest safety agent with the customer. Our war-room team closely monitors the situation. The assigned safety agent who are trained to de-escalate, immediately goes to the location and locates the customer needing safety assistance. At the same time, other safety agents are aware and can be called upon as a backup. Any anomaly or spot reported using our application helps us to deploy the guards based on historical incidents and send optimised patrol routes and workflows to the safety agents.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:700/1*gi1tDYfgeLRnwouQG5CUYg.jpeg" alt="56 War-room" /></p>
<p>56 War room : 24X7</p>
<h1 id="heading-intelligent-location-service-cerebro"><strong>Intelligent Location Service: Cerebro</strong></h1>
<blockquote>
<p><em>We process over seven million location signals daily to keep our users safe.</em></p>
</blockquote>
<p><strong>Cerebro</strong> ingests every single GPS point of over hundreds of safety agents on the ground and stores historical information, which ultimately helps our data science team to deploy and position guards in an area. The Data-Science team at <strong>56</strong> also performs in-depth geospatial data analysis of road distance and traffic to enhance the customer service experience and assist safety agents on the ground in doing their duty effectively. Every day our platform manages millions of location events.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:700/1*ZvMvMIoCzXcmitEJ-6fFgQ.png" alt /></p>
<p>Our pro-priority algorithms use location data and street distance to divide the entire city into a grid of cells and associate information to each cell depending on the density of our users in a locality. This allows a flexible trade-off between precision and efficiency, depending on the tasks, which can be SOS or the scheduling of jobs and services in an area. Metadata associated with each cluster updates at regular intervals, which ultimately helps to assist users and deliver a great customer experience.</p>
<h2 id="heading-impact"><strong>Impact</strong></h2>
<p>Over the past year, we created an impact by averting numerous incidents in Bangalore in real-time. Check out what our subscribers have to say.</p>
]]></content:encoded></item><item><title><![CDATA[A Connected Approach: The Changing Landscape of Security Solutions]]></title><description><![CDATA[Interconnected Deep Tech Architecture
In the realm of security, one might instinctively think that a camera or a security guard offers proactive protection for users. Yet, in reality, neither option delivers a comprehensive security system on its own...]]></description><link>https://connectai.blog/a-connected-approach-the-changing-landscape-of-security-solutions</link><guid isPermaLink="true">https://connectai.blog/a-connected-approach-the-changing-landscape-of-security-solutions</guid><category><![CDATA[Deep Learning]]></category><category><![CDATA[AI]]></category><category><![CDATA[technology]]></category><category><![CDATA[product]]></category><category><![CDATA[Startups]]></category><dc:creator><![CDATA[Harshit Sharma]]></dc:creator><pubDate>Wed, 05 Mar 2025 18:58:04 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://miro.medium.com/v2/resize:fit:700/1*5FRtgp96f3bIldTfmcXfmQ.png" alt /></p>
<p>Interconnected Deep Tech Architecture</p>
<p>In the realm of security, one might instinctively think that a camera or a security guard offers proactive protection for users. Yet, in reality, neither option delivers a comprehensive security system on its own. At 56 Secure, as we endeavor to create a cohesive security ecosystem, it’s vital to understand the limitations of traditional security setups and why they often react rather than preempt threats. Let’s delve into why standalone solutions like cameras or security guards fall short of providing proactive security for users.</p>
<h1 id="heading-limitations-of-cameras"><strong>Limitations of Cameras</strong></h1>
<p>Cameras are often seen as an easy and affordable way to provide security to a property. However, cameras have several limitations that make them ineffective as a standalone security measure. First, cameras are passive devices that simply record what’s happening. They don’t have the ability to intervene or prevent an incident from occurring. Second, cameras can be easily disabled or bypassed. For example, an intruder can wear a mask or hat to avoid detection or simply destroy the camera. Third, cameras can only capture what’s in their field of view, which means that blind spots can exist in the coverage area.</p>
<h1 id="heading-limitations-of-security-guards"><strong>Limitations of Security Guards</strong></h1>
<p>Security guards are often seen as a more active security solution compared to cameras. However, security guards also have limitations that make them ineffective as a standalone security measure. First, security guards can only cover a limited area at a time, which means that large properties may require multiple guards. Second, security guards are human and can be overpowered or distracted. Third, security guards are expensive and may not be affordable for smaller businesses or individuals.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:700/1*3VOk9_BM2zAfbVwRHocBjw.png" alt /></p>
<h1 id="heading-the-importance-of-integrated-security-systems"><strong>The Importance of Integrated Security Systems</strong></h1>
<p>To provide proactive security, a comprehensive security system is needed. This includes not only cameras and security guards but also intelligent systems, alarms, access control systems, and other security measures. By integrating these systems, it’s possible to create a layered approach to security that provides multiple levels of protection. For example, if a camera detects an intruder, an alarm can be triggered to alert security guards or the user, who can then respond and prevent the intrusion.</p>
<h1 id="heading-ai-cameras"><strong>AI Cameras</strong></h1>
<p>AI-powered CCTV cameras represent a significant leap in security technology. Unlike traditional CCTV systems that passively record footage for later review, AI-enabled cameras can actively analyze and interpret the visual data in real-time. This means they can identify unusual patterns, recognize faces, and even differentiate between types of objects or activities. The immediate advantage of this is the ability to send real-time alerts in the event of suspicious or anomalous activity, allowing for faster response times. Furthermore, with machine learning, these systems can continuously improve their detection algorithms based on new data, thereby reducing false alarms and enhancing accuracy. The integration of AI into CCTV systems, therefore, offers a more proactive and efficient approach to security and surveillance.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:700/1*QhaZiOMP-1rBckHkCawwIg.png" alt /></p>
<p>56 AI One</p>
<h1 id="heading-56-ai-one"><strong>56 AI One</strong></h1>
<p>As we gear towards launching our flagship camera in the market, we are proud to unveil a groundbreaking integration of artificial intelligence into our CCTV systems. This camera is not just a tool for surveillance but a smart assistant capable of distinguishing between normal and suspicious activities, offering real-time alerts, and making data-driven decisions to enhance security. With advanced image recognition and machine learning algorithms at its core, our AI-powered camera promises to redefine the standards of safety and surveillance. Businesses, institutions, and homeowners can now expect unparalleled security insights, making their environments safer and more responsive than ever before.</p>
<h1 id="heading-conclusion"><strong>Conclusion</strong></h1>
<p>In conclusion, a camera or security guard in isolation cannot provide proactive security to users. Cameras are passive devices that can be easily disabled or bypassed, while security guards can only cover a limited area at a time and are human and fallible. To provide effective security, a comprehensive security system that integrates multiple security measures is necessary. By doing so, users can ensure that they have the best possible protection against intrusions and other security threats.</p>
]]></content:encoded></item><item><title><![CDATA[Measuring Efficiency of SOC Neural Network Chips: A Comprehensive Approach]]></title><description><![CDATA[As artificial intelligence continues to revolutionize various industries, the demand for efficient System-on-Chip (SOC) neural network processors has skyrocketed. When designing the 56 AI One camera, selecting the System on Chip (SoC) based on both p...]]></description><link>https://connectai.blog/measuring-efficiency-of-soc-neural-network-chips-a-comprehensive-approach</link><guid isPermaLink="true">https://connectai.blog/measuring-efficiency-of-soc-neural-network-chips-a-comprehensive-approach</guid><category><![CDATA[AI]]></category><category><![CDATA[hardware]]></category><category><![CDATA[Startups]]></category><dc:creator><![CDATA[Harshit Sharma]]></dc:creator><pubDate>Wed, 05 Mar 2025 18:56:13 GMT</pubDate><content:encoded><![CDATA[<p>As artificial intelligence continues to revolutionize various industries, the demand for efficient System-on-Chip (SOC) neural network processors has skyrocketed. When designing the <a target="_blank" href="https://www.56secure.com/ai-cam-one">56 AI One camera</a>, selecting the System on Chip (SoC) based on both performance and cost was crucial. Over the last 4 years I got the opportunity to work and evaluate difference SoCs , ranging from Nvidia Jetson to Ambarella CV25. These SoC are designed to accelerate AI workloads, but how do we measure their efficiency? This blog post explores the key metrics and methodologies used to evaluate the performance of SOC neural network chips.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:700/1*iL7ZvNyqGcVJOJbQixFWbA.jpeg" alt /></p>
<p>Nvidia Jetson Nano , Jetson Xavier modules</p>
<h1 id="heading-benchmarking-methodologies"><strong>Benchmarking Methodologies</strong></h1>
<p>Standard industry benchmarks like <a target="_blank" href="https://www.nvidia.com/en-in/data-center/resources/mlperf-benchmarks/">MLPerf</a> provide a common ground for comparing different chips across a range of AI tasks, including image classification, object detection, and natural language processing. The MLPerf benchmarks measure consistent performance metrics such as training time to target quality, inference latency, and throughput. This ensures that the performance comparisons are based on well-defined and universally accepted criteria. These benchmarks typically measure both inference and training performance, offering insights into how chips perform in various scenarios. However, standard benchmarks alone may not tell the whole story.</p>
<h1 id="heading-lessons-learned-why-tops-number-isnt-enough"><strong>Lessons Learned: Why TOPs Number Isn’t Enough</strong></h1>
<p><strong>TOPS (Tera Operations Per Second)</strong> has long been a go-to metric for comparing AI chip performance, but it’s increasingly clear that this measure alone falls short in capturing real-world AI chip efficiency. While TOPS provides a quick snapshot of raw computational power, it fails to account for critical factors like memory bandwidth, data movement costs, and the varying computational demands of different AI models. For instance, a chip boasting high TOPS might underperform in practice due to memory bottlenecks or inefficient handling of sparse operations common in many neural networks. Through my experience working with and evaluating various SoCs, from <a target="_blank" href="https://www.nvidia.com/en-in/autonomous-machines/embedded-systems/jetson-nano/product-development/">Nvidia Jetson Nano</a> to <a target="_blank" href="https://www.ambarella.com/wp-content/uploads/Ambarella_CV25S_Product_Brief_14SEP2021.pdf">Ambarella CV25</a>, I’ve gathered significant insights in this domain.</p>
<p>Custom benchmarks tailored to specific use cases are equally important, as they can reveal how a chip performs under real-world conditions relevant to its intended application. For instance, an edge AI chip for autonomous vehicles might be benchmarked using specific computer vision tasks under varying lighting and weather conditions. It’s crucial to employ a diverse set of workloads in testing, encompassing different neural network architectures (CNNs, RNNs, Transformers), model sizes, and precision levels (FP32, FP16, INT8). This diversity ensures a comprehensive evaluation of the chip’s versatility and efficiency across various AI applications. Additionally, benchmarking should consider not just raw performance, but also power consumption, thermal characteristics, and consistency of performance over extended periods. By combining standardized benchmarks with application-specific tests and a wide range of workloads, we can gain a holistic understanding of a SOC Neural Network Chip’s efficiency and suitability for different AI tasks.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:700/1*igtGJ3sCUKQk1OC74H5jGA.png" alt /></p>
<p><strong>Average inference time by device</strong></p>
<h1 id="heading-tops-tera-operations-per-second"><strong>TOPS : Tera Operations Per Second</strong></h1>
<p>The most common metric used in the industry is TOPS (Tera Operations Per Second), which measures the raw computational power of a chip. TOPS indicates how many trillion operations the chip can perform in one second, providing a straightforward comparison of processing capabilities.</p>
<p>However, TOPS alone doesn’t paint the full picture of a chip’s efficiency. That’s where TOPS/W (TOPS per Watt) comes in. This metric combines processing power with energy consumption, offering insight into the chip’s efficiency. A higher TOPS/W indicates better performance per unit of power, which is crucial for mobile and edge devices with limited energy resources. It is important to calculate the TOPS of the SoC and obtain precise measurements once the AI pipelines are deployed.</p>
<p><strong>Calculating TOPS for a Deep Learning Computer Vision Model:</strong></p>
<ol>
<li><p><strong>Understand the model architecture:</strong> First, you need to know the structure of your model, including the number and types of layers, the size of input tensors, and the number of parameters in each layer.</p>
</li>
<li><p><strong>Count the operations:</strong> For each layer in your model, count the number of floating-point operations (FLOPs) required for a single forward pass.</p>
</li>
</ol>
<p>The main operations to consider are:</p>
<ul>
<li><p>Convolutions</p>
</li>
<li><p>Matrix multiplications</p>
</li>
<li><p>Activations</p>
</li>
<li><p>Pooling operations</p>
</li>
</ul>
<p>Calculate FLOPs for convolutional layers: For a convolutional layer: FLOPs = 2 <em>H</em> W <em>Cin</em> Cout <em>K</em> K Where:</p>
<ul>
<li><p>H and W are the height and width of the output feature map</p>
</li>
<li><p>Cin is the number of input channels</p>
</li>
<li><p>Cout is the number of output channels</p>
</li>
<li><p>K is the kernel size</p>
</li>
</ul>
<p>For a fully connected layer: FLOPs = 2 <em>Nin</em> Nout Where:</p>
<ul>
<li><p>Nin is the number of input neurons</p>
</li>
<li><p>Nout is the number of output neurons</p>
</li>
</ul>
<ol>
<li><p><strong>Sum up the total FLOPs:</strong> Add up the FLOPs from all layers to get the total number of operations for one forward pass of the model.</p>
</li>
<li><p><strong>Consider the inference speed:</strong> Determine how many inferences your hardware can perform per second. This is often provided by the hardware manufacturer or can be measured through benchmarking.</p>
</li>
<li><p><strong>Calculate TOPS:</strong> TOPS = (Total FLOPs * Inferences per second) / 10¹² This gives you the Tera Operations Per Second.</p>
</li>
</ol>
<p>Example: Let’s say you have a simple CNN with:</p>
<ul>
<li><p>1 convolutional layer: 3x3 kernel, 3 input channels, 64 output channels, 224x224 input size</p>
</li>
<li><p>1 fully connected layer: 50,176 inputs, 1000 outputs</p>
</li>
<li><p>The hardware can perform 100 inferences per second</p>
</li>
</ul>
<p><strong>Calculations:</strong></p>
<ol>
<li><p>Conv layer FLOPs = 2 <em>224</em> 224 <em>3</em> 64 <em>3</em> 3 = 173,408,256</p>
</li>
<li><p>FC layer FLOPs = 2 <em>50,176</em> 1000 = 100,352,000</p>
</li>
<li><p>Total FLOPs = 173,408,256 + 100,352,000 = 273,760,256</p>
</li>
<li><p>TOPS = (273,760,256 * 100) / 10¹² = 0.0274 TOPS</p>
</li>
</ol>
<p>This method provides a rough estimate of TOPS. In practice, the calculation can be more complex due to factors like optimizations, quantization, and the specific hardware architecture being used.</p>
<blockquote>
<p><em>Note: The TOPS calculation assumes 100 inferences per second. If this assumption is incorrect or needs to be adjusted, the final TOPS value would change accordingly.</em></p>
</blockquote>
<h1 id="heading-frames-per-second-fps"><strong>Frames per Second (FPS)</strong></h1>
<p><img src="https://miro.medium.com/v2/resize:fit:700/1*DiPXOBg9ewlH0Qee9YeI3Q.png" alt /></p>
<p>While TOPS and TOPS/W are important, they don’t always translate directly to real-world performance. This is where application-specific metrics come into play. For vision-related tasks, Frames per Second (FPS) measures how many image frames a chip can process in real-time, which is particularly relevant for applications like video analytics or autonomous driving. Latency, on the other hand, measures the time taken to complete a single inference, which is critical for real-time applications that require quick responses.</p>
<h1 id="heading-memory-bandwidth"><strong>Memory Bandwidth</strong></h1>
<p><img src="https://miro.medium.com/v2/resize:fit:700/1*FPUH5Yl1_wygxG9GY7HpQg.jpeg" alt /></p>
<p>56 AI One Camera powered by Ambarella CV25</p>
<p>Another crucial aspect of neural network chip efficiency is memory performance. Memory bandwidth can often become a bottleneck in neural network processing, limiting the chip’s ability to fully utilize its computational resources. High memory bandwidth generally allows for better utilization of the chip’s processing power. Additionally, for applications where space is at a premium, area efficiency (measured in TOPS/mm²) becomes an important consideration, relating performance to chip size.</p>
<p>It’s also important to consider the chip’s flexibility and support for different neural network architectures. While not directly related to chip performance, the accuracy achieved on standard benchmarks helps evaluate how well the chip supports various neural network models. Some chips may excel at certain types of networks but perform poorly on others, so it’s crucial to evaluate performance across a range of relevant models and tasks.</p>
<h1 id="heading-conclusion"><strong>Conclusion</strong></h1>
<p>Lastly, for commercial applications, the cost-effectiveness of a chip is a critical factor. Performance per dollar helps compare different solutions in terms of their economic viability. When evaluating SOC neural network chips, it’s essential to consider multiple metrics and how they relate to your specific use case. A chip with high TOPS might not be the best choice if power consumption is a primary concern, while a highly energy-efficient chip might fall short in applications requiring high-speed processing. By taking a comprehensive approach and considering various metrics, developers and businesses can make informed decisions when selecting the most suitable SOC neural network chip for their needs.</p>
]]></content:encoded></item><item><title><![CDATA[Unlocking AI Potential: A Deep Dive into NPU, GPU, TPU and FPGA]]></title><description><![CDATA[We have witnessed significant advancements in AI-specific hardware, ranging from the widespread adoption of GPUs to the emergence of specialized NPUs and TPUs. Each development has brought us closer to realizing the full potential of AI at the edge. ...]]></description><link>https://connectai.blog/unlocking-ai-potential-a-deep-dive-into-npu-gpu-tpu-and-fpga</link><guid isPermaLink="true">https://connectai.blog/unlocking-ai-potential-a-deep-dive-into-npu-gpu-tpu-and-fpga</guid><category><![CDATA[GPU]]></category><category><![CDATA[tpu]]></category><category><![CDATA[AI]]></category><category><![CDATA[hardware]]></category><category><![CDATA[Security]]></category><dc:creator><![CDATA[Harshit Sharma]]></dc:creator><pubDate>Wed, 05 Mar 2025 18:52:42 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/EiAqej-cGks/upload/7a1677d935e81fe58ce6529944fba00b.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>We have witnessed significant advancements in AI-specific hardware, ranging from the widespread adoption of GPUs to the emergence of specialized NPUs and TPUs. Each development has brought us closer to realizing the full potential of AI at the edge. However, I believe we are on the verge of something even more groundbreaking. Intel has introduced its ‘Lunar Lake’ processors with enhanced NPU capabilities. Meanwhile, outside the ‘PC’ realm, Apple recently announced an upgraded NPU in the M4 chip, which powers their latest products.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:600/1*GkE1d2gzRfZCZ5cP0MkAGg.png" alt /></p>
<p>The first Apple Neural Engine that debuted within Apple’s A11 chip in 2017’s iPhone X was powerful enough to support Face ID and Animoji.</p>
<p>As we push the boundaries of what’s possible with artificial intelligence at the network edge, I find myself wondering: what truly transformative breakthroughs lie just beyond the horizon? Perhaps the next leap forward will come from novel architectures that fundamentally reimagine how we process AI workloads. Let’s explore the details of Neural Processing Units (NPUs) and compare them with other AI-specific processors, such as Graphics Processing Units (GPUs) and Tensor Processing Units (TPUs).</p>
<h1 id="heading-the-next-wave-of-ai-optimized-compute"><strong>The Next Wave of AI-Optimized Compute</strong></h1>
<p>When choosing the SoC for <a target="_blank" href="https://www.56secure.com/ai-cam-one">56 AI One camera</a>, understanding memory utilization and compute efficiency was crucial for handling multiple AI workflows. Want to know how to measure efficiency in AI SoCs? Read my <a target="_blank" href="https://medium.com/@hrsht.sarma/measuring-efficiency-of-soc-neural-network-chips-a-comprehensive-approach-6973e1e46a0a">blog</a> for more details.</p>
<p>In-memory computing tackles the von Neumann bottleneck directly by performing computations within memory units. This approach significantly reduces data movement, resulting in substantial improvements in both speed and energy efficiency for AI workloads. Reconfigurable AI accelerators are emerging. These chips can dynamically adapt their architecture to optimally suit various AI tasks, providing unparalleled flexibility and efficiency across a wide range of applications..</p>
<p>As we strive for more powerful and efficient AI systems, the distinctions between different types of specialized processors are becoming less clear. The future may not lie in discrete GPUs, TPUs, or NPUs, but in highly integrated, multi-paradigm chips that seamlessly combine various computational approaches to address the most challenging AI problems.</p>
<h1 id="heading-npu-neural-processing-units"><strong>NPU : Neural Processing Units</strong></h1>
<p><img src="https://miro.medium.com/v2/resize:fit:700/1*OiNJn76qOQOYpP3-rHnnjQ.jpeg" alt /></p>
<p>NPUs are specialized chips designed specifically for AI tasks, particularly those involving neural networks. Their architecture is optimized to handle the parallelism and efficiency required for AI computations, often outperforming traditional CPUs and even GPUs in certain tasks.</p>
<p><strong>Key Characteristics of NPUs:</strong></p>
<ul>
<li><p><strong>Optimized Parallel Processing:</strong> Designed to handle multiple AI operations simultaneously.</p>
</li>
<li><p><strong>Energy Efficiency:</strong> Lower power consumption compared to GPUs, making them ideal for mobile and edge computing.</p>
</li>
<li><p><strong>Synaptic Weight Mechanism:</strong> This principle enhances learning efficiency by strengthening frequently used pathways, akin to synaptic activity in the human brain.</p>
</li>
</ul>
<p>Some of the NPUs worth checking out : <a target="_blank" href="https://en.wikipedia.org/wiki/Qualcomm_Hexagon">Qualcomm Hexagon</a>, <a target="_blank" href="https://apple.fandom.com/wiki/Neural_Engine">Apple Neural Engine.</a></p>
<h1 id="heading-tpu-tensor-processing-unit"><strong>TPU : Tensor Processing Unit</strong></h1>
<p><img src="https://miro.medium.com/v2/resize:fit:700/1*PWO3Zz6E5DHqSdeULQriBA.jpeg" alt /></p>
<p>TPU : High Level Architecture</p>
<p>In mathematics, a <strong>tensor</strong> is an algebraic object that describes a multilinear relationship between sets of algebraic objects related to a vector space. Tensors may map between different objects such as vectors, scalars, and even other tensors.</p>
<blockquote>
<p><em>A tensor may be represented as a (potentially multidimensional) array.</em></p>
</blockquote>
<p>So, depending on the nature of the tensor, it can be represented as an array of n dimensions where n is 0,1,2,3 and so on. Some of these representations have more familiar, names:</p>
<ul>
<li><p>Dimension 0 — scalar</p>
</li>
<li><p>Dimension 1 — vector</p>
</li>
<li><p>Dimension 2 — matrix</p>
</li>
</ul>
<p>Why is a Tensor Processing Unit so called? Because it is designed to speed up operations involving tensors. Precisely, what operations though? The operations that are referred to in our original Wikipedia definition which described a tensor as a “map (multilinear relationship) between different objects such as vectors, scalars, and even other tensors”.</p>
<h1 id="heading-gpu"><strong>GPU</strong></h1>
<p>Graphics Processing Units (GPUs) have become indispensable in the field of artificial intelligence. Originally designed to accelerate graphics rendering, their highly parallel structure makes them ideally suited for handling the extensive computations required in AI workloads. GPUs excel in performing numerous calculations simultaneously, which is crucial for training deep neural networks and processing large datasets. NVIDIA, a leader in GPU technology, has significantly enhanced the capabilities of GPUs for AI through its CUDA platform, which allows developers to exploit the parallel processing power of GPUs for a variety of machine learning tasks. This flexibility makes GPUs an attractive option for researchers and companies looking to perform both AI training and inference.</p>
<p>Their mature ecosystem, supported by robust software frameworks and tools, has facilitated widespread adoption and continuous optimization. This extensive support network helps in achieving higher performance and ease of use for developers and researchers alike. Despite the emergence of more specialized processors like TPUs and NPUs, GPUs continue to be a cornerstone of AI hardware, balancing flexibility, power, and accessibility.</p>
<h1 id="heading-fpga"><strong>FPGA ?</strong></h1>
<blockquote>
<p><strong><em>Field-Programmable Gate Array (FPGA)</em></strong></p>
</blockquote>
<p><img src="https://miro.medium.com/v2/resize:fit:600/1*tggdeEAoYno271Sou3djdw.jpeg" alt /></p>
<p>Vaaman, an edge computing board developed by Indian Startup <a target="_blank" href="https://vicharak.in/">Vicharak</a> ( Computer Hardware Startup)</p>
<p>Field-Programmable Gate Arrays (FPGAs) offer a unique and powerful solution in the AI hardware landscape. Unlike GPUs and TPUs, which have fixed architectures, FPGAs can be reprogrammed to optimize performance for specific tasks, providing a high degree of customization. This reconfigurability allows developers to tailor the hardware to their exact needs, achieving significant performance improvements for specialized AI applications. FPGAs can be optimized for low latency, making them particularly suitable for real-time AI processing where quick response times are critical.</p>
<blockquote>
<p><em>Do checkout</em> <a target="_blank" href="https://vicharak.in/"><em>Vicharak</em></a><em>, their high-performance edge computing board looks promising.</em></p>
</blockquote>
<p>In addition to their adaptability, FPGAs are known for their potential energy efficiency. By customizing the hardware configuration, it is possible to achieve a balance between power consumption and performance that is difficult to match with fixed-architecture processors. This makes FPGAs an attractive choice for edge computing, where energy efficiency is often as important as computational power. Moreover, their flexibility makes them valuable in the prototyping and development stages, allowing for rapid testing and iteration of new AI algorithms before committing to a specific hardware design. As AI applications continue to diversify, the role of FPGAs in providing customizable, efficient, and high-performance solutions is likely to expand.</p>
<h1 id="heading-summary-of-differences"><strong>Summary of Differences:</strong></h1>
<ul>
<li><p><strong>Functionality:</strong> GPUs are versatile, TPUs are specialized for tensor operations, and NPUs are tailored for neural network tasks.</p>
</li>
<li><p><strong>Parallelism:</strong> All three excel in parallel processing but differ in their optimization focus.</p>
</li>
<li><p><strong>Use Cases:</strong> GPUs dominate in data centers, TPUs in Google’s infrastructure, and NPUs in mobile and edge devices.</p>
</li>
<li><p><strong>Energy Efficiency:</strong> TPUs and NPUs are generally more energy-efficient than GPUs, suitable for their respective applications.</p>
</li>
</ul>
<p><strong>Conclusion:</strong></p>
<p>Choosing the right processor for AI applications depends on the specific requirements of the task. GPUs offer flexibility, TPUs provide specialized acceleration for tensor operations, and NPUs deliver efficient neural network processing. As AI technology advances, so will the hardware, driving innovation and efficiency in this exciting field. We do face many limitations while optimizing the AI pipeline for specific NPU/SOC architectures, but we hope for seamless development as the industry moves forward in designing new architectures.</p>
]]></content:encoded></item></channel></rss>