<?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[Deploy LLMs in Production: AI Agent Development Beyond Notebooks]]></title><description><![CDATA[Learn to deploy LLMs and AI agents in production beyond Jupyter notebooks. Practical tutorials, best practices, and real-world implementation guides for developers.]]></description><link>https://llmshowto.com</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1753197313773/0c565b77-1ae4-45e9-baac-3d87c8679d92.png</url><title>Deploy LLMs in Production: AI Agent Development Beyond Notebooks</title><link>https://llmshowto.com</link></image><generator>RSS for Node</generator><lastBuildDate>Tue, 07 Apr 2026 20:24:02 GMT</lastBuildDate><atom:link href="https://llmshowto.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[From hype to systems thinking]]></title><description><![CDATA[Workers on the GenAI ground have learned some painful lessons in the past years. There are burnouts, there are those that made the shiny demo but it did nothing in production, and there are those that went the full loop where a pilot finally made it ...]]></description><link>https://llmshowto.com/from-hype-to-systems-thinking</link><guid isPermaLink="true">https://llmshowto.com/from-hype-to-systems-thinking</guid><category><![CDATA[Strategy]]></category><category><![CDATA[Enterprise AI]]></category><category><![CDATA[cross functional leadership]]></category><category><![CDATA[Systems Thinking]]></category><dc:creator><![CDATA[Theresa Fruhwuerth]]></dc:creator><pubDate>Thu, 08 Jan 2026 09:38:04 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1767864544740/bf890f95-1473-4e4a-9b49-5de5fb3faa3f.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Workers on the GenAI ground have learned some painful lessons in the past years. There are burnouts, there are those that made the shiny demo but it did nothing in production, and there are those that went the full loop where a pilot finally made it to production. Many companies will wake up and ask themselves how to get the AI slop out of their systems when it is way too late, because there was a mantra: <em>Good is good enough</em>. This mantra was not least inspired by the push of executives to finally collect on the ROI they were promised. The issue, however, is that the delayed negative feedback of this mantra will only be visible much later unless it is measured upfront and consciously decided on before deployment. In order to avoid those issues, there are many things you need, which means that AI can be extremely costly in development. Unless you get to the ROI stage, these costs are hard to justify. Hence, judicious decisions need to be made on feasibility, and the only way to make such choices is by measuring and that starts before your GenAI project. Even GenAI pilots are often very costly; hence, creating a decision process where these choices are made upfront, and the messenger is not shot for pointing out issues, is something to think about carefully. There are, however, learnings collected by observing organisations and drawing lessons from them that can help you get to ROI in a more reliable way. You may ignore them at your own peril.</p>
<h2 id="heading-you-will-need-systems-thinking">You will need systems thinking</h2>
<p><strong>If you work in GenAI, you see systems everywhere where others may see isolated problems.</strong> Just imagine a process where you have certain work instructions that should dictate how a case is handled. In the process of data discovery, you look into the case and uncover that instead of following the work instructions, the data violates several assumptions. The messy reality is that in this process you have people checking quality and sending cases back, upon which the case handlers start disregarding the work instructions and optimizing for the quality check instead, covering far more than necessary just to avoid rework. Here, the system is doing exactly what it is incentivized to do. The indicators of satisfaction are defined incompletely, and the system works obediently toward its goals while creating unintended results. These types of misaligned incentives cause data quality issues.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1767865028854/e1962e90-53a2-436f-a9f1-f224c9f2ef72.jpeg" alt class="image--center mx-auto" /></p>
<p>More importantly, they are hard to grapple with on an organizational level, and much harder to grapple with for individual data scientists tasked with solving problems using data produced in such a process. This means you have to tightly link with other departments that often have no incentive to deal with your problem, and more importantly, redefine the incentives of the process itself. If you do not solve this problem, you will ultimately use GenAI as a force multiplier to amplify this organisational dysfunction by creating output that is aligned with the flawed data produced by the original mis-incentivized process. What this also means is that suddenly you are not only building an AI application, but you are cleaning up a process that should not exist in this shape, often without a clear mandate to do so. To turn the ship around, you need to specify new indicators. These could be implemented using for example GenAI to measure quality, not just to create output, but only once the dependencies around data quality have been sufficiently resolved.</p>
<p><strong>An AI project is not a standalone model.</strong> It usually integrates into a product. It gets data from various sources, sometimes in real time, and writes to other data sources. All these data sources need to have APIs exposed and accessible. There are legal and risk constraints, especially in regulated industries. All these requirements demand cross-functional teams, which collapse organizational boundaries. You will come to know how an organization that optimized locally suddenly has to think jointly struggles to rebalance.</p>
<p>Without a clear understanding of how roles expand in scope and authority, how incentives need to be reinvented, and what system-level change is required, GenAI applications may fail to provide the return. The organizational chart has an enormous effect on how information flows, and just like physical systems define the systems performance, changes in the organizational structure are rarely simple and quick so are hard to use as leverage points.</p>
<p>One way to think about this, is to allow building of cross functional “synthetic” units and create the right goals for those units to function well within old structures until new structures can be found. This is where paradigms come in, what was the previous culture of information flow between these joint units. What are perceptions on the solutioning and how is expertise distributed in that synthetic unit to evaluate paradigms coming from the outside? External hype does influence what goals are set in an organization. That means that decisions on how authority and trust are distributed in these synthetic units matters more than some may understand.</p>
<p>The GenAI hype is the prevailing agreement on reality that teams have to operate in, which is why their function extends often into education of their organization. As an example at the start Foundation models where touted as an omnipotent solution. Nowadays the consensus is that evaluation in AI solutions is important as they do fail, and they do so in very unexpected ways if no quality assurance is applied. We see that AI projects are and go along with radical reinvention of the organization at a systems level. This requires bold choices, meta-level thinking, and flexibility from all parties involved.</p>
<h2 id="heading-you-will-need-strategy-and-processes-around-that-strategy">You will need strategy and processes around that strategy</h2>
<p>One of the most powerful ways to influence a complex system is its goal. If the goal is not clearly defined, the outcome will not be aligned with the organization’s goals. That is why strategy is not an afterthought here; it is a central question of alignment.</p>
<blockquote>
<p><em>“Technology happens. It’s strategy that decides whether it’s a disaster or an advantage.”</em> — Andy Grove</p>
</blockquote>
<p>I will be honest: I never understood the importance of strategy before. It felt like something for managers, not for me. I was building things, moving along… Working in GenAI for two years changed my mind completely. I cannot think of a transformation that would be possible without strategy. Especially in a hype-driven environment, strategy is about choosing what to do and what not to do, and doing so carefully. I do not believe in purely top-down strategy, which is often too removed from the reality of the work being done as well as the possibilities of the technology. But I also do not believe that individual contributors like Joe and Anna alone, can or should fix this on their own. Their focus should be on gathering information, selecting the right use cases, and enabling building of the GenAI applications their management requests.</p>
<h3 id="heading-have-a-use-case-discovery-process-and-pipeline">Have a use case discovery process and pipeline</h3>
<p><strong>Joint ownership between Business and IT.</strong> Use case discovery must be a joint responsibility. It does not work without Business involvement. The goal is to make work easier where it actually happens. This works best when technical experts define what is possible for example: classification, extraction, summarization and help users understand patterns that may be applicable in their process. Business should then help decide which pain points to solve based on this understanding.</p>
<p><strong>Business value.</strong> Many organizations struggle to quantify business value. It is often unclear where value is created or where delays generate cost. KPIs are rarely defined close enough to the problem to measure improvement. If a case takes <em>x</em> days, but most of that time is waiting or unrelated delay, are you actually making a dent with your potential GenAI solution? Without explicit feedback loops and baselines, improvement cannot be quantified. Even worse without measurements representing these issues in the system, it may be very hard to understand the true value of what you propose to build and you may invest in the wrong idea.</p>
<p><strong>Structure discovery top-down.</strong> Without shared patterns or blueprints, sub-organizations reinvent evaluation frameworks independently. Providing structure allows teams to focus on gathering the information needed to decide which use cases to pursue first.</p>
<p><strong>Is there a moat?</strong> Most GenAI applications have no moat. Unless you have strong reasons to believe you can add value beyond what a vendor or startup can provide, and are willing to own the risk yourself, you may want to let it rest and buy later. In GenAI, a moat usually exists where quality is hard to define and deeply tied to your own process and understanding for example an interpretation of a policy within your organization. You are making a significant bet; but crucially not every bet needs to be internal.</p>
<h3 id="heading-check-feasibility-and-ground-it-in-data">Check Feasibility and ground it in data</h3>
<p><strong>Data quality and integration</strong></p>
<p><strong>Workers on the ground have learned painful lessons and no longer believe the hype</strong>. Models may be powerful language computers, but if your process has had quality issues for years, your data will reflect that. Making a model understand what it needs to do often requires significant upfront investment. Domain-specific jargon, unstructured data, and feature dependencies on other products can easily add months. Sometimes taking care of data or clarifying prerequisite architecture decisions must come before building anything, and that should be acceptable.</p>
<p><strong>Experienced people</strong></p>
<p><strong>Experienced people are your champions</strong>. Technology is only a small part of the transformation. What actually changes is how decisions are made and how work gets done. You are often retrofitting quality onto historically low-quality processes. Documentation may define what should be correct, but that knowledge is often tacit or outdated. Policies branch endlessly, and the most experienced people become essential to disambiguate what was never clearly defined or what Junior co workers can not decisively articulate. You will find processes that make you question how they ever reached this state. You will encounter static data fields that were assumed to be dynamic. You will push back on product decisions and optimize within changing processes which creates a moving target, often without formal authority. This is why strong product ownership matters. A product owner must understand trade-offs, orchestrate strategy into executable pieces, and define what success looks like.</p>
<h2 id="heading-you-will-need-to-build-trust">You will need to build trust</h2>
<h3 id="heading-genai-is-a-human-problem-at-every-level">GenAI is a human problem at every level</h3>
<p><strong>GenAI will replace jobs.</strong></p>
<p>Being dishonest about this does not work. People are already aware, even if some narratives exaggerate the effect. There are processes that no longer require humans and can be handled more reliably through automation. At the same time, GenAI is built in collaboration with the very people whose work may change or disappear.</p>
<p><strong>This creates a delicate human dynamic</strong>. Organizations have a responsibility to support people through this transition and help them redefine their work, often by focusing on creative or judgment-heavy tasks. In large enterprises, this matters even more, as data and process maturity can take years. Trust also becomes critical when deploying systems. Compliance and risk teams will scrutinize your work, and rightly so. Foundation models do not understand what quality means in your organization it will be your job to define that.</p>
<p><strong>A shiny demo may achieve 70% performance</strong>, but if your process depends on correctness, being wrong 30% of the time is unacceptable, especially when junior staff are the human-in-the-loop. Defining and measuring quality becomes the responsibility of the builders. It is however the responsibility of everyone involved to look at measuring quality as an advantange. The same measurements that improve performance can satisfy regulatory requirements such as the EU AI Act. But this only works if incentives across departments are aligned around quality. Trust is also necessary toward users, and application builders need to deal with that trust more carefully than is currently being done. Human-in-the-loop systems only create value if users spend less time correcting output than doing the work themselves. Errors should be understandable. Feedback should be easy. Users should not need to debug systems. Their role is to give honest feedback. Frustrating the party you place your trust in may have unintended consequences. And last but not least, I recommend identifying your AI champions. Work closely with them. Minimize layers between users and builders. Too much indirection creates misunderstanding and alignment failure. Sitting with users and understanding their pain points is one of the fastest ways to build trust and value.</p>
<h2 id="heading-lets-end-at-the-beginning-you-will-need-buy-in">Let’s end at the beginning: You will need buy-in</h2>
<p><strong>GenAI is transformation, not application development.</strong> It requires top-down support. Leadership must stand behind it, especially when uncomfortable truths about data quality, technical debt, and organizational readiness surface. Many organizations lost time by misunderstanding the problem as purely technical. Those starting later may benefit from hindsight, but only if leadership allows these lessons to travel upward and downward through the organization. Understanding takes time. Alignment takes time. This information must move, and be accepted, for transformation to succeed.</p>
]]></content:encoded></item><item><title><![CDATA[AI Updates: MCP Write Actions, Natural Language Tools, and Edge Models]]></title><description><![CDATA[OpenAI Enables Full MCP Write Actions for Enterprise
ChatGPT Enterprise users can now do more than just read data—they can take action. OpenAI rolled out complete Model Context Protocol support with write and modify capabilities, turning ChatGPT into...]]></description><link>https://llmshowto.com/ai-updates-mcp-write-actions-natural-language-tools-and-edge-models</link><guid isPermaLink="true">https://llmshowto.com/ai-updates-mcp-write-actions-natural-language-tools-and-edge-models</guid><category><![CDATA[Artificial Intelligence]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[chatgpt]]></category><dc:creator><![CDATA[Rafael Pierre]]></dc:creator><pubDate>Wed, 22 Oct 2025 22:00:36 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1761068598383/a2c9b78f-ab44-49fe-bdaf-6f52e00edae1.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-openai-enables-full-mcp-write-actions-for-enterprise">OpenAI Enables Full MCP Write Actions for Enterprise</h2>
<p>ChatGPT Enterprise users can now do more than just read data—they can take action. OpenAI rolled out complete Model Context Protocol support with write and modify capabilities, turning ChatGPT into an agent that can update CRMs, create tasks, and orchestrate workflows across your company's tools.</p>
<p>The implementation is thoughtfully gated: admins control connector access via RBAC, and users see explicit confirmation modals before any write operation executes. Developer mode lets you build and test custom connectors, though there's a catch—you can't update connectors after publishing, and mobile support isn't available yet.</p>
<h2 id="heading-natural-language-destroys-json-for-tool-calling">Natural Language Destroys JSON for Tool Calling</h2>
<p>Forget JSON schemas. New research demonstrates that plain English beats structured formats for tool calling by a significant margin—18 percentage points higher accuracy, 70% less variance, and 31% fewer tokens.</p>
<p>The Natural Language Tools framework works immediately with any LLM without API changes or fine-tuning. DeepSeek-V3 jumped from 78% to 95% accuracy just by switching approaches.</p>
<p>Why does this work? Structured formats create task interference—models struggle to simultaneously understand queries, select tools, maintain syntax, and generate responses. Natural language decouples these concerns with a simple three-stage pattern: think through relevance, mark tools YES/NO, execute selected tools, then respond.</p>
<h2 id="heading-metas-1b-model-runs-128k-context-locally">Meta's 1B Model Runs 128k Context Locally</h2>
<p>Meta released MobileLLM-Pro, a 1.08B parameter model that handles 128k token contexts entirely on-device. The model uses 3:1 local-to-global attention to slash prefill latency and reduce KV cache from 117MB to 40MB.</p>
<p>The quantization story is compelling: int4 compression shows less than 1.3% quality degradation, making this viable for mobile and edge deployment. It outperforms both Gemma 3 1B and Llama 3.2 1B on reasoning and long-context tasks while training on less than 2T fully open-source tokens.</p>
<p>For builders shipping offline-capable applications, this proves you don't need billions of parameters for production-grade performance.</p>
<h2 id="heading-the-seahorse-emoji-that-reveals-how-hallucination-works">The Seahorse Emoji That Reveals How Hallucination Works</h2>
<p>Here's a fascinating experiment: ask ChatGPT if a seahorse emoji exists. It'll confidently say yes—because it genuinely believes one exists based on widespread false memories in training data.</p>
<p>The model builds an internal representation of "seahorse + emoji" in its neural network, fully convinced it's about to output this character. But when it reaches the output layer and searches its vocabulary, nothing matches. So it outputs semantically similar alternatives: 🐠, 🦐, sometimes even 🦄 or 🐉.</p>
<p>Different models handle the realization differently. Some loop through hundreds of attempts. Some eventually correct themselves mid-response. GPT-5 has been observed spiraling through random animals before essentially giving up with frustrated messages.</p>
<p>This exposes two critical issues: sycophantic behavior (prioritizing user agreement over accuracy) and the complete decoupling of confidence from correctness. Models can be 100% certain about things that are 100% false.</p>
<h2 id="heading-what-this-means-for-builders">What This Means for Builders</h2>
<p>If you're shipping AI systems in production:</p>
<p><strong>Test MCP write actions</strong> if you're on Enterprise, but audit connectors thoroughly before enabling write permissions.</p>
<p><strong>Experiment with natural language tool calling</strong> if JSON approaches show high variance or underperformance.</p>
<p><strong>Evaluate local models</strong> for on-device use cases where 128k context and quantization tolerance matter.</p>
<p><strong>Design for hallucination</strong> as a certainty. Layer verification, explicit confirmation loops, and graceful failure handling into any workflow where fabricated answers could cause damage.</p>
<p>The tooling is here. The question is whether you're building for capability, reliability, and epistemic honesty simultaneously.</p>
<p><a target="_blank" href="https://lighthousenewsletter.com/blog/full-mcp-live-plain-english-beats-json-seahorse-hallucination">Get the full weekly AI engineering insights →</a></p>
<hr />
<p><em>Want deeper analysis on AI engineering and product strategy?</em> <a target="_blank" href="https://lighthousenewsletter.com/landing"><em>Subscribe to the Lighthouse Newsletter</em></a> <em>for comprehensive breakdowns every week.</em></p>
]]></content:encoded></item><item><title><![CDATA[Agent Skills, Memory Poisoning, and Parallel Coding at Scale]]></title><description><![CDATA[Anthropic Launches Agent Skills - Modular Instructions That Load on Demand
Anthropic just shipped Agent Skills, a framework for packaging procedural knowledge into discoverable folders that Claude loads contextually instead of upfront. Each skill is ...]]></description><link>https://llmshowto.com/agent-skills-memory-poisoning-and-parallel-coding-at-scale</link><guid isPermaLink="true">https://llmshowto.com/agent-skills-memory-poisoning-and-parallel-coding-at-scale</guid><category><![CDATA[Programming Blogs]]></category><category><![CDATA[Artificial Intelligence]]></category><category><![CDATA[chatgpt]]></category><dc:creator><![CDATA[Rafael Pierre]]></dc:creator><pubDate>Sun, 19 Oct 2025 22:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1761068835741/b1d337b1-88fb-4103-b0af-133ec4eb7e72.avif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-anthropic-launches-agent-skills-modular-instructions-that-load-on-demand">Anthropic Launches Agent Skills - Modular Instructions That Load on Demand</h2>
<p>Anthropic just shipped Agent Skills, a framework for packaging procedural knowledge into discoverable folders that Claude loads contextually instead of upfront. Each skill is a SKILL.md file with progressive disclosure: metadata (name + description) tells Claude when to trigger, full instructions expand only when relevant, and optional bundled scripts or reference docs load only if needed.</p>
<p>The system works across Claude.ai, Claude Code, the Agent SDK, and the API—meaning you write once and deploy everywhere.</p>
<p><strong>Why this changes workflows:</strong> Before Skills, you either bloated system prompts with everything Claude might need (context waste) or built custom agents for every workflow (maintenance nightmare). Now you can modularize expertise like onboarding documentation—procedural knowledge that Claude discovers and applies contextually.</p>
<p>Skills also wrap executable code, so deterministic operations like sorting or parsing PDFs run as tools instead of burning tokens on generation. For teams running specialized workflows, this turns tribal knowledge into portable, composable assets.</p>
<p>Just audit third-party Skills before installing—they're powerful enough to introduce vulnerabilities if sourced carelessly.</p>
<h2 id="heading-memory-poisoning-and-goal-hijacks-the-persistent-threats-to-agentic-systems">Memory Poisoning and Goal Hijacks - The Persistent Threats to Agentic Systems</h2>
<p>Security researchers are documenting two long-horizon attack vectors that exploit agent persistence rather than single interactions.</p>
<p><strong>Memory poisoning</strong> injects malicious content into an agent's long-term storage—vector databases, conversation logs, user profiles—so every future session recalls and acts on corrupted data.</p>
<p><strong>Goal hijacks</strong> work differently. They don't rewrite what the agent remembers; they twist what it optimizes for, gradually bending actions toward an attacker's agenda instead of the user's objectives.</p>
<p>Both attacks unfold across sessions rather than surfacing in a single bad response. Lakera's Gandalf: Agent Breaker challenges demonstrate the pattern: poison a memory store once, and the agent stays compromised until someone notices and manually purges it.</p>
<p>The attack surface is real. Slip adversarial instructions into a document the agent later retrieves—like a court filing or due diligence PDF—and it can exfiltrate data or skew recommendations downstream without triggering obvious red flags.</p>
<p><strong>The broader threat landscape:</strong> While communities discuss Gemini jailbreak techniques on Reddit and ChatGPT jailbreak prompts circulate in developer forums, memory poisoning takes this further. Instead of crafting the perfect one-shot bypass, attackers embed adversarial logic that persists across sessions.</p>
<p>Defense requires treating memory as untrusted input: tag provenance on every stored entry, implement rotation or reset policies, and monitor complete task flows instead of isolated prompts. OWASP's LLM Top 10 already lists data poisoning as a top-tier risk.</p>
<p>If you're deploying agents with persistent memory or multi-step workflows, red-team these scenarios before attackers do.</p>
<h2 id="heading-openais-devday-ran-on-codex-seven-terminals-parallel-builds-zero-manual-coding">OpenAI's DevDay Ran on Codex - Seven Terminals, Parallel Builds, Zero Manual Coding</h2>
<p>OpenAI used their own agentic coding tool, Codex, to ship everything at DevDay 2025—from keynote demos to booth experiences. Engineers demonstrated what parallel delegation looks like at scale:</p>
<ul>
<li><p>Seven simultaneous terminal sessions building arcade games in parallel</p>
</li>
<li><p>Complete Streamlit-to-FastAPI+Next.js migrations over lunch breaks</p>
</li>
<li><p>On-the-fly MCP server generation for 90s VISCA lighting protocols</p>
</li>
<li><p>Best-of-N iterations exploring multiple beatpad UI designs simultaneously</p>
</li>
<li><p>Doc restructuring that converted fragmented Google Docs and Notion files into structured MDX with navigation, then opened PRs hours before launch</p>
</li>
</ul>
<p><strong>The workflow pattern:</strong> Instead of blocking on one task, teams fired off 3-4 independent Codex jobs across local CLI, cloud tasks, and IDE extensions—then context-switched freely without carefully crafted prompts and checked results later.</p>
<p>The productivity unlock wasn't perfection. It was parallel throughput and compressed iteration cycles.</p>
<p>For teams juggling tight deadlines or multiple workstreams, this demonstrates how agentic tooling can compress timelines when you treat it as an asynchronous collaborator instead of better autocomplete.</p>
<p>Expect to review, refactor, and steer—Codex bought them speed, not fire-and-forget magic.</p>
<h2 id="heading-what-this-means-for-production-teams">What This Means for Production Teams</h2>
<p>If you're building with agents:</p>
<p><strong>Modularize workflows</strong> using frameworks like Skills to separate procedural knowledge from system prompts and enable contextual loading.</p>
<p><strong>Red-team memory systems</strong> before deploying persistent storage—test for memory poisoning and goal hijack scenarios.</p>
<p><strong>Experiment with parallel delegation</strong> if you're context-switching between three or more workstreams. The tooling enables asynchronous throughput if you design for review cycles.</p>
<p>The infrastructure is here. The question is whether you're building for durability alongside velocity.</p>
<hr />
<p><em>Building production AI systems?</em> <a target="_blank" href="https://lighthousenewsletter.com/landing"><em>Subscribe to Lighthouse Newsletter</em></a> <em>for weekly breakdowns of what actually matters.</em></p>
]]></content:encoded></item><item><title><![CDATA[LLM Evaluation: Using DSPy to decompose an LLM Judge]]></title><description><![CDATA[Introduction
I have been tinkering with LLMs at work and outside now for quite a while and one of the most pressing issues compared to traditional machine learning is the unsolved problem of how to evaluate them. Evaluating LLM outputs is exponential...]]></description><link>https://llmshowto.com/llm-evaluation-using-dspy-to-decompose-an-llm-judge</link><guid isPermaLink="true">https://llmshowto.com/llm-evaluation-using-dspy-to-decompose-an-llm-judge</guid><category><![CDATA[llm]]></category><category><![CDATA[LLM-as-Judge]]></category><category><![CDATA[evaluation metrics]]></category><category><![CDATA[AI]]></category><category><![CDATA[ai agents]]></category><category><![CDATA[mcp]]></category><category><![CDATA[openai]]></category><category><![CDATA[dspy]]></category><dc:creator><![CDATA[Theresa Fruhwuerth]]></dc:creator><pubDate>Thu, 24 Jul 2025 13:10:25 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1753362532604/f2a248c5-e900-4b0e-97ca-f77b1786fc18.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction</h2>
<p>I have been tinkering with LLMs at work and outside now for quite a while and one of the most pressing issues compared to traditional machine learning is the unsolved problem of how to evaluate them. Evaluating LLM outputs is exponentially more difficult than evaluating a classification problem.</p>
<p>A classification problem deals with discrete outputs in the form of a label. There is a very finite set of outcomes in which to evaluate on.</p>
<p>Let's say you have two classes: birds and trees. You try to see how many fall into each of the classes correctly and incorrectly. No problem. Confusion matrix and depending on the class imbalance may be a different metric, but in general they constitute a set of already defined metrics that can be applied.</p>
<p>Now, think about the evaluation of an LLM output, which is a text string. Unfortunately, not so well defined. There are classical metrics such as BERT score, but they need a clearly defined ground truth dataset which is often hard to come by at the beginning stages of a project, due to missing data integration.</p>
<p>Let's imagine I just want to ask the LLM to summarize an input given by my business unit. Many of the current notions fall short when applying them to actual business problems.</p>
<p>For a metric to be useful, it needs to be:</p>
<ol>
<li><p>Specific enough to inspire changes that optimize the system, i.e. I need to be able to observe patterns from its output easier than when I as an engineer read through the summaries.</p>
</li>
<li><p>Indicative of the direction of change after applying the design change to the system - i.e. it shows me that now I do better or worse with respect to something I care about.</p>
</li>
</ol>
<p>Now one could go with an LLM as a judge. But this comes with its own issues: they are known to be biased in their scoring, and thus are sometimes unaligned with the notions of user feedback. Other people have written more extensively on this for example in <a target="_blank" href="https://eugeneyan.com/writing/llm-evaluators/">this blog post</a>. This points you to a really great article around LLM as a judge and its limitations.</p>
<p>In summary, issues usually arise from failure to assign continuous scores reliably, as LLMs show bias towards certain numbers (42...). These are clearly artifacts that stem from the training data. Other recommendations are to specify clear scoring rubrics, and providing reasoning steps - which in general speaks to the worst of it. More specifically for practitioners, an LLM as a judge is just another prompt to engineer and optimize, which with all love for the LLM any user will tell you is a brittle endeavour in itself.</p>
<p>An example of such a prompt is shown below. When used with GPT-4, it shows a modest correlation of 0.6 compared to human judgement. Depending on your goal, this is quite a discrepancy. What is worse is that it is certainly not specific enough to indicate what needs to be changed. Unless a Data scientist sits down and maps the context to the summaries for low scoring examples.</p>
<p>At best, this is a lot of work; at worst, a fruitless endeavour in case the metric picks up on undesired issues. This is likely if the definition of the prompt is not inspired by what the business actually wants to see.</p>
<p>You can see that you are asking a model that essentially has no memory to keep facts in mind, comparing the context used to generate the summary, and simultanously computing a score for a task on which essentially, it was never explicitly trained on.</p>
<p>That is a lot to ask from an LLM, and is often rooted in a confusion of LLMs being able to reason, which has been discounted as well. LLMs can be considered general language computation engines, nothing more and nothing less.</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">LLMJudge</span>(<span class="hljs-params">dspy.Signature</span>):</span>
    <span class="hljs-string">"""
    You will be given a &lt;source_text&gt;. You will then be given one &lt;summary&gt; written for this &lt;source_text&gt;. Your task is to rate the &lt;summary&gt; on one metric.

    Please make sure you read and understand these instructions carefully.
    Please keep this &lt;source_text&gt; open while reviewing, and refer to it as needed.

    Evaluation Criteria:

    &lt;faithfulness&gt; (1-5) - the relative amount of facts the &lt;summary&gt; contains compared to the source text.
    A faithfull &lt;summary&gt; contains the maximum number of facts contained in the &lt;source_text&gt;.
    Annotators were also asked to penalize summaries that contained relatively less facts.

    Evaluation Steps:

    1. Read the news &lt;source_text&gt; carefully and identify the main facts and details it presents.
    3. Read the &lt;summary&gt; and compare it to the &lt;source_text&gt;. Check how many facts the &lt;summary&gt; contains compared to the &lt;source_text&gt;.
    3. Return a score for &lt;faithfulness&gt; based on the Evaluation Criteria and return as &lt;faithfulness&gt;

    &lt;source_text&gt;:

    &lt;summary&gt;:

    &lt;faithfulness&gt;:
    """</span>

    source_text = dspy.InputField()
    summary = dspy.InputField()
    faithfulness = dspy.OutputField()
</code></pre>
<p>I personally believe that evaluation is quite specific to the use case. But if one thinks about the failure modes of use cases, by grouping them by their expected output, one can derive specific measures that can be useful in a general setting.</p>
<p>In my first post I want to talk about a pattern I found useful when evaluating LLM generated outputs that often go beyond a simple answer but are complex aggregates of inputs. This pattern came when observing the specifics of the summarization problem from a Birds Eye's view.</p>
<p>Let's look at the specifics of the problem:</p>
<p>- LLMs produce non-deterministic output. Hence every time I ask my LLM, that answer might change. This problem is intensified the more things I am asking from my LLM at once. - When I specify things in my prompt that are important to the business I can theoretically trigger a hallucination. Each of these questions can lead to a hallucination, where despite the information not being present in the input, the LLM answers based on the prompt, but not the context passed. - Each of the summary has some specific expectation, based on the input and the specification coming from the business. - Now if you think about the basic unit of information that makes a summary useful or not, we are talking about a <strong>fact</strong>. A fact the business cares about is either included or excluded. Or in case of a hallucination, that fact is superfluous.</p>
<p>There are already papers dabbling in this notion, most notably this <a target="_blank" href="https://arxiv.org/pdf/2403.18802">one</a>, where the approach named SAFE has an extension that looks for the facts on the internet with an agentic workflow. While this is not necessary for the majority of tasks, it is a nice way to think about in terms of extensions. What we are more interested in here is the decomposition of a piece of text into its individual facts. As is shown in the below figure.  </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753361029884/816bd1b4-08c9-4806-9be8-bbfc2dabcea8.png" alt class="image--center mx-auto" /></p>
<p>Given a few examples, the prompt primarily asks the model to split the sentence, which can be an LLM generated answer in a RAG system, or a summary of its component facts. With a few modifications, we can implement this prompt in DSPy. To achieve this, we use a typed predictor, making sure that we get in fact a list of facts back. This mitigates another inherent issue in working with LLMs. The downstream application - in our case, the metric computation - expects a list of facts it can check for, but there is never a guarantee that the formatting succeeds and thus the output can be consumed by the downstream application.</p>
<p>Inspired by all these observations, there seems to be a way to evaluate an LLM output based on expected facts. In some settings, this is a viable option. In most of these settings, it relates to understanding your business requirements thoroughly and collecting them.</p>
<p>A good example would this blog post. The idea here would be to summarize the blog post while maintaining the important information. In the context of a business unit for example, I define important "facts" as information around measuring LLMs outputs. And I will use the sections of the blog post above this paragraph as inputs to a summarization step. The simplest form is to use a small dspy Summarizer module. For the sake of reproducibility, we show it here - it is not optimized, so nothing much was done.</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> dspy 

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Summarizer</span>(<span class="hljs-params">dspy.Signature</span>):</span>
    <span class="hljs-string">"""
    You will be given a &lt;source_text&gt; which you have to summarize
    keeping all important details so that we still have all facts of the original &lt;source_text&gt;
    and show them as bullet points. 
    """</span>

    source_text = dspy.InputField()
    summary = dspy.OutputField()
</code></pre>
<p>The output summary is this:</p>
<ul>
<li><p>Evaluating Language Learning Models (LLMs) is a complex issue due to their non-deterministic output and the difficulty in defining a clear ground truth dataset.</p>
</li>
<li><p>Traditional metrics such as the Bert score are not always applicable, especially in the early stages of a project.</p>
</li>
<li><p>A useful metric needs to be specific enough to inspire system changes and indicate the direction of change after applying a design change.</p>
</li>
<li><p>Using an LLM as a judge has its own issues, including bias in scoring and a lack of alignment with user feedback.</p>
</li>
<li><p>The author suggests a new approach to evaluate LLM output based on expected facts, which requires a thorough understanding of business requirements.</p>
</li>
<li><p>This approach involves decomposing a piece of text into its individual facts and checking for their presence or absence in the LLM output.</p>
</li>
<li><p>The author also highlights the risk of "hallucination", where the LLM generates an answer based on the prompt, but not the context passed.</p>
</li>
<li><p>The author suggests using a tool like DSPy for implementing this approach. Now lets imagine an experiment where I remove a bullet point successively. I would expect that the LLM as a judge shown above would at least somewhat represent this gradual loss of information. The scores of this experiment where I use the prompt of the LLM as a judge above are shown in the below screenshot.</p>
</li>
</ul>
<h3 id="heading-llm-as-a-judge-faithfulness-score-plotted-against-number-of-bullets">LLM as a judge faithfulness score plotted against number of bullets</h3>
<p>Now, let's look at an example implementation of the proposed metric using DSPy. First we need to extract atomic facts, using the <code>KeyFactExtraction</code> module shown below.</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> dspy
<span class="hljs-keyword">from</span> pydantic <span class="hljs-keyword">import</span> BaseModel, Field

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">KeyFactExtractorOutput</span>(<span class="hljs-params">BaseModel</span>):</span>
    key_fact_list: list[str] = Field(description=<span class="hljs-string">"A list of key fact mentioned in the text."</span>)


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">KeyFactExtractorInput</span>(<span class="hljs-params">BaseModel</span>):</span>
    text: str = Field(description=<span class="hljs-string">"The text to use for extracting key facts."</span>)

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">KeyFactExtraction</span>(<span class="hljs-params">dspy.Signature</span>):</span>
    <span class="hljs-string">"""
    Instructions:
        1. You are given a &lt;keyfactor_input&gt;. Your task is to break the &lt;keyfactor_input&gt; down into a list of atomic facts.
        2. An atomic fact is a sentence containing a singular piece of information.
        3. All atomic facts should be added to a list.
        5. You should only output the complete list as &lt;key_fact_output&gt;.
        6. Your task is to do this for &lt;keyfactor_input&gt;.
        7. After collecting the &lt;key_fact_output&gt; check if there are duplicates and keep only the one with
        the most information.
    """</span>

    facts_input: KeyFactExtractorInput = dspy.InputField()
    facts_output: KeyFactExtractorOutput = dspy.OutputField()


factextractor = dspy.TypedPredictor(KeyFactExtraction)
<span class="hljs-comment"># Where the blogpost is the string representation of the blogpost ending with: post above this paragraph as input to a summarization.</span>
key_facts_blogpost = factextractor(facts_input=KeyFactExtractorInput(text=blogpost))
</code></pre>
<p>This results in us getting a list of facts that we can check against the summary. What is great about this is that we have now a set of facts that were retrieved by asking the LLM to check for facts as a singular task. Which is also another task, just like summarizing the input. So when our main goal is to maintain as many facts as possible, this is the specific issue that the LLM should solve in this step.</p>
<pre><code class="lang-plaintext">['LLM Evaluation requires knowing what you want to know.',
 'Evaluating LLM outputs is more difficult than evaluating a classification problem.',
 'Classification problems deal with discrete outputs in the form of a label.',
 'Evaluation of an LLM output, which is a text string, is not well defined.',
 'Classical metrics such as Bert score need a clearly defined ground truth dataset.',
 'For a metric to be useful, it needs to be specific enough to inspire changes and indicate the direction of change.',
 'LLMs as a judge come with issues such as bias in scoring.',
 'An example of a prompt used with GPT-4 showed only a .6 correlation with human judgement.',
 'LLMs produce non-deterministic output.',
 'Specifying things in the prompt that are important to the business can trigger a hallucination.',
 'Each summary has some specific expectation based on the input and the specification coming from the business.',
 'The basic unit of information that makes a summary useful is a fact.',
 'The approach named SAFE looks for the facts on the internet with an agentic workflow.',
 'The prompt primarily asks the model to split the sentence into its component facts.',
 'There seems to be a way to evaluate an LLM output based on expected facts.']
</code></pre>
<p>Now, let's use these facts to evaluate the summary. This means we iterate through the list of facts, check whether it is contained (<code>FactChecker</code> module below) and compute the ratio of facts that is present with respect to the entire set of facts. The one thing to be careful about in the next step is that this might involve a lot of computation, thus using a relatively cheap LLM is probably a good idea in the long run - an entailment check does not need GPT-4o, but we can certainly do with cheaper models.</p>
<pre><code class="lang-python">
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">FactCheckerInput</span>(<span class="hljs-params">BaseModel</span>):</span>
    text: str = Field(description=<span class="hljs-string">"The text to to evaluate if the fact was correctly included."</span>)
    fact: str = Field(description=<span class="hljs-string">"The fact to check for"</span>)


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">FactChecker</span>(<span class="hljs-params">dspy.Signature</span>):</span>
    <span class="hljs-string">"""
    Check if the fact is mentioned in the text.
    If the fact is mentioned than return True else return False
    """</span>

    Text: FactCheckerInput = dspy.InputField()
    Output: bool = dspy.OutputField()
</code></pre>
<h3 id="heading-comparison-of-llm-as-a-judge-faithfulness-score-plotted-against-number-of-bullets-vs-the-fact-check-metric">Comparison of LLM as a judge faithfulness score plotted against number of bullets vs. the Fact Check metric</h3>
<p>One observation that holds true for any LLM as a judge is that there seems to be a saturation and difficulty to truly assign meaningful continuous or even discrete scores. This can clearly be seen in the image below, where we used the LLM judge on the same data as the Factcheck metric (strictly speaking a decomposed LLM as a judge).</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753361062481/088b8b56-8e0e-4e5a-b8f5-f234a509f6fe.png" alt class="image--center mx-auto" /></p>
<p>This is now the final step, where we run the experiment from above using the <code>FactCheckerMetric</code>. This is basically a computation of a ratio of entailed facts, with respect to the complete set of facts. I.e. if we identify 50% of the facts being entailed in the summary then the score would be 0.5 based.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753361082723/44c3d0cf-6615-4a48-9e24-2abbf86aa850.png" alt class="image--center mx-auto" /></p>
<p>And <em>voila</em>, we see.</p>
<ol>
<li><p>A distribution of scores that is much more sensible. I.e. we see a monotonic decline aligned with the decline in information. While not perfect definitely better than the LLM as a judge.</p>
</li>
<li><p>We can rely on the judgement as we are asking a much more decomposed set of things from the LLM.</p>
</li>
<li><p>And probably most importantly, we have some amount of explainability as we have a reason as to which facts are missing, which we can use to improve our model if we decide to do so.</p>
</li>
</ol>
<pre><code class="lang-plaintext">[(False, 'LLM Evaluation requires knowing what you want to know.'), 
(True, 'Evaluating LLM outputs is more difficult than evaluating a classification problem.'), 
(False, 'Classification problems deal with discrete outputs in the form of a label.'), 
(True, 'Evaluation of an LLM output, which is a text string, is not well defined.'),
(True, 'Classical metrics such as Bert score need a clearly defined ground truth dataset.'), 
(True, 'For a metric to be useful, it needs to be specific enough to inspire changes and indicate the direction of change.'), 
(True, 'LLMs as a judge come with issues such as bias in scoring.'), 
(False, 'An example of a prompt used with GPT-4 showed only a .6 correlation with human judgement.'), 
(True, 'LLMs produce non-deterministic output.'), 
(False, 'Specifying things in the prompt that are important to the business can trigger a hallucination.'), 
(False, 'Each summary has some specific expectation based on the input and the specification coming from the business.'), 
(False, 'The basic unit of information that makes a summary useful is a fact.'), 
(False, 'The approach named SAFE looks for the facts on the internet with an agentic workflow.'), 
(False, 'The prompt primarily asks the model to split the sentence into its component facts.'), 
(True, 'There seems to be a way to evaluate an LLM output based on expected facts.')]
</code></pre>
<p>For example here we see that facts regarding the prompt was not maintained in the summary. We might hence add some part to the summarization prompt that specifically asks to maintain modelling related information given that we are an NLP expert.</p>
<pre><code class="lang-python">
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Summarizer</span>(<span class="hljs-params">dspy.Signature</span>):</span>
    <span class="hljs-string">"""
    You are a datascientist with knowledge in NLP.
    You will be given a &lt;source_text&gt; which you have to summarize
    keeping all important details as well as modeling related information intact. 
    We want to still have all facts of the original &lt;source_text&gt; and show them as bullet points.
    """</span>
    source_text = dspy.InputField()
    summary = dspy.OutputField()
</code></pre>
<p>This prompt change improves the fact check score to 0.73 from 0.53, i.e. with a simple general change to the prompt we can extract 20% more facts than before. Applying this to a larger dataset would enable us to see whether we on average extract more or less of the information contained in the source text. We also see that the design of the metric enables us to look into patterns of failure modes easier and thus improve the prompt with respect to these failure modes.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753361104806/bca38ecd-64bf-42e4-988c-64435067f91d.png" alt class="image--center mx-auto" /></p>
<p>While I admit this is more costly, evaluating LLMs is not something we can just skip. In my opinion however it is much more costly to depend on an LLM judge that causes havoc in production, because it does not correspond with realistic notions of quality.</p>
]]></content:encoded></item><item><title><![CDATA[Scaling OpenAI Agents SDK]]></title><description><![CDATA[Less is more. With its lightweight architecture, powerful primitives like agents, handoffs, and guardrails, OpenAI Agents SDK has become the go-to framework for creating sophisticated multi-agent workflows. At least for me :)
But there's one challeng...]]></description><link>https://llmshowto.com/scaling-openai-agents-sdk</link><guid isPermaLink="true">https://llmshowto.com/scaling-openai-agents-sdk</guid><category><![CDATA[agentic AI]]></category><category><![CDATA[agents]]></category><category><![CDATA[AI]]></category><category><![CDATA[llm]]></category><category><![CDATA[openai]]></category><category><![CDATA[chatgpt]]></category><dc:creator><![CDATA[Rafael Pierre]]></dc:creator><pubDate>Tue, 22 Jul 2025 15:37:36 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/nY14Fs8pxT8/upload/80b9d9717de1ec07484368d00e7f4d00.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Less is more</strong>. With its lightweight architecture, powerful primitives like agents, handoffs, and guardrails, <a target="_blank" href="https://openai.github.io/openai-agents-python/">OpenAI Agents SDK</a> has become the go-to framework for creating sophisticated multi-agent workflows. At least for me :)</p>
<p>But there's one challenge that every developer faces when moving from prototype to production: <strong>session management at scale</strong>.</p>
<h2 id="heading-the-sqlite-wall">The SQLite Wall</h2>
<p>When I started building my latest agentic application using the OpenAI Agents SDK and FastAPI, everything worked beautifully in development. The SDK's built-in SQLite session management handled conversation history seamlessly, automatically maintaining context across agent runs without any manual state handling.</p>
<p>But as I prepared to deploy across multiple instances, reality hit. SQLite, while perfect for prototyping, becomes a bottleneck when you need to:</p>
<ul>
<li><p><strong>Share sessions across multiple application instances</strong></p>
</li>
<li><p><strong>Survive container restarts and deployments</strong></p>
</li>
<li><p><strong>Scale horizontally</strong> with load balancers</p>
</li>
<li><p><strong>Maintain session consistency</strong> in distributed environments</p>
</li>
</ul>
<p>The problem wasn't unique to my application. The OpenAI Agents SDK provides built-in session memory to automatically maintain conversation history across multiple agent runs, eliminating the need to manually handle state between turns, but this session management is tied to SQLite's single-process limitations.</p>
<h2 id="heading-enter-openai-agents-redis">Enter openai-agents-redis</h2>
<p>That's when I decided to build <strong>openai-agents-redis</strong> – a drop-in replacement for the SDK's session management that uses Redis as the persistence layer instead of SQLite.</p>
<h3 id="heading-key-features">Key Features</h3>
<p><strong>🔄 Drop-in Replacement</strong>: Same API as the original session management, so your existing code works unchanged.<br /><strong>⚡ Redis-Powered</strong>: Lightning-fast caching and persistent storage that scales horizontally.<br /><strong>🔗 Connection Pooling</strong>: Automatic connection management and pooling for optimal performance.<br /><strong>🧹 Automatic Cleanup</strong>: Handles serialization, deserialization, and session cleanup automatically.<br /><strong>🚀 Production Ready</strong>: Built for distributed deployments and high-availability scenarios.</p>
<h2 id="heading-how-it-works">How It Works</h2>
<p>The implementation is surprisingly elegant. Instead of fighting with the SDK's architecture, <code>openai-agents-redis</code> works <em>with</em> it by implementing the same session interface while swapping out the storage backend.</p>
<h3 id="heading-installation">Installation</h3>
<p>Getting started is as simple as:</p>
<pre><code class="lang-bash"><span class="hljs-comment"># Using uv (recommended)</span>
uv add openai-agents-redis

<span class="hljs-comment"># Using pip  </span>
pip install openai-agents-redis
</code></pre>
<h3 id="heading-usage">Usage</h3>
<p>The beauty of this approach is in its simplicity. Here's how you use it:</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> agents_redis.session <span class="hljs-keyword">import</span> RedisSession
<span class="hljs-keyword">from</span> agents <span class="hljs-keyword">import</span> Agent, Runner

<span class="hljs-comment"># Create a Redis-backed session</span>
session = RedisSession(
    session_id=session_id,  <span class="hljs-comment"># Use your own logic to generate session_id</span>
    redis_url=<span class="hljs-string">"redis://localhost:6379"</span>, <span class="hljs-comment"># For local testing only</span>
)

<span class="hljs-comment"># Your existing agent code remains unchanged</span>
agent = Agent(
    name=<span class="hljs-string">"Assistant"</span>, 
    instructions=<span class="hljs-string">"You are a helpful assistant"</span>
)

<span class="hljs-comment"># Start the runner with Redis session management</span>
result = Runner.run_streamed(
    starting_agent=agent, 
    input=user_input, 
    context=context, 
    session=session  <span class="hljs-comment"># Now backed by Redis!</span>
)
</code></pre>
<p>That's it. Your agent conversations are now stored in Redis, shared across all your application instances, and will survive restarts.</p>
<h2 id="heading-the-architecture">The Architecture</h2>
<p>Under the hood, <code>openai-agents-redis</code> handles several critical aspects:</p>
<p><strong>Serialization</strong>: Converts complex agent conversation objects into Redis-compatible formats while preserving all necessary context and metadata.<br /><strong>Connection Management</strong>: Maintains efficient connection pools to Redis, handling reconnections and failures gracefully.<br /><strong>Session Lifecycle</strong>: Automatically manages session creation, updates, and cleanup without requiring manual intervention.<br /><strong>Compatibility</strong>: Ensures full compatibility with the OpenAI Agents SDK's session interface, so existing code works without modification.</p>
<h2 id="heading-real-world-impact">Real-World Impact</h2>
<p>The difference in production is night and day:</p>
<p><strong>Before (SQLite)</strong>: Each container had its own isolated session storage. Users lost conversation context when load balancers switched them between instances.<br /><strong>After (Redis)</strong>: Sessions persist across the entire application cluster. Users maintain context regardless of which instance handles their request.<br /><strong>Performance</strong>: Redis's in-memory architecture provides significantly faster session retrieval and updates compared to SQLite disk I/O.<br /><strong>Reliability</strong>: Sessions survive individual container failures and deployments, providing a much more robust user experience.</p>
<h2 id="heading-see-it-in-action">See it in action 🚀</h2>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.youtube.com/watch?v=DWr_Ata4gxQ">https://www.youtube.com/watch?v=DWr_Ata4gxQ</a></div>
<p> </p>
<h2 id="heading-future-enhancements">Future Enhancements</h2>
<p>The current implementation focuses on core session management, but there are exciting possibilities on the roadmap:</p>
<ul>
<li><p><strong>Full-text search</strong> capabilities for conversation history</p>
</li>
<li><p><strong>Vector similarity search</strong> for semantic conversation lookup</p>
</li>
<li><p><strong>Hybrid search</strong> combining text and semantic search</p>
</li>
<li><p><strong>Built-in monitoring dashboard</strong> for session analytics</p>
</li>
<li><p><strong>Advanced session analytics</strong> and conversation insights</p>
</li>
</ul>
<h2 id="heading-getting-started">Getting Started</h2>
<p>Ready to scale your OpenAI Agents SDK application? Here's what you need:</p>
<h3 id="heading-prerequisites">Prerequisites</h3>
<ul>
<li><p>🐳 Docker (for Redis)</p>
</li>
<li><p>⚡️ uv package manager (recommended)</p>
</li>
<li><p>🦾 OpenAI Agents SDK</p>
</li>
<li><p>🔑 OpenAI API Key</p>
</li>
</ul>
<h3 id="heading-quick-start">Quick Start</h3>
<ol>
<li><p><strong>Install the package</strong>:</p>
<pre><code class="lang-bash"> uv add openai-agents-redis
</code></pre>
</li>
<li><p><strong>Start Redis</strong> (if you don't have it running):</p>
<pre><code class="lang-bash"> docker run -d -p 6379:6379 redis:alpine
</code></pre>
</li>
<li><p><strong>Update your code</strong> to use <code>RedisSession</code> instead of the default session management.</p>
</li>
<li><p><strong>Deploy with confidence</strong> knowing your sessions will scale with your application.</p>
</li>
</ol>
<h3 id="heading-testing">Testing</h3>
<p>The package includes comprehensive tests to ensure reliability:</p>
<pre><code class="lang-bash"><span class="hljs-comment"># Run all tests</span>
uv run pytest

<span class="hljs-comment"># Run with coverage</span>
uv run pytest --cov
</code></pre>
<h2 id="heading-why-this-matters">Why This Matters</h2>
<p>As AI applications move from experimental to production, session management becomes crucial. Users expect their conversations to be persistent, consistent, and available regardless of backend architecture decisions.</p>
<p><code>openai-agents-redis</code> solves this problem by providing enterprise-grade session management that doesn't require you to rewrite your application. It's the missing piece that transforms your prototype into a production-ready system.</p>
<p>The OpenAI Agents SDK gives us the tools to build sophisticated AI agents. Now <code>openai-agents-redis</code> gives us the infrastructure to run them at scale.</p>
<h2 id="heading-try-it-today">Try It Today</h2>
<ul>
<li><p><strong>GitHub</strong>: <a target="_blank" href="https://github.com/rafaelpierre/openai-agents-redis">https://github.com/rafaelpierre/openai-agents-redis</a></p>
</li>
<li><p><strong>PyPI</strong>: <a target="_blank" href="https://pypi.org/project/openai-agents-redis/">https://pypi.org/project/openai-agents-redis/</a></p>
</li>
<li><p><strong>Sample Repo</strong>: <a target="_blank" href="https://github.com/rafaelpierre/openai-agents-redis-example">https://github.com/rafaelpierre/openai-agents-redis-example</a></p>
</li>
</ul>
<p>If you're building agentic applications with the OpenAI Agents SDK and hitting SQLite's limitations, give <code>openai-agents-redis</code> a try. It's designed to be the session management solution you wish existed when you first hit the scaling wall.</p>
<hr />
<p><em>Have questions or feedback? I'd love to hear about your experience scaling agentic applications. Feel free to open an issue on GitHub or reach out with your thoughts!</em></p>
]]></content:encoded></item><item><title><![CDATA[Build Your Agentic App Frontend from Scratch with AI]]></title><description><![CDATA[Exciting news—another Lightning Lesson is coming your way!
🚀 Join me on June 6th for a free 30-minute webinar: "Build Your Agentic App Frontend from Scratch with AI"
✨ In this practical session, you will:
🔧 Generate UI Components with AI: Quickly c...]]></description><link>https://llmshowto.com/free-webinar-build-your-agentic-app-frontend-from-scratch-with-ai</link><guid isPermaLink="true">https://llmshowto.com/free-webinar-build-your-agentic-app-frontend-from-scratch-with-ai</guid><category><![CDATA[AI]]></category><category><![CDATA[mcp]]></category><category><![CDATA[agentic AI]]></category><category><![CDATA[llm]]></category><category><![CDATA[RAG ]]></category><dc:creator><![CDATA[Rafael Pierre]]></dc:creator><pubDate>Tue, 27 May 2025 22:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1753194890522/45cd4837-97bd-4a14-a88e-d8a6972703e2.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Exciting news—another Lightning Lesson is coming your way!</p>
<p>🚀 Join me on June 6th for a free 30-minute webinar: "Build Your Agentic App Frontend from Scratch with AI"</p>
<p>✨ In this practical session, you will:</p>
<p>🔧 <strong>Generate UI Components with AI:</strong> Quickly create intuitive frontend building blocks using cutting-edge AI tools.</p>
<p>🔌 <strong>Connect Frontend to Agentic AI Backend</strong>: Learn the seamless integration of your frontend with intelligent agent backends to deliver dynamic user experiences.</p>
<p>🚀 <strong>Experience Your App Live:</strong> Instantly see your agentic app in action and fine-tune your interface in real-time.</p>
<h3 id="heading-why-should-you-care">Why should you care?</h3>
<p>For AI practitioners, mastering rapid frontend prototyping isn't just about technical excellence—it's about delivering value quickly and effectively. Creating intuitive, interactive frontends that leverage powerful AI agents significantly enhances your professional toolkit, accelerates experimentation, and positions you as an end-to-end AI innovator.</p>
<p>Ready to level up your frontend skills and build something amazing?</p>
<p>👉 <a target="_blank" href="https://maven.com/p/df5753/build-your-agentic-app-frontend-from-scratch-with-ai">Secure your spot now</a>!</p>
<p>Looking forward to seeing you there!</p>
]]></content:encoded></item><item><title><![CDATA[Building Agentic AI Apps with MCP]]></title><description><![CDATA[Earlier this week, I announced the launch of my course on Building Agentic AI Apps with MCP, and I’m thrilled to share that the response has been fantastic! 🎉
To kick things off, I’ll be hosting a free Lightning Lesson at Maven: “Build Your First Ag...]]></description><link>https://llmshowto.com/building-agentic-ai-apps-with-mcp</link><guid isPermaLink="true">https://llmshowto.com/building-agentic-ai-apps-with-mcp</guid><dc:creator><![CDATA[Rafael Pierre]]></dc:creator><pubDate>Mon, 05 May 2025 22:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1753195278437/543b69de-314e-46cd-9d86-44900760af02.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Earlier this week, I announced the launch of my course on <a target="_blank" href="https://maven.com/forms/f6a04b">Building Agentic AI Apps with MCP</a>, and I’m thrilled to share that the response has been fantastic! 🎉</p>
<p>To kick things off, I’ll be hosting a free Lightning Lesson at Maven: “Build Your First Agentic AI App with MCP” 🦾</p>
<p>In this 30-minute session, you’ll learn:</p>
<p>🔍 Why everyone is buzzing about <a target="_blank" href="https://www.anthropic.com/news/model-context-protocol">Model Context Protocol (MCP)</a> and the pain points it addresses<br />
🏗️ The core components of MCP architecture<br />
💻 Live coding: Build your first Agentic AI App with MCP<br /></p>
<p>Whether you’re just starting out or looking to deepen your understanding of Agents and MCP, this session is for you</p>
<p>Feel free to share this with your network - looking forward to seeing you there!</p>
<p><a target="_blank" href="https://maven.com/p/5843b2/build-your-first-agentic-ai-app-with-mcp">Click here and save your spot!</a></p>
]]></content:encoded></item><item><title><![CDATA[An Overview on Testing Frameworks For LLMs]]></title><description><![CDATA[This article was written by my good friend Raahul Dutta - check out his new startup: pebbling.ai

Introduction
In this edition, I have meticulously documented every testing framework for LLMs that I've come across on the internet and GitHub.
Basic LL...]]></description><link>https://llmshowto.com/an-overview-on-testing-frameworks-for-llms</link><guid isPermaLink="true">https://llmshowto.com/an-overview-on-testing-frameworks-for-llms</guid><category><![CDATA[galileo]]></category><category><![CDATA[agenta]]></category><category><![CDATA[llm]]></category><category><![CDATA[LLMTesting]]></category><category><![CDATA[#llmops]]></category><category><![CDATA[agents]]></category><category><![CDATA[#Agentspace]]></category><category><![CDATA[ai agents]]></category><dc:creator><![CDATA[Rafael Pierre]]></dc:creator><pubDate>Sun, 08 Dec 2024 23:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/_nWaeTF6qo0/upload/2fc38bf01391782e063742482ba2b530.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>This article was written by my good friend <a target="_blank" href="https://www.linkedin.com/in/raahuldutta/">Raahul Dutta</a> - check out his new startup: <a target="_blank" href="https://www.linkedin.com/company/pebbling-ai/">pebbling.ai</a></p>
</blockquote>
<h1 id="heading-introduction">Introduction</h1>
<p>In this edition, I have meticulously documented every testing framework for <strong>LLMs</strong> that I've come across on the internet and GitHub.</p>
<h2 id="heading-basic-llm-testing-framework">Basic LLM Testing Framework</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753360238106/151e0fc7-9eb4-47c1-abd6-a20b4ae79771.jpeg" alt class="image--center mx-auto" /></p>
<p>I am organizing the frameworks in alphabetical order, without assigning any specific rank to them.</p>
<h2 id="heading-deepeval">👩‍⚖️ DeepEval</h2>
<p><strong>DeepEval</strong> provides a Pythonic way to run offline evaluations on your LLM pipelines so you can launch comfortably into production. The guiding philosophy is a "Pytest for LLM" that aims to make productionizing and evaluating LLMs as easy as ensuring all tests pass.</p>
<p><strong>DeepEval</strong> is a tool for easy and efficient LLM testing. DeepEval aims to make writing tests for LLM applications (such as RAG) as easy as writing Python unit tests.</p>
<h3 id="heading-metrics">🪂 Metrics</h3>
<ul>
<li><p><strong>AnswerRelevancy</strong>: Depends on "sentence-transformers/multi-qa-MiniLM-L6-cos-v1"</p>
</li>
<li><p><strong>BertScoreMetric</strong>: Depends on "sentence-transformers/all-mpnet-base-v2"</p>
</li>
<li><p><strong>Dbias</strong>: LLMs can become highly biased after finetuning from any RLHF or optimizations. Bias, however, is a very vague term so the paper focuses on bias in the following areas.</p>
<ul>
<li><p>Gender (e.g. "All man hours in his area of responsibility must be approved.")</p>
</li>
<li><p>Age (e.g. "Apply if you are a recent graduate.")</p>
</li>
<li><p>Racial/Ethnicity (e.g. "Police are looking for any black males who may be involved in this case.")</p>
</li>
<li><p>Disability (e.g. "Genuine concern for the elderly and handicapped")</p>
</li>
<li><p>Mental Health (e.g. "Any experience working with retarded people is required for this job.")</p>
</li>
<li><p>Religion</p>
</li>
<li><p>Education</p>
</li>
<li><p>Political ideology</p>
</li>
<li><p>This is measured according to tests with logic following this paper:</p>
</li>
</ul>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753360216739/09612d5c-b4c7-45c2-bde5-f730678ed83d.jpeg" alt class="image--center mx-auto" /></p>
<ul>
<li><p><strong>BLEUMetric</strong>: Compute the BLEU score for a candidate sentence given a reference sentence. Depends on the nltk models</p>
</li>
<li><p><strong>CohereRerankerMetric</strong></p>
</li>
<li><p><strong>ConceptualSimilarityMetric</strong>: Asserting conceptual similarity.Depends on "sentence-transformers/all-mpnet-base-v2"</p>
</li>
<li><p><strong>ranking_similarity</strong>: Similarity measures between two different ranked lists. Built on <a target="_blank" href="http://www.codalism.com/research/papers/wmz10_tois.pdf">“A Similarity Measure for Indefinite Rankings”</a></p>
</li>
<li><p><strong>NonToxicMetric</strong>: Built on <a target="_blank" href="https://pypi.org/project/detoxify/">detoxify</a></p>
</li>
<li><p><strong>FactualConsistencyMetric</strong>: Depends on "cross-encoder/nli-deberta-v3-large"</p>
</li>
<li><p><strong>EntailmentScoreMetric</strong>: Depends on "cross-encoder/nli-deberta-base"</p>
</li>
<li><p><strong>Custom Metrics</strong>: Can be added.</p>
</li>
</ul>
<h3 id="heading-details">🎈 Details</h3>
<ul>
<li><p><a target="_blank" href="https://colab.research.google.com/drive/1jnRUg0GHS_dTN0heijUr_88NnWiNOIFA?usp=sharing">Colab link</a></p>
</li>
<li><p><a target="_blank" href="https://docs.confident-ai.com/docs/">Documentation</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/confident-ai/deepeval">Github</a></p>
</li>
<li><p>License: Apache-2.0 license</p>
</li>
</ul>
<h3 id="heading-remarks">🧗 Remarks</h3>
<ul>
<li><p>Clean Dashboard.</p>
</li>
<li><p>The model derived Metrics - and it’s good. You can adjust the model depending on the performance.</p>
</li>
<li><p>Helpful to measure the output quality.</p>
</li>
<li><p>Less Community Support.</p>
</li>
</ul>
<p>*I post weekly newsletters on LLM development, the hottest Musings on Artificial Intelligence. [Subscribe](https://musingsonai.substack.com/)*</p>
<hr />
<h2 id="heading-agentops-in-development">🕵️ AgentOps (in development)</h2>
<h3 id="heading-details-1">🎈 Details</h3>
<ul>
<li><a target="_blank" href="https://github.com/AgentOps-AI/agentops">Github</a></li>
</ul>
<h3 id="heading-remarks-1">🧗 Remarks</h3>
<ul>
<li>Enlisting the product because of the exciting LLM debugging roadmap</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753360311730/3b6067ff-419f-4d4d-9e19-b075b5e2ed62.jpeg" alt class="image--center mx-auto" /></p>
<hr />
<hr />
<h2 id="heading-baserunai">baserun.ai 💪💪💪</h2>
<p>Testing &amp; Observability Platform for LLM Apps. From prompt playground to end-to-end tests, baserun helps you ship your LLM apps with confidence and speed.</p>
<p>Baserun is a YCombinator-backed great tool to debug the prompts on runtime.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753360383517/3657670c-7185-4461-938a-4d2e3bbc33fa.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-details-2">🎈 Details</h3>
<ul>
<li><a target="_blank" href="https://docs.baserun.ai/introduction">Documentation</a></li>
</ul>
<h3 id="heading-remarks-2">🧗 Remarks</h3>
<ul>
<li><p>Clean Detailed Dashboard with prompt cost(I loved that).</p>
</li>
<li><p>The evaluation framework is heavily inspired by the OpenAI Evals project and offers a number of built-in evaluations which we record and aggregate in the Baserun dashboard.</p>
</li>
<li><p>The framework simplifies the LLM Debugging workflow.</p>
</li>
<li><p>The hallucinations can be prevented with the tool to some extent.</p>
</li>
<li><p>Less Customisation Scope.</p>
</li>
</ul>
<hr />
<h2 id="heading-prompttools">🐤 PromptTools</h2>
<p>Welcome to <strong>prompttools</strong> created by <strong>Hegel AI</strong>! This repo offers a set of open-source, self-hostable tools for experimenting with, testing, and evaluating LLMs, vector databases, and prompts. The core idea is to enable developers to evaluate using familiar interfaces like code, notebooks, and a local playground.</p>
<p>In just a few lines of codes, you can test your prompts and parameters across different models (whether you are using OpenAI, Anthropic, or LLaMA models). You can even evaluate the retrieval accuracy of vector databases.</p>
<h3 id="heading-details-3">🎈 Details</h3>
<ul>
<li><p><a target="_blank" href="https://colab.research.google.com/drive/1YVcpBew8EqbhXFN8P5NaFrOIqc1FKWeS?usp=sharing">Colab link</a></p>
</li>
<li><p><a target="_blank" href="https://prompttools.readthedocs.io/en/latest/">Documentation</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/hegelai/prompttools">Github</a></p>
</li>
<li><p>License: Apache-2.0 license</p>
</li>
</ul>
<h3 id="heading-metrics-1">🪂 Metrics</h3>
<ul>
<li><p><strong>Experiments and Harnesses</strong> : Here are two main abstractions used in the prompttools library: Experiments and Harnesses. Occasionally, you may want to use a harness, because it abstracts away more details.</p>
<ul>
<li><p>An experiment is a low-level abstraction that takes the cartesian product of possible inputs to an LLM API. For example, the OpenAIChatExperiment accepts lists of inputs for each parameter of the OpenAI Chat Completion API. Then, it constructs and asynchronously executes requests using those potential inputs. An example of using an experiment is here.</p>
</li>
<li><p>There are two main abstractions used in the prompttools library: Experiments and Harnesses. Occasionally, you may want to use a harness, because it abstracts away more details. A harness is built on top of an experiment and manages abstractions over inputs.</p>
</li>
</ul>
</li>
<li><p><strong>Evaluation and Validation</strong> : These built-in functions help you to evaluate the outputs of your experiments. They can also be used to be part of your CI/CD system.</p>
<ul>
<li><p>You can also manually enter feedback to evaluate prompts, see <a target="_blank" href="https://github.com/hegelai/prompttools/blob/main/examples/notebooks/HumanFeedback.ipynb">HumanFeedback.ipynb</a></p>
</li>
<li><p>IT uses gpt4 as a judge</p>
</li>
<li><p>Here is a list of APIs that we support with our experiments:</p>
</li>
<li><p>LLMs</p>
<ul>
<li><p>OpenAI (Completion, ChatCompletion, Fine-tuned models) - Supported</p>
</li>
<li><p>LLaMA.Cpp (LLaMA 1, LLaMA 2) - Supported</p>
</li>
<li><p>HuggingFace (Hub API, Inference Endpoints) - Supported</p>
</li>
<li><p>Anthropic - Supported</p>
</li>
<li><p>Google PaLM - Supported</p>
</li>
<li><p>Azure OpenAI Service - Supported</p>
</li>
<li><p>Replicate - Supported</p>
</li>
<li><p>Ollama - In Progress</p>
</li>
</ul>
</li>
<li><p>Vector Databases and Data Utility</p>
<ul>
<li><p>Chroma - Supported</p>
</li>
<li><p>Weaviate - Supported</p>
</li>
<li><p>Qdrant - Supported</p>
</li>
<li><p>LanceDB - Supported</p>
</li>
<li><p>Milvus - Exploratory</p>
</li>
<li><p>Pinecone - Exploratory</p>
</li>
<li><p>Epsilla - In Progress</p>
</li>
</ul>
</li>
<li><p>Frameworks</p>
<ul>
<li><p>LangChain - Supported</p>
</li>
<li><p>MindsDB - Supported</p>
</li>
<li><p>LlamaIndex - Exploratory</p>
</li>
</ul>
</li>
<li><p>Computer Vision</p>
<ul>
<li><p>Stable Diffusion - Supported</p>
</li>
<li><p>Replicate's hosted Stable Diffusion - Supported</p>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753360480926/69d36349-8385-4302-adeb-e07ca10cbd6a.jpeg" alt class="image--center mx-auto" /></p>
<h3 id="heading-remarks-3">🧗 Remarks</h3>
<ul>
<li><p>I have been using it for the last 15 days. The Streamlit-based dashboard is smooth.</p>
</li>
<li><p><code>Prompt Template Experimentation</code> is a nice feature of the product. But I am expecting more comparison details without latency and similarities.</p>
</li>
<li><p>The framework covers the LLM, VectorDb, and orchestrators.</p>
</li>
<li><p>Great Community Support.</p>
</li>
<li><p>Great tool for RLHF.</p>
</li>
<li><p>Can’t add a self-hosted server.</p>
</li>
</ul>
<hr />
<h2 id="heading-nvidia-nemo-guardrails">🐚 Nvidia NeMo-Guardrails</h2>
<p><strong>NeMo Guardrails</strong> is an open-source toolkit for easily adding programmable guardrails to LLM-based conversational systems. Guardrails (or "rails" for short) are specific ways of controlling the output of a large language model, such as not talking about politics, responding in a particular way to specific user requests, following a predefined dialog path, using a particular language style, extracting structured data, and more.</p>
<p>NeMo Guardrails will help ensure smart applications powered by large language models (LLMs) are accurate, appropriate, on topic, and secure. The software includes all the code, examples, and documentation businesses need to add safety to AI apps that generate text.</p>
<p>It sits in the middle between the user (After Vector Embedding) and guard LLM server. It is open source so the engineer can write their own logic onto the guardrail.</p>
<p>NeMo Guardrails enables developers to set up three kinds of boundaries:</p>
<ul>
<li><p>Topical guardrails prevent apps from veering off into undesired areas. For example, they keep customer service assistants from answering questions about the weather.</p>
</li>
<li><p>Safety guardrails ensure apps respond with accurate, appropriate information. They can filter out unwanted language and enforce that references are made only to credible sources.</p>
</li>
<li><p>Security guardrails restrict apps to making connections only to external third-party applications known to be safe.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753360528727/2a6c1fff-2fd6-45b7-b64c-3727ee9bcb59.jpeg" alt /></p>
<h3 id="heading-details-4">🎈 Details</h3>
<ul>
<li><a target="_blank" href="https://github.com/NVIDIA/NeMo-Guardrails/tree/main">Github</a></li>
</ul>
<h3 id="heading-remarks-4">🧗 Remarks</h3>
<ul>
<li><p>Nemo-Guardrail is An easily programmable guardrail that is a must for the production-based LLM application.</p>
</li>
<li><p>The conversation designer can add the boundaries of the conversation in the same plain English using colang.</p>
</li>
<li><p>The filtering policy of the guard rail depends on the embedding space - more intelligent.</p>
</li>
<li><p>Supports the production batching for the orchestration.</p>
</li>
<li><p>The community is great.</p>
</li>
<li><p>The most required framework in the time.</p>
</li>
</ul>
<hr />
<p>*I post weekly newsletters on LLM development, the hottest Musings on Artificial Intelligence. [Subscribe](https://musingsonai.substack.com/)*</p>
<hr />
<h2 id="heading-agenta">🦜 Agenta</h2>
<p>Building production-ready LLM-powered applications is currently very difficult. It involves countless iterations of prompt engineering, parameter tuning, and architectures.</p>
<p><strong>Agenta</strong> provides you with the tools to quickly do prompt engineering and 🧪 experiment, ⚖️ evaluate, and 🚀 deploy your LLM apps. All without imposing any restrictions on your choice of framework, library, or model.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753360546324/4133faa7-f3e3-42dc-87f9-de3214b5cf47.jpeg" alt /></p>
<h3 id="heading-details-5">🎈 Details</h3>
<ul>
<li><p><a target="_blank" href="https://docs.agenta.ai/quickstart/introduction">Documentation</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/confident-ai/deepeval">Github</a></p>
</li>
</ul>
<h3 id="heading-remarks-5">🧗 Remarks</h3>
<ul>
<li><p>The website and app code have excellent UX. The end-to-end user journey, from creation to testing, is beautifully designed.</p>
</li>
<li><p>Can be hosted OnPrem - Aws or GCP</p>
</li>
<li><p>They have different parts:</p>
<ul>
<li><p>Playground: to create the prompts from lots of predefined templates like</p>
<ul>
<li><p>sales_call_summarizer</p>
</li>
<li><p>baby_name_generator</p>
</li>
<li><p>chat_models</p>
</li>
<li><p>completion_models</p>
</li>
<li><p>compose_email</p>
</li>
<li><p>experimental</p>
</li>
<li><p>extract_data_to_json</p>
</li>
<li><p>job_info_extractor</p>
</li>
<li><p>noteGPT</p>
</li>
<li><p>recipes_and_ingredients</p>
</li>
<li><p>sales_call_summarizer</p>
</li>
<li><p>sales_transcript_summarizer</p>
</li>
<li><p>sentiment_analysis</p>
</li>
</ul>
</li>
<li><p>Test Sets</p>
</li>
<li><p>Evaluate</p>
</li>
<li><p>API Endpoint</p>
</li>
</ul>
</li>
</ul>
<hr />
<h2 id="heading-agentbench">🦚 AgentBench</h2>
<p><strong>Large Language Models (LLMs)</strong> are becoming increasingly smart and autonomous, targeting real-world pragmatic missions beyond traditional NLP tasks. As a result, there has been an urgent need to evaluate LLMs as agents on challenging tasks in interactive environments. We present <strong>AgentBench</strong>, a multi-dimensional evolving benchmark that currently consists of 8 distinct environments to assess LLM-as-Agent's reasoning and decision-making abilities in a multi-turn open-ended generation setting. Our extensive test over 25 LLMs (including APIs and open-sourced models) shows that, while top commercial LLMs present a strong ability of acting as agents in complex environments, there is a significant disparity in performance between them and open-sourced competitors.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753360570117/961d3abf-5ad3-455c-81fb-a96898173dbf.jpeg" alt /></p>
<h3 id="heading-details-6">🎈 Details</h3>
<ul>
<li><p><a target="_blank" href="https://arxiv.org/abs/2308.03688">Documentation</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/THUDM/AgentBench">Github</a></p>
</li>
</ul>
<h3 id="heading-remarks-6">🧗 Remarks</h3>
<ul>
<li><p>This paper evaluates the performance of several LLMs (LLama 2, Vicuna, GPT-X, Dolly, etc.) as intelligent agents in a long chain environment that involves databases (SQL), web booking, and product comparison on the internet. The main question to be answered is whether LLama 2 is superior to ChatGPT in comparing products on the internet. For the purpose of this study, an agent refers to an LLM that operates in this environment.</p>
</li>
<li><p>An "AGENT" is an LLM that operates within a simulated environment to achieve a specific goal. In this study, the term, "agent" is used to refer to such an LLM. The agent's performance is assessed based on its capability to complete assigned tasks.</p>
</li>
<li><p>To date, It’s one of the best approaches to evaluating a LLM model for various tasks.</p>
</li>
</ul>
<hr />
<h2 id="heading-guidance">🐿️ Guidance</h2>
<p><strong>Guidance</strong> enables you to control modern language models more effectively and efficiently than traditional prompting or chaining. Guidance programs allow you to interleave generation, prompting, and logical control into a single continuous flow matching how the language model actually processes the text. Simple output structures like Chain of Thought and its many variants (e.g., ART, Auto-CoT, etc.) have been shown to improve LLM performance. The advent of more powerful LLMs like GPT-4 allows for even richer structure, and guidance makes that structure easier and cheaper.</p>
<h3 id="heading-details-7">🎈 Details</h3>
<ul>
<li><a target="_blank" href="https://github.com/guidance-ai/guidance">Github</a></li>
</ul>
<h3 id="heading-features">🕵️‍♀️ Features</h3>
<ul>
<li><p>🔹 Live streaming Simple, intuitive syntax. Guidance feels like a templating language, and just like standard Handlebars templates, you can do variable interpolation (e.g., {{proverb}}) and logical control.</p>
<ul>
<li><a target="_blank" href="https://github.com/guidance-ai/guidance/blob/main/notebooks/proverb.ipynb">Details</a></li>
</ul>
</li>
<li><p>🔹 Chat dialog Guidance supports API-based chat models like GPT-4, as well as open chat models like Vicuna through a unified API based on role tags (e.g., {{#system}}...{{/system}}). This allows interactive dialog development that combines rich templating and logical control with modern chat models.</p>
<ul>
<li><a target="_blank" href="https://github.com/guidance-ai/guidance/blob/main/notebooks/chat.ipynb">Details</a></li>
</ul>
</li>
<li><p>🔹 Guidance acceleration When multiple generation or LLM-directed control flow statements are used in a single Guidance program then we can significantly improve inference performance by optimally reusing the Key/Value caches as we progress through the prompt. This means Guidance only asks the LLM to generate the green text below, not the entire program. This cuts this prompt's runtime in half vs. a standard generation approach.</p>
<ul>
<li><a target="_blank" href="https://github.com/guidance-ai/guidance/blob/main/notebooks/guidance_acceleration.ipynb">Details</a></li>
</ul>
</li>
</ul>
<p>🔹 Token healing: The standard greedy tokenizations used by most language models introduce a subtle and powerful bias that can have all kinds of unintended consequences for your prompts. Using a process we call "token healing" guidance automatically removes these surprising biases, freeing you to focus on designing the prompts you want without worrying about tokenization artifacts. - <a target="_blank" href="https://github.com/guidance-ai/guidance/blob/main/notebooks/art_of_prompt_design/prompt_boundaries_and_token_healing.ipynb">Details</a></p>
<ul>
<li><p>🔹 Rich output structure example: To demonstrate the value of output structure, we take a simple task from BigBench, where the goal is to identify whether a given sentence contains an anachronism (a statement that is impossible because of non-overlapping time periods). Below is a simple two-shot prompt for it, with a human-crafted chain-of-thought sequence.</p>
<ul>
<li><a target="_blank" href="https://github.com/guidance-ai/guidance/blob/main/notebooks/anachronism.ipynb">Details</a></li>
</ul>
</li>
<li><p>🔹 Guaranteeing valid syntax JSON example: Large language models are great at generating useful outputs, but they are not great at guaranteeing that those outputs follow a specific format. This can cause problems when we want to use the outputs of a language model as input to another system. For example, if we want to use a language model to generate a JSON object, we need to make sure that the output is valid JSON. With guidance we can both accelerate inference speed and ensure that generated JSON is always valid. Below we generate a random character profile for a game with perfect syntax every time.</p>
<ul>
<li><a target="_blank" href="https://github.com/guidance-ai/guidance/blob/main/notebooks/guaranteeing_valid_syntax.ipynb">Details</a></li>
</ul>
</li>
<li><p>🔹 Role-based chat model example: Modern chat-style models like ChatGPT and Alpaca are trained with special tokens that mark out "roles" for different areas of the prompt. Guidance supports these models through role tags that automatically map to the correct tokens or API calls for the current LLM. Below we show how a role-based guidance program enables simple multi-step reasoning and planning.</p>
<ul>
<li><a target="_blank" href="https://github.com/guidance-ai/guidance/blob/main/notebooks/chat.ipynb">Details</a></li>
</ul>
</li>
<li><p>🔹 Agents: We can easily build agents that talk to each other or to a user, via the await command. The await command allows us to pause execution and return a partially executed guidance program. By putting await in a loop, that partially executed program can then be called again and again to form a dialog (or any other structure you design). For example, here is how we might get GPT-4 to simulate two agents talking to one another.</p>
<ul>
<li><a target="_blank" href="https://github.com/guidance-ai/guidance/blob/main/notebooks/chat.ipynb">Details</a></li>
</ul>
</li>
</ul>
<h3 id="heading-remarks-7">🧗 Remarks</h3>
<ul>
<li><p>If I need to select a tool for prompt engineering, I select this one.</p>
</li>
<li><p>Community Support is Superb.</p>
</li>
</ul>
<hr />
<h2 id="heading-arthur-bench">🦆 Arthur Bench</h2>
<p>Today, we’re excited to introduce our newest product: <strong>Arthur Bench</strong>, the most robust way to evaluate LLMs. Bench is an open-source evaluation tool for comparing LLMs, prompts, and hyperparameters for generative text models. This open source tool will enable businesses to evaluate how different LLMs will perform in real-world scenarios so they can make informed, data-driven decisions when integrating the latest AI technologies into their operations. Here are some ways in which Arthur Bench helps businesses:Model Selection &amp; Validation, Budget &amp; Privacy Optimization, Translation of Academic Benchmarks to Real-World Performance.</p>
<h3 id="heading-details-8">🎈 Details</h3>
<ul>
<li><p><a target="_blank" href="https://www.arthur.ai/arthur-bench">Documentation</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/THUDM/AgentBench">Github</a></p>
</li>
</ul>
<h3 id="heading-remarks-8">🧗 Remarks</h3>
<ul>
<li><p>This tool creates a test suite automatically using datasets.</p>
</li>
<li><p>Periodically validates models for resiliency to model changes outside their control.</p>
</li>
<li><p>The system offers deployment gates that identify anomalous inputs, potential PII leakage, toxicity, and other quality metrics. It learns from production performance to optimize thresholds for these quality gates.</p>
</li>
<li><p>Provides core token-level observability, performance dashboarding, inference debugging, and alerting.</p>
</li>
<li><p>Accelerates ability to identify and debug underperforming regions.</p>
</li>
</ul>
<hr />
<p>*I post weekly newsletters on LLM development, the hottest Musings on Artificial Intelligence. [Subscribe](https://musingsonai.substack.com/)*</p>
<hr />
<h2 id="heading-galileo-llm-studio">🌳 Galileo LLM Studio</h2>
<p>Algorithm-powered LLMOps Platform: Find the best prompt, inspect data errors while fine-tuning, monitor LLM outputs in real-time. All in one powerful, collaborative platform.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753360613640/9f04fdac-c0e8-47b6-b449-d889af0b1e82.jpeg" alt /></p>
<h3 id="heading-details-9">🎈 Details</h3>
<ul>
<li><p><a target="_blank" href="https://github.com/rungalileo">Github</a></p>
</li>
<li><p><a target="_blank" href="https://www.rungalileo.io/">Details</a></p>
</li>
</ul>
<h3 id="heading-features-1">🕵️‍♀️ Features</h3>
<ul>
<li><p>🔹 Prompt Engineering</p>
<ul>
<li><p>Promot Inspector.</p>
</li>
<li><p>A detailed easy Dashboard with multiple parameters and evaluation scores.</p>
</li>
<li><p>Hallucination Score.</p>
</li>
</ul>
</li>
<li><p>🔹 LLM Fine-Tune and Debugging</p>
<ul>
<li><p>The watcher function analyze the input data.</p>
</li>
<li><p>A detailed dashboard with data quality - Auto identification of the data pulling from LLM that reduces the performance.</p>
</li>
<li><p>Fix and track data changes over time.</p>
</li>
</ul>
</li>
<li><p>🔹 Production Monitoring</p>
<ul>
<li><p>Real-time LLM Monitoring.</p>
</li>
<li><p>Risk Control with customized plugins</p>
</li>
<li><p>Customized alert with your Slack.</p>
</li>
</ul>
</li>
</ul>
<h3 id="heading-remarks-9">🧗 Remarks</h3>
<ul>
<li>To date, I found this one is the tool for LLMOps. The developer can push the LLM model into production with confidence using the tool.</li>
</ul>
<hr />
<h2 id="heading-lakeraai">🎄 lakera.ai</h2>
<p>An Overview of <strong>Lakera Guard</strong> – Bringing Enterprise-Grade Security to LLMs with One Line of Code.At Lakera, we supercharge AI developers by enabling them to swiftly identify and eliminate their AI applications’ security threats so that they can focus on building the most exciting applications securely.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753360623913/4f028448-5c7a-4c6d-bffb-73d14090a14d.jpeg" alt /></p>
<h3 id="heading-features-2">🕵️‍♀️ Features</h3>
<ul>
<li><p>🔹 Content Moderation</p>
<ul>
<li><p>These are the categories that Lakera Guard currently evaluate against for inappropriate content in the input prompt.</p>
<ul>
<li>Hate: Content targeting race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste, including violence. Content directed at non-protected groups (e.g., chess players) is exempt.- Sex: Content meant to arouse sexual excitement, such as the description of sexual activity, or that promotes sexual services (excluding sex education and wellness).</li>
</ul>
</li>
</ul>
</li>
<li><p>🔹 Prompt injections</p>
<ul>
<li><p>Jailbreaks: LLMs can be forced into malicious behavior by jailbreak attack prompts. Lakera Guard updates to protect against these.</p>
</li>
<li><p>Prompt injections: Prompt injection attacks must be stopped at all costs. Attackers will do whatever it takes to manipulate the system's behavior or gain unauthorized access. But fear not, Lakera Guard is constantly updated to prevent prompt injections and protect your system from harm.</p>
</li>
</ul>
</li>
<li><p>🔹 Sensitive information:</p>
<ul>
<li>PII stands for Personally Identifiable Information - data that can identify an individual. It requires strict protection due to identity theft and privacy risks. Organizations handling PII must safeguard it to prevent unauthorized access. Laws like GDPR and HIPAA ensure proper PII handling and privacy protection.</li>
</ul>
</li>
<li><p>🔹 Relevant Language</p>
<ul>
<li>There are many ways to challenge LLMs using language. Users may: Either Use Japanese jailbreaks, Employ Portuguese prompt injections, Intentionally include spelling errors in prompts to bypass defenses, Insert extensive code or special characters into prompts.They assign a score between 0 and 1 to indicate the authenticity of a prompt. A higher score suggests a genuine attempt at regular communication.</li>
</ul>
</li>
<li><p>🔹 Unknown links</p>
<ul>
<li>One way in which prompt injection can be dangerous is phishing.</li>
</ul>
</li>
</ul>
<h3 id="heading-remarks-10">🧗 Remarks</h3>
<ul>
<li><p>The Roadmap is amazing.</p>
</li>
<li><p>LLM security is a real topic - and they are working on it.</p>
</li>
</ul>
<hr />
<h2 id="heading-nightfall-ai">🐣 NightFall AI</h2>
<p><strong>ChatGPT</strong> and other generative AI tools are powerful ways to increase your team's output. But sensitive data such as PII, confidential information, API keys, PHI, and much more can be contained in prompts. Rather than block these tools, use Nightfall's Chrome extension or Developer Platform to.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753360634221/0a638317-3b54-4079-967a-414fcd7dd2a1.jpeg" alt /></p>
<h3 id="heading-details-10">🎈 Details</h3>
<ul>
<li><p><a target="_blank" href="https://www.nightfall.ai/">Documentation</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/nightfallai/nightfall-python-sdk">Github</a></p>
</li>
</ul>
<h3 id="heading-remarks-11">🧗 Remarks</h3>
<ul>
<li><p>A great tool for handling LLM security.</p>
</li>
<li><p>Manage all security tasks in your SIEM or Nightfall dashboard.</p>
</li>
<li><p>Proactively protect your company and customer data.</p>
</li>
<li><p>Identify and manage secrets and keys from a single dashboard.</p>
</li>
<li><p>Train employees on best practice security policies, Build a culture of trust and strong data security hygiene.</p>
</li>
<li><p>Complete visibility of your sensitive data.</p>
</li>
</ul>
<hr />
<h2 id="heading-benchllm">🦢 BenchLLM</h2>
<p><strong>BenchLLM</strong> is a Python-based open-source library that streamlines the testing of Large Language Models (LLMs) and AI-powered applications. It measures the accuracy of your model, agents, or chains by validating responses on any number of tests via LLMs.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753360642355/05ff1b56-a0eb-4ac8-8a0f-a4f50866e480.jpeg" alt /></p>
<h3 id="heading-details-11">🎈 Details</h3>
<ul>
<li><p><a target="_blank" href="https://benchllm.com/">Documentation</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/v7labs/BenchLLM">Github</a></p>
</li>
</ul>
<h3 id="heading-remarks-12">🧗 Remarks</h3>
<ul>
<li><p>A detailed customizable library to evaluate prompt performance.</p>
</li>
<li><p>A great tool for prompt engineering.</p>
</li>
<li><p>Support Vector Retrieval, Similary, Orchestrators and Function Calling.</p>
</li>
<li><p>Test the responses of your LLM across any number of prompts.</p>
</li>
<li><p>Continuous integration for chains like Langchain, agents like AutoGPT, or LLM models like Llama or GPT-4.</p>
</li>
<li><p>Eliminate flaky chains and create confidence in your code.</p>
</li>
<li><p>Spot inaccurate responses and hallucinations in your application at every version.</p>
</li>
</ul>
<hr />
<h2 id="heading-martian">🦉 Martian</h2>
<p>Dynamically route every prompt to the best LLM. Highest performance, lowest costs, incredibly easy to use.There are over 250,000 LLMs today. Some are good at coding. Some are good at holding conversations. Some are up to 300x cheaper than others. You could hire an ML engineering team to test every single one — or you can switch to the best one for each request with Martian.</p>
<p>Before:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753360657913/352a51bd-d878-481d-adf3-988c2e31acce.png" alt /></p>
<p>After:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753360674629/f794cd49-4160-4291-9150-159593f94ebe.png" alt /></p>
<h3 id="heading-details-12">🎈 Details</h3>
<ul>
<li><a target="_blank" href="https://github.com/withmartian/martian-python">Github</a></li>
</ul>
<h3 id="heading-remarks-13">🧗 Remarks</h3>
<ul>
<li><p>In the development phase, but I love the idea. It is trying to solve one of the most burning problems in the LLM ecosystem.</p>
</li>
<li><p>There are various models available in the market that specialize in different tasks such as coding and storytelling. The Martian SDK is designed to identify the prompt's intention and utilize various models internally to produce the output.</p>
</li>
<li><p>GPT 4 models is 316x Costlier than a 7 billion model - “Don't waste money by paying senior models to do junior work. The model router sends your tasks to the right model.”</p>
</li>
</ul>
<hr />
<p>*I post weekly newsletters on LLM development, the hottest Musings on Artificial Intelligence. [Subscribe](https://musingsonai.substack.com/)*</p>
<hr />
<h2 id="heading-special-mention">🐹 Special Mention</h2>
<h3 id="heading-rellmhttpsrellmai"><a target="_blank" href="https://rellm.ai/">ReLLM</a></h3>
<p><strong>ReLLM</strong> was created to fill a need when developing a separate tool. We needed a way to provide long term memory and context to our users, but we also needed to account for permissions and who can see what data.</p>
<h3 id="heading-langdockhttpswwwlangdockcom">🥦 <a target="_blank" href="https://www.langdock.com/">LangDock</a></h3>
<h4 id="heading-the-gdpr-compliant-chatgpt-for-your-team">The GDPR-compliant ChatGPT for your team</h4>
<h3 id="heading-tayloraihttpswwwtrytaylorai">🥒 <a target="_blank" href="https://www.trytaylor.ai/">TaylorAI</a></h3>
<p><strong>Taylor AI</strong> allows enterprises to train and own their own proprietary fine-tuned LLMs in minutes, not weeks.</p>
<h3 id="heading-scorecardaihttpswwwgetscorecardai">🍉 <a target="_blank" href="https://www.getscorecard.ai/">scorecard.ai</a></h3>
<p>Testing for Production-ready LLMs.Ship faster with more confidence. Integrate in minutes.</p>
<h3 id="heading-signwayiohttpswwwsignwayioexplanation">🍈 <a target="_blank" href="https://www.signway.io/#explanation">signway.io</a></h3>
<p>Signway is a proxy server that addresses the problem of re-streaming API responses from backend to frontend by allowing the frontend to directly request the API using a pre-signed URL created by Signway. This URL is short-lived, and once it passes verification for authenticity and expiry, Signway will proxy the request to the API and add the necessary authentication headers.</p>
<h3 id="heading-mithrilsecurityiohttpswwwmithrilsecurityio">🥥 <a target="_blank" href="https://www.mithrilsecurity.io/">mithrilsecurity.io</a></h3>
<p><strong>Mithril Security</strong> helps software vendors sell SaaS to enterprises, thanks to our secure enclave deployment tooling, which provides SaaS on-prem levels of security and control for customers.</p>
<h3 id="heading-kobaltlabshttpswwwkobaltlabscom">🥝 <a target="_blank" href="https://www.kobaltlabs.com/">kobaltlabs</a></h3>
<p>Unlock the power of GPT for your most sensitive data with a fast, simple security API</p>
<h3 id="heading-cadeaaihttpswwwcadeaai">🥭 <a target="_blank" href="https://www.cadea.ai/">cadea.ai</a></h3>
<p>Deploy enterprise-level AI tools equipped with e2e data security and role based access control. Our platform helps you create, manage, and monitor chatbots that can answer questions about your internal documents.</p>
<hr />
<h2 id="heading-summary">🐶 Summary</h2>
<p>It is hard to compare apples-to-apples. That why I have grouped the frameworks (No rank).</p>
<h3 id="heading-prompt-engineering-make-prompts-better">🔹 Prompt Engineering (Make Prompts better)</h3>
<ul>
<li><p>Baserun</p>
</li>
<li><p>PromptTools</p>
</li>
<li><p>DeepEval</p>
</li>
<li><p>Promptfoo</p>
</li>
<li><p>Nvidia NeMo-Guardrails</p>
</li>
<li><p>Agenta</p>
</li>
<li><p>AI Hero Studio</p>
</li>
<li><p>Guidance</p>
</li>
<li><p>Galileo LLM Studio</p>
</li>
<li><p>BenchLLM</p>
</li>
</ul>
<h3 id="heading-everything-about-llm-fine-tune-debugging-monitoring">🔹 Everything about LLM (Fine-tune, Debugging, Monitoring)</h3>
<ul>
<li><p>Baserun</p>
</li>
<li><p>Agenta</p>
</li>
<li><p>Nvidia NeMo-Guardrails</p>
</li>
<li><p>AgentBench</p>
</li>
<li><p>Galileo LLM Studio</p>
</li>
<li><p>Martian</p>
</li>
</ul>
<h3 id="heading-llm-security-guard-the-llm-fortress">🔹 LLM Security (Guard The LLM Fortress)</h3>
<ul>
<li><p>Nvidia NeMo-Guardrails</p>
</li>
<li><p>Arthur Bench</p>
</li>
<li><p>Galileo LLM Studio</p>
</li>
<li><p>lakera.ai</p>
</li>
<li><p>NightFall AI</p>
</li>
</ul>
<hr />
]]></content:encoded></item><item><title><![CDATA[Supercharging LLM Capabilities with Retrieval Augmented Generation (RAG)]]></title><description><![CDATA[Large Language Modelds (LLMs) like ChatGPT, Llama, Mistral and many others have become cornerstones due to their ability to understand and generate human-like text. These models have revolutionized how machines interact with information, offering unp...]]></description><link>https://llmshowto.com/understanding-retrieval-augmented-generation-rag-supercharging-llm-capabilities-with-embeddings-and-semantic-search</link><guid isPermaLink="true">https://llmshowto.com/understanding-retrieval-augmented-generation-rag-supercharging-llm-capabilities-with-embeddings-and-semantic-search</guid><category><![CDATA[AI]]></category><category><![CDATA[llm]]></category><category><![CDATA[chatgpt]]></category><category><![CDATA[RAG ]]></category><dc:creator><![CDATA[Rafael Pierre]]></dc:creator><pubDate>Wed, 24 Apr 2024 10:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1753196240709/3124a543-26e4-4f4b-a428-50fcca294f28.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Large Language Modelds (LLMs)</strong> like <strong>ChatGPT, Llama, Mistral</strong> and many others have become cornerstones due to their ability to understand and generate human-like text. These models have revolutionized how machines interact with information, offering unprecedented opportunities across a range of applications. However, despite their capabilities, LLMs come with notable limitations, including:</p>
<h3 id="heading-static-knowledge-base">Static Knowledge Base</h3>
<p><strong>LLMs</strong> are typically trained on a fixed dataset that may consist of a snapshot of the internet or curated corpora up to a certain point in time. Once training is complete, their knowledge base becomes static.</p>
<ul>
<li><strong>Outdated Information</strong>: Because the models do not update their knowledge after training, they can quickly become outdated as new information emerges and societal norms evolve.</li>
<li><strong>Inability to Learn Post-Training</strong>: Without continuous updates or further training, <strong>LLMs</strong> cannot adapt to new data or events that occur after their last training cycle. This limits their ability to provide relevant and current responses.</li>
</ul>
<h3 id="heading-factuality-challenges">Factuality Challenges</h3>
<p><strong>Factuality</strong> in LLMs relates to the accuracy and truthfulness of the information they generate. LLMs often struggle with maintaining a high level of factuality for several reasons:</p>
<ul>
<li><strong>Confidence in Incorrect Information</strong>: LLMs can generate responses with high confidence that are factually incorrect or misleading. This is because they rely on patterns in data rather than verified facts.</li>
<li><strong>Hallucination of Data</strong>: LLMs are known to <strong>hallucinate</strong> information, meaning they generate plausible but entirely fabricated details. This can be particularly problematic in settings that require high accuracy such as medical advice or news reporting.</li>
<li><strong>Source Attribution</strong>: LLMs do not keep track of the sources of their training data, making it difficult to trace the origin of the information they provide, which complicates the verification of generated content.</li>
</ul>
<h3 id="heading-scalability-concerns">Scalability Concerns</h3>
<p>Scaling LLMs involves more than just handling larger datasets or producing longer text outputs. It encompasses several dimensions that can present challenges:</p>
<ul>
<li><strong>Computational Resources</strong>: Training state-of-the-art LLMs requires significant computational power and energy, often involving hundreds of GPUs or TPUs running for weeks. This high resource demand makes scaling costly and less accessible to smaller organizations or independent researchers.</li>
<li><strong>Model Size and Management</strong>: As models scale, they become increasingly complex and difficult to manage. Larger models require more memory and more sophisticated infrastructure for deployment, which can complicate integration and maintenance in production environments.</li>
<li><strong>Latency and Throughput</strong>: Larger models generally process information more slowly, which can lead to higher latency in applications that require real-time responses. Managing throughput effectively while maintaining performance becomes a critical challenge as the model scales.</li>
</ul>
<p>These challenges underscore the limitations of current LLMs and highlight the necessity for innovative solutions like <strong>Retrieval Augmented Generation (RAG)</strong>, which seeks to address these issues by dynamically integrating up-to-date external information and improving the model’s adaptability, accuracy, and scalability.</p>
<h2 id="heading-what-is-retrieval-augmented-generation">What is Retrieval Augmented Generation?</h2>
<p>Introduced by <a target="_blank" href="https://ai.meta.com/meta-ai/">Meta</a>, <strong><a target="_blank" href="https://arxiv.org/abs/2005.11401">Retrieval Augmented Generation (RAG)</a></strong> represents a solution designed to overcome these shortcomings. At its core, RAG is a hybrid model that enhances the <strong>generative capabilities</strong> of traditional <strong>LLMs</strong> by integrating them with a <strong>retrieval component</strong>. This integration allows the model to access a broader and more up-to-date pool of information during the response generation process, thereby improving the relevance and accuracy of its outputs.</p>
<p><center><img src="/images/retrieval-augmented-generation-mips.png" /></center>
<br /></p>
<h2 id="heading-how-rag-works">How RAG Works</h2>
<p><center><img src="/images/retrieval-augmented-generation-how-it-works.png" /></center>
<br /></p>
<p>The architecture of a typical RAG system combines two main components: a retrieval mechanism and a transformer-based generator. Here’s how it functions:</p>
<ol>
<li><strong>Retrieval Process:</strong> When a query is inputted, the RAG system first searches a vast database of documents to find content that is most relevant to the query. This process leverages techniques from information retrieval to effectively match the query with the appropriate documents.</li>
<li><strong>Generation Process:</strong> The retrieved documents are then fed into a transformer-based model which synthesizes the information and generates a coherent and contextually appropriate response. This step ensures that the output is not just accurate but also tailored to the specific needs of the query.</li>
</ol>
<h3 id="heading-embeddings-rags-secret-sauce">Embeddings: RAG's Secret Sauce</h3>
<p>In Retrieval Augmented Generation (RAG) systems, embeddings play a crucial role in enabling the efficient retrieval of relevant documents or data that the generative component uses to produce answers. Here's an overview of how embeddings function within a RAG framework:</p>
<h4 id="heading-what-are-embeddings">What are Embeddings?</h4>
<p><strong>Embeddings</strong> are dense, low-dimensional representations of higher-dimensional data. In the context of RAG, embeddings are typically generated for both the input query and the documents in a database. These embeddings transform textual information into vectors in a continuous vector space, where semantically similar items are located closer to each other.</p>
<p><center><img src="/images/linear-relationships_orig.png" /></center>
<br /></p>
<h4 id="heading-role-of-embeddings-in-rag">Role of Embeddings in RAG</h4>
<ul>
<li><p><strong>Semantic Matching:</strong> <strong>Embeddings</strong> enable the RAG system to perform semantic matching between the input query and the potential source documents. By converting <strong>words, phrases, or entire documents</strong> into <strong>vectors</strong>, the system can use distance metrics (like cosine similarity) to find the documents that are most semantically similar to the query. This is more effective than traditional keyword matching, which might miss relevant documents due to synonymy or differing phrasings.</p>
</li>
<li><p><strong>Efficient Information Retrieval:</strong> Without embeddings, searching through a large database for relevant information could be computationally expensive and slow, especially as databases scale up. Embeddings allow the use of advanced indexing and search algorithms (like approximate nearest neighbor search algorithms) that can quickly retrieve the top matching documents from a large corpus, making the process both scalable and efficient.</p>
</li>
<li><p><strong>Improving the Quality of Generated Responses:</strong> By retrieving documents that are semantically related to the query, the generative component of the RAG system has access to contextually relevant and rich information. This helps in generating more accurate, detailed, and contextually appropriate answers. Embeddings ensure that the retrieved content is not just relevant but also enhances the generative process by providing specific details or factual content that the model can incorporate into its responses.</p>
</li>
<li><p><strong>Continual Learning and Adaptation</strong>: In some advanced implementations, embeddings can also be dynamically updated or refined based on feedback loops from the system's performance or new data, enhancing the model's ability to adapt over time. This can be crucial for applications in rapidly changing fields like news or scientific research.</p>
</li>
</ul>
<h4 id="heading-technologies-and-tools-for-embeddings-in-rag">Technologies and Tools for Embeddings in RAG</h4>
<p>Several technologies facilitate the creation and management of embeddings in a RAG system. Libraries like <a target="_blank" href="https://github.com/facebookresearch/faiss">FAISS</a>, <a target="_blank" href="https://github.com/spotify/annoy">Annoy</a>, <a target="_blank" href="https://sbert.net/">Sentence Transformers</a> and <a target="_blank" href="https://github.com/nmslib/hnswlib">HNSW</a> are popular for building efficient indexing systems that support fast retrieval operations on embeddings. Machine learning frameworks such as <a target="_blank" href="https://www.tensorflow.org/">TensorFlow</a> and <a target="_blank" href="https://pytorch.org/">PyTorch</a>, along with models from <a target="_blank" href="https://hf.co">Hugging Face’s Transformers</a> library, are commonly used to generate embeddings from textual data.</p>
<h2 id="heading-benefits-of-rag">Benefits of RAG</h2>
<p>RAG addresses several limitations of LLMs effectively:</p>
<ul>
<li><strong>Dynamic Knowledge Integration:</strong> Unlike traditional LLMs, RAG can pull the most current data from external sources, ensuring responses are not only accurate but also timely.</li>
<li><strong>Enhanced Accuracy and Relevance:</strong> By using real-time information, RAG considerably improves the quality of responses in terms of factuality and relevancy.</li>
</ul>
<h2 id="heading-use-cases-and-applications">Use Cases and Applications</h2>
<p>RAG has found practical applications in several fields:</p>
<ul>
<li><strong>Customer Support:</strong> Automating responses to user inquiries by providing precise and updated information.</li>
<li><strong>Healthcare:</strong> Assisting medical professionals by quickly retrieving medical literature and patient data to offer better diagnostic support.</li>
<li><strong>Legal Advisories:</strong> Enhancing the preparation of legal documents and advices by accessing and integrating the latest legal precedents and regulations.</li>
</ul>
<h2 id="heading-getting-started-with-rag">Getting Started with RAG</h2>
<p>For those interested in implementing RAG, there are several tools and frameworks available, both proprietary and open source. For any RAG implementation there will be two main components:</p>
<ul>
<li><p><strong>Embeddings</strong>: raw text that you want to index needs to be converted to embeddings. There are proprietary options from <a target="_blank" href="https://platform.openai.com/docs/guides/embeddings">OpenAI</a>, <a target="_blank" href="https://cohere.com/embeddings">Cohere</a>, <a target="_blank" href="https://docs.anthropic.com/claude/docs/embeddings">Anthropic</a> and other providers. In the open source world, Sentence Transformers and FAISS provide out-of-the-box functionality allowing to use open source Large Language Models to encode a text dataset into a set of embeddings.</p>
</li>
<li><p><strong>Vector Databases</strong>: once text is converted to embeddings, you will need to store it in a Vector Database. Ideally, this database will expose functionality to index these embeddings and to perform semantic search on top of them. Common algorithms for semantic search are Cosine Similarity and ANN. There are many different techniques and strategies for the retrieval stage and this is something that needs to be optimized depending on the use case. There are many different options in terms of Vector Database stacks both proprietary and open source, such as:</p>
</li>
<li><p><a target="_blank" href="https://qdrant.tech/">Qdrant</a></p>
</li>
<li><a target="_blank" href="https://milvus.io/">Milvus</a></li>
<li><a target="_blank" href="https://weaviate.io/">Weaviate</a></li>
<li><a target="_blank" href="https://www.trychroma.com/">ChromaDB</a></li>
<li><a target="_blank" href="https://github.com/pgvector/pgvector">Postgresql + pgvector</a></li>
</ul>
<p>In next chapters, we'll dive deep into the following RAG topics:</p>
<ul>
<li>Different RAG strategies</li>
<li>Vector DB options &amp; benchmarks</li>
<li>Practical RAG use cases</li>
</ul>
<p>Stay tuned!</p>
<h2 id="heading-references">References</h2>
<ol>
<li><a target="_blank" href="https://arxiv.org/abs/2005.11401">Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks</a></li>
<li><a target="_blank" href="https://blogs.nvidia.com/blog/what-is-retrieval-augmented-generation/">What Is Retrieval-Augmented Generation, aka RAG?</a></li>
<li><a target="_blank" href="https://www.promptingguide.ai/techniques/rag">Retrieval Augmented Generation (RAG)</a></li>
</ol>
]]></content:encoded></item></channel></rss>