<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sidi Camara on Medium]]></title>
        <description><![CDATA[Stories by Sidi Camara on Medium]]></description>
        <link>https://medium.com/@sidicamara?source=rss-eb8898e5e589------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Jl4Cu8ZgPNJpLRWkdMkokA.jpeg</url>
            <title>Stories by Sidi Camara on Medium</title>
            <link>https://medium.com/@sidicamara?source=rss-eb8898e5e589------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 20:52:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sidicamara/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Teaching a 4B LLM to Say “Yes” or “No”: Fine-Tuning Qwen3 to Trigger KYC Refreshes]]></title>
            <link>https://medium.com/@sidicamara/teaching-a-4b-llm-to-say-yes-or-no-fine-tuning-qwen3-to-trigger-kyc-refreshes-3b415a810cec?source=rss-eb8898e5e589------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b415a810cec</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[fine-tuning]]></category>
            <category><![CDATA[kyc]]></category>
            <category><![CDATA[fintech]]></category>
            <dc:creator><![CDATA[Sidi Camara]]></dc:creator>
            <pubDate>Mon, 23 Nov 2026 00:31:04 GMT</pubDate>
            <atom:updated>2026-11-23T00:31:04.759Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Part 1</strong> of a series on using a small fine-tuned LLM as a risk classifier. 1,000 training examples, one free GPU, and a model that catches 90% of the customers whose KYC needs a refresh.</p><h3>Summary</h3><ul><li><strong>Task:</strong> given a customer’s declared KYC profile and 12 months of account activity, decide whether their KYC needs a refresh (Yes / No).</li><li><strong>Model:</strong> Qwen3–4B-Instruct, fine-tuned with QLoRA on <strong>1,000 labelled examples</strong>. The model is trained to output a single token. The risk score is read from the probabilities of Yes vs No.</li><li><strong>Data:</strong> a fully synthetic dataset of 100,000 customers built with my own generator: 10 drift scenarios, 7 benign look-alikes, label noise and deliberately hard cases.</li><li><strong>Result on 20,000 unseen customers:</strong> <strong>recall 0.905, precision 0.597</strong> at a threshold fixed on the validation set, <strong>AUPRC 0.745</strong>. To catch 90% of the customers who need a review, the model sends <strong>17.8% of the portfolio</strong> to analysts, against 11.7% truly positive.</li><li><strong>Main failure mode:</strong> the model sees <em>that</em> a customer’s behaviour changed very well. It is much worse at judging <em>whether the change is large enough to matter</em>.</li><li><strong>Cost:</strong> about 5 GPU-hours on Kaggle’s free T4s.</li></ul><h3>The problem: KYC reviews on a calendar</h3><p>Banks must keep a customer’s <em>Know Your Customer</em> (KYC) file up to date: what they do for a living, what they earn, where their money comes from, what the account is for, how much and where they expect to transact. Traditionally, files are refreshed on a fixed schedule, for example every 1, 3 or 5 years depending on risk. Many of these reviews are administrative: the analyst confirms that nothing changed.</p><p><strong>Perpetual KYC</strong> flips the logic: refresh a file when the customer’s behaviour stops matching what they declared. A salaried customer who suddenly receives dozens of small payments from new counterparties every month may have started an undeclared business. A savings account that turns into a hub for regular international transfers is no longer a savings account.</p><p><strong>So the goal is to decide which customers to review first</strong>. For each customer, the model compares what they declared with how they actually use their account, and estimates how likely a review would be <strong>useful</strong>: one that leads to an update of the file, a change in risk level, or an escalation.</p><p>That is exactly what the model learns to predict: <strong>does this customer’s KYC need a refresh? Yes or No</strong>: needs_refresh ∈ {yes, no}</p><p><strong>Why an LLM, and why “labels-only”?</strong></p><p>The input is a mix of categorical profile fields (segment, occupation, declared source of funds, declared countries) and monthly time series. The decision is relational: it depends on how the activity compares with <em>this customer’s</em> declarations, and on context like risk level and PEP status. That is a good fit for a model that reads.</p><p>The approach is inspired by Stripe’s write-up on training LLMs for risk assessment: <strong>labels-only supervised fine-tuning</strong>. There is no chain of thought, no generated explanation and no prompt engineering at inference time. The model reads the case and emits one token. The training signal is the cross-entropy of that single answer token, nothing else.</p><p>That gives two things an AI engineer cares about:</p><ol><li><strong>A real score.</strong> At inference we read the logits of Yes and No at the answer position and compute s = sigmoid(logit_Yes − logit_No). That score ranks a review queue, and a threshold turns it into a decision.</li><li><strong>Cheap inference.</strong> One forward pass per customer, no decoding.</li></ol><h3>The data: a synthetic world with known ground truth</h3><p>There is no public dataset of KYC profiles with refresh labels. Public anti-money-laundering datasets (IBM AMLworld, SAML-D) cover transactions, not declared profiles, and their histories are too short for 12-month patterns. So I built a generator. That is the main limitation of this work and I come back to it at the end. It also brings two benefits: <strong>exact ground truth for every customer</strong>, and <strong>full control over difficulty</strong>.</p><p>Each synthetic customer has:</p><ul><li><strong>A declared profile:</strong> segment (salaried, self-employed, small business, retired, student), risk level, PEP status, occupation, declared income, inflow and outflow, transaction count, cash usage, international transfers and declared countries, source of funds, account purpose, and months since the last review.</li><li><strong>12 months of aggregates:</strong> inflows split by type (salary-like, business-like, pension, rental or dividends, P2P), cash deposits, ATM withdrawals, international flows by country, counterparties (and new ones), largest single inflow, share of card spend abroad, active days.</li></ul><p>Monthly activity follows the declared profile with realistic noise (variance, 13th-month salary, summer holidays). On top of that baseline, each customer gets one scenario:</p><p>Positive drifts (yes)Benign look-alikes (no)Lasting income increase, lasting income dropOne-off bonusUndeclared business activitySeasonalityMoved abroadHoliday abroadNew international corridorOne-off large inflow (car sale, inheritance)Lasting rise in cash usageGradual pay riseDormant account reactivatedMore flows to an already declared countrySmall business changes scaleBenign dormancy, then modest activitySource of funds shiftNo eventAccount used outside its purpose</p><p>To keep the task honest, I added the things that make real triage hard:</p><ul><li><strong>Materiality thresholds.</strong> Every drift has a continuous intensity, and it only counts as yes above a threshold. The threshold is lower for PEPs and high-risk customers: the same change matters more for them.</li><li><strong>Sub-threshold drifts.</strong> Some no customers get a <em>real</em> drift, just below the threshold. The behaviour changed, but not enough to justify a review.</li><li><strong>Weak and truncated cases.</strong> Drifts close to the threshold, and drifts that started only 2 months before the observation date.</li><li><strong>Overlays.</strong> About 30% of customers with an event get a second, benign one on top, so that “number of events” is not a shortcut.</li><li><strong>Label noise in training only.</strong> 3% of training labels are flipped, mostly on borderline cases, balanced in direction, to simulate analyst disagreement. Validation and test labels are clean.</li></ul><p>Prevalence is about 12% overall and varies by segment (7% for retired customers, 18% for small businesses). The 100,000 customers are split into train (70k), validation (10k) and test (20k).</p><p>Before training anything, I checked that the dataset is not trivially easy. <strong>The best single feature reaches an AUPRC of only 0.351</strong>, and a lookup on segment, risk level and PEP status alone stays below 0.25.</p><h3>Turning a customer into a prompt</h3><p>The serialization matters more than I expected. Here is a real (synthetic) test case:</p><pre>KYC PROFILE (reviewed 34 months ago)<br>Segment: small business | Risk: low | PEP: no | Residence: FR<br>Occupation: garage owner | Purpose: international transfers<br>Source of funds: business revenue<br>Declared: income 3.42k/month, inflow 38.8k, outflow 37.9k, ~134 tx/month<br>Cash deposits: medium | ATM: ~3/month | Intl transfers: regular (ES, IN, PT)</pre><pre>ACCOUNT ACTIVITY (last 12 months, Sep -&gt; Aug, amounts in k)<br>Month: Sep Oct Nov Dec Jan Feb Mar Apr May Jun Jul Aug<br>Inflow: 39.8 0.978 0 0 0.032 1.21 1.23 0 1.26 32.0 30.8 30.0<br>Inflow vs declared %: 103 3 0 0 0 3 3 0 3 82 79 77<br>  Business-like: 37.5 0.978 0 0 0 1.21 1.13 0 1.26 31.9 26.0 29.8<br>  ...<br>Counterparties (new): 64(3) 0(0) 1(0) 0(0) 5(0) 3(0) 1(0) 0(0) 0(0) 68(4) 58(4) 60(2)<br>...<br>Does this customer&#39;s KYC need a refresh?</pre><p>This garage was nearly dormant for eight months, then came back to its usual volumes. It looks dramatic, but the activity is consistent with the declared profile. It is one of the benign look-alikes. The model scores it <strong>0.01</strong>.</p><p>A few choices that shaped the prompt:</p><ul><li><strong>One row per variable, one column per month.</strong> The model reads a time series as a line, and the Month: header anchors every column.</li><li><strong>Amounts in thousands, 3 significant digits.</strong> That keeps numbers short in tokens without losing the information that matters.</li><li><strong>All 12 months, with no token budget.</strong> The cost is only compute: prompts average about 900 tokens.</li><li><strong>An extra </strong><strong>Inflow vs declared % row.</strong> LLMs are bad at division. I tested two formats: base without this row and ratio with it.</li></ul><h3>Training: 1,000 examples, one T4</h3><ul><li><strong>Base model:</strong> Qwen3–4B-Instruct-2507, with its chat template and a short system message</li><li><strong>Method:</strong> 4-bit QLoRA, LoRA r = 16 and alpha = 32 on all projection matrices</li><li><strong>Loss:</strong> cross-entropy on the answer token only (custom collator, no TRL)</li><li><strong>Data:</strong> 1,000 training examples, rebalanced to 35% positives</li><li><strong>Schedule:</strong> 3 epochs, learning rate 2e-4, cosine schedule, effective batch size 16</li><li><strong>Hardware:</strong> Kaggle T4 (16 GB), with Unsloth</li><li><strong>Time:</strong> about 1.5 h of training per format, and about 1.5 h to score 10,000 customers</li></ul><p>Two implementation details made the setup simple and robust:</p><ul><li><strong>Left padding with the answer as the last token.</strong> The answer always sits at the last position of every row, so the training loss and the inference score use exactly the same position (the last prompt token). I only ask the model for the last 2 positions’ logits, which avoids materializing a 150k-token vocabulary over 1,000 positions.</li><li><strong>Yes / </strong><strong>No as answer tokens, checked on the base model.</strong> Before training, I looked at what the base model actually puts at the answer position: 61% on Yes, 39% on ** (it wanted to start a Markdown bold answer), 0.4% on No, and about one in a million on lowercase yes. Starting from tokens the model already uses makes the first steps much smoother.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3K03eCOEObIQaQxdH-ATyw.png" /></figure><p>Training loss of the answer token. The dashed line is the loss of a model that ignores the input and always predicts the 35% base rate. Both formats cross it within the first epoch.</p><h3>Results on 20,000 unseen customers</h3><p>I chose the ratio format on the validation set: AUPRC 0.743 vs 0.724 for base, a small but consistent gain (paired bootstrap 95% CI of the difference: +0.003 to +0.033). Note that the two training curves above are nearly identical. <strong>Training loss alone would not have told the formats apart.</strong></p><p>The decision threshold is the highest score that reaches 90% recall <strong>on validation</strong>. It is then applied unchanged to the test set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-GgiMqt1PBnvpBifMefUcw.png" /></figure><p>The validation and test numbers are almost identical (validation: recall 0.902, precision 0.592). <strong>The threshold transfers</strong>, which is what you need before you can trust an operating point.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rUYzoGyGeROWh7_aFi51tw.png" /></figure><p>In concrete terms, out of <strong>20,000 customers</strong> the model <strong>flags 3,562</strong>. Of those, <strong>2,125 need a refresh</strong> and <strong>1,437 do not</strong>, and it <strong>misses 223</strong> customers who do. A random review queue would be right 11.7% of the time. <strong>This one is right about 60% of the time.</strong></p><h3>Where it fails: the model sees change, not materiality</h3><p>Breaking the flags down by what actually happened to each customer gives the clearest picture:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QGKUDp8QuUw59ebBkqPRcQ.png" /></figure><ul><li><strong>Benign events are almost never flagged:</strong> 0.3% of bonuses, holidays, one-off inflows, seasonal peaks and benign dormancies. The model has learned that a spike is not a regime change.</li><li><strong>Sub-threshold drifts are flagged 66% of the time.</strong> These are customers whose behaviour <em>really</em> changed, but not enough to cross the materiality threshold. <strong>They account for 97% of all false positives.</strong></li></ul><p>In other words, the <strong>model is an excellent change detector</strong> and a mediocre materiality judge. Its flag rate on sub-threshold drifts does rise as the drift gets closer to the threshold, but it stays high even for drifts far below it.</p><p>From a business angle, that failure mode is not the worst one to have. These customers did change, and an analyst would at least understand why they were flagged. But it is what caps precision today.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bLn1O0RvXXhOTxOM-nWE6w.png" /></figure><p>On the recall side, most drifts are caught 88% to 98% of the time. Two stand out:</p><ul><li><strong>Lasting rise in cash usage (0.67)</strong> and <strong>lasting income increase (0.83)</strong>. Both are pure <em>magnitude</em> questions: is this much more cash, or this much more salary, enough given what was declared? It is the same weakness, seen from the other side.</li><li><strong>Hard cases cost recall, as expected:</strong> 0.80 on weak drifts (vs 0.94 otherwise) and 0.85 when only 2 months of the new regime are visible (vs 0.91).</li></ul><h3>Limitations</h3><ul><li><strong>Synthetic data, written by me.</strong> The model learns the rules of my generator, not those of a real bank. Confounders, continuous intensities, label noise and hard cases make the task non-trivial, but realism depends on my assumptions. The thresholds and scenarios are illustrative, not any institution’s rules.</li><li><strong>One seed.</strong> The confidence intervals cover sampling uncertainty on the test set, not training variance.</li><li><strong>No comparison with other models yet.</strong> The only reference point here is the best single feature (AUPRC 0.351) and a random queue. Whether a gradient-boosted model on hand-crafted features would do as well is a fair question, and a topic for a later part.</li><li><strong>Account activity only.</strong> Real refresh triggers also include sanctions hits, adverse media, ownership changes and document expiry. They are out of scope.</li></ul><h3>What’s next</h3><p>This is v1: the smallest setup that works end to end. Upcoming parts of the series:</p><ol><li><strong>More data.</strong> Does going from 1k to 5k and 20k examples teach the model where the materiality threshold is? This is the obvious lever for the main failure mode.</li><li><strong>Serialization.</strong> What else should be precomputed for the model, and what can it work out on its own?</li><li><strong>From score to decision.</strong> Calibration, threshold policies and analyst workload.</li><li><strong>Robustness.</strong> Seeds, label noise levels and truncated histories.</li></ol><p><em>The code and the synthetic data generator will be open-sourced with the next article of this series.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b415a810cec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your AI Agent Is Going to Production. Have You Secured It?]]></title>
            <link>https://medium.com/@sidicamara/your-ai-agent-is-going-to-production-have-you-secured-it-5f498f6a07e5?source=rss-eb8898e5e589------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f498f6a07e5</guid>
            <category><![CDATA[ai-security]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[llm-security]]></category>
            <dc:creator><![CDATA[Sidi Camara]]></dc:creator>
            <pubDate>Thu, 24 Sep 2026 23:56:56 GMT</pubDate>
            <atom:updated>2026-09-24T23:56:56.423Z</atom:updated>
            <content:encoded><![CDATA[<p>Last week, I wrote a LinkedIn post about how rarely I see <strong>“AgentOps Engineer”</strong> in job descriptions.</p><p>My hypothesis is that this reflects where many companies currently are in their Agentic AI journey: we are still early in the transition from experimentation to mature production platforms.</p><p>We saw something similar with DevOps. As systems became larger and more critical, CI/CD, observability, infrastructure automation and production reliability became first-class engineering concerns.</p><p>I believe AgentOps will follow a similar path.</p><p>And one of its most important concerns is <strong>security</strong>.</p><p>After going through Google’s <em>AgentOps: Operationalize AI Agents on Google</em> training, here are the controls I would consider a minimum before deploying an agent with access to production systems.</p><h3>1. Test Behavior</h3><p>Traditional unit and integration tests are still necessary, but agents introduce non-deterministic execution paths.</p><p>For tool-using agents, I want to evaluate both the <strong>final answer and the trajectory</strong>.</p><p>If the expected trajectory is:</p><pre>User request<br>    ↓<br>search_customer()<br>    ↓<br>check_eligibility()<br>    ↓<br>update_customer()</pre><p>I want my evaluation suite to detect when the agent:</p><ul><li>calls the wrong tool;</li><li>calls tools in the wrong order;</li><li>misses a required tool;</li><li>calls unnecessary tools;</li><li>passes incorrect arguments.</li></ul><p>A golden evaluation dataset can define expected trajectories for representative scenarios.</p><p>I also like thinking about tool selection in terms of <strong>precision and recall</strong>:</p><blockquote><em>Did the agent call unnecessary tools?<br>Did it miss tools that were required?</em></blockquote><p>For response quality, <strong>LLM-as-a-Judge</strong> can complement deterministic checks.</p><p>These evaluations should eventually become part of CI/CD. A new prompt, model or agent version that significantly regresses critical evaluations should not silently reach production.</p><h3>2. Apply Least Privilege to Agents</h3><p>Never make the LLM itself your security boundary.</p><pre>&quot;Never delete production data&quot;</pre><p>is an instruction, not an access-control mechanism.</p><p>The service account running the agent should receive only the permissions required for its responsibilities.</p><p>For multi-agent systems, consider separate identities:</p><pre>OrderAgent       → OrderServiceAccount<br>SupportAgent     → SupportServiceAccount<br>AnalyticsAgent   → AnalyticsServiceAccount</pre><p>This limits the blast radius if one agent is compromised or behaves unexpectedly.</p><p>The same principle applies to tools: an agent should only be exposed and authorized to use the capabilities it actually needs.</p><h3>3. Put a Hard Boundary Around Permissions</h3><p>Least privilege is necessary, but IAM configuration can drift or simply be misconfigured.</p><p>On Google Cloud, <strong>Principal Access Boundary (PAB)</strong> policies provide an additional boundary around the resources a principal is eligible to access.</p><p>Conceptually:</p><pre>IAM<br> ↓<br>&quot;What can this agent access?&quot;</pre><pre>PAB<br> ↓<br>&quot;How far can this access ever extend?&quot;</pre><p>Even if broader permissions are accidentally granted, the boundary can prevent the identity from escaping its intended resource perimeter for supported permissions.</p><p>This is an important AgentOps principle: <strong>limit the blast radius independently from the agent’s reasoning.</strong></p><h3>4. Explicitly Deny Dangerous Operations</h3><p>Some permissions should simply never be available to an autonomous agent.</p><p>For example:</p><pre>delete production dataset<br>delete storage bucket<br>modify IAM policies<br>destroy infrastructure</pre><p>An <strong>IAM Deny Policy</strong> provides another layer:</p><pre>IAM Allow<br>   +<br>Explicit Deny<br>   ↓<br>DENIED</pre><p>This protects against accidental over-permissioning.</p><p>For high-impact actions that the agent legitimately needs to perform, introduce <strong>Human-in-the-Loop approval</strong> instead of unrestricted autonomous execution.</p><pre>Agent proposes action<br>        ↓<br>High impact?<br>   ↓         ↓<br>  No        Yes<br>   ↓         ↓<br>Execute   Human approval</pre><h3>5. Assume Prompt Injection Will Eventually Get Through</h3><p>Prompt injection should be treated as an architectural threat, not merely a prompting problem.</p><p>There are two main attack surfaces:</p><pre>Direct injection</pre><pre>Attacker → malicious prompt → Agent</pre><p>and the more challenging case:</p><pre>Indirect injection</pre><pre>Agent → document / email / website / RAG source<br>                         ↓<br>                malicious instruction<br>                         ↓<br>                       Agent</pre><p>The second case is particularly relevant for RAG and tool-using agents because <strong>untrusted data can become an instruction channel</strong>.</p><p>On Google Cloud, <strong>Model Armor</strong> can inspect inbound and outbound content for prompt injection/jailbreak attempts, sensitive data, malicious URLs and harmful content.</p><p>Conceptually:</p><pre>Input<br>  ↓<br>Model Armor<br>  ↓<br>Agent<br>  ↓<br>Tools / Data<br>  ↓<br>Model Armor<br>  ↓<br>Output</pre><p>But Model Armor or any prompt-injection detector should never be considered sufficient by itself.</p><p>Detection can fail.</p><p>The architecture should remain safe even when it does.</p><h3>Defense in Depth</h3><p>Putting these controls together gives us:</p><pre>                    User<br>                      ↓<br>               Model Armor<br>                      ↓<br>                   Agent<br>                      ↓<br>              Tool Authorization<br>                      ↓<br>                IAM / Identity<br>                      ↓<br>           Principal Access Boundary<br>                      ↓<br>              IAM Deny Policies<br>                      ↓<br>              Sensitive action?<br>                 ↓         ↓<br>                No        Yes<br>                 ↓         ↓<br>             Execute   Human approval</pre><p>And around the system:</p><pre>CI/CD<br> ├── Unit / integration tests<br> ├── Agent evaluations<br> ├── Trajectory evaluation<br> ├── Tool-use evaluation<br> ├── LLM-as-a-Judge<br> └── Security tests</pre><h3>The AgentOps Security Question</h3><p>For me, one of the most useful questions before putting an agent into production is no longer just:</p><blockquote><strong><em>Can this agent complete the task reliably?</em></strong></blockquote><p>It is also:</p><blockquote><strong><em>What is the maximum damage this agent could cause if it makes the worst possible decision?</em></strong></blockquote><p>Because prompts are not security boundaries.</p><p>Models are not security boundaries.</p><p><strong>Security must be enforced outside the LLM.</strong></p><p>That is where IAM, tool authorization, permission boundaries, explicit denies, security screening, evaluation and human approval become part of AgentOps not optional additions after the agent has already reached production.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f498f6a07e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Re-Ran the Exact Same Claude Stress Test on Amazon Bedrock. Failures Dropped From 56% to 0%]]></title>
            <link>https://medium.com/@sidicamara/i-re-ran-the-exact-same-claude-stress-test-on-amazon-bedrock-failures-dropped-from-56-to-0-e80a72d09b6f?source=rss-eb8898e5e589------2</link>
            <guid isPermaLink="false">https://medium.com/p/e80a72d09b6f</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[performance-testing]]></category>
            <category><![CDATA[agentic-rag]]></category>
            <category><![CDATA[amazon-bedrock]]></category>
            <category><![CDATA[llmops]]></category>
            <dc:creator><![CDATA[Sidi Camara]]></dc:creator>
            <pubDate>Sun, 06 Sep 2026 22:54:27 GMT</pubDate>
            <atom:updated>2026-09-06T22:54:27.680Z</atom:updated>
            <content:encoded><![CDATA[<p><em>What two identical stress tests taught me about latency variance when running LLM workloads on managed infrastructure.</em></p><p>I was stress-testing an LLM-powered document-processing workload while evaluating a migration from Azure OpenAI to Claude through Amazon Bedrock.</p><p>The first result was alarming: <strong>20 out of 36 Lambda invocations hit AWS Lambda’s 900-second maximum execution time, a 56% failure rate.</strong></p><p>Later, I reproduced the experiment under the same controlled conditions: same model, input, code, methodology, and concurrency profile.</p><p>This second run happened during the weekend.</p><p><strong>All 36 invocations completed successfully.</strong></p><p>That changed the question I was trying to answer. Instead of simply asking whether Claude was slower for this workload, I started asking something more interesting:</p><p>How much can we trust a single LLM performance benchmark when part of the infrastructure is outside our control?</p><h3>The First Stress Test</h3><p>The workload was a synchronous AWS Lambda processing a large document through an LLM. I tested concurrency levels of <strong>1, 5, 10, and 20</strong>, using direct Lambda invocation and CloudWatch as the server-side source of truth.</p><p>The Lambda was already configured at AWS’s maximum execution timeout of <strong>900 seconds</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NSAF-pkqV7g2Ol6IQE4hjQ.png" /></figure><p>Successful calls took between <strong>383 and 881 seconds</strong>.</p><h3>Then I Repeated the Test</h3><p>I later repeated the experiment, carefully checking that the variables under my control had not changed.</p><p>The result was dramatically different:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PbGYQUPjASlaRqNZIZdK4Q.png" /></figure><p>The interesting part wasn’t only that the timeouts disappeared.</p><p><strong>The whole observed latency range shifted downward.</strong></p><p>This wasn’t a handful of requests narrowly escaping the 900-second limit. During the second run, every concurrency level was substantially faster.</p><p>At this point, the application itself was becoming a less convincing explanation. The variables I controlled were unchanged, yet the observed inference performance was very different.</p><p>So I started digging into how Bedrock handles inference capacity.</p><h3>Looking Beyond the Application</h3><p>While researching the behavior, I found an important aspect of managed LLM inference that is easy to overlook during benchmarking: <strong>the capacity serving your requests is itself part of the system.</strong></p><p>AWS documents that Bedrock’s on-demand throughput is allocated at the regional level and that capacity conditions can vary across regions and periods of demand. AWS also provides mechanisms specifically designed to give workloads access to broader or more predictable inference capacity.</p><p>For example, <strong>cross-Region inference</strong> can dynamically route requests across supported AWS Regions, giving a workload access to a broader pool of compute when demand increases.</p><p>AWS also offers <strong>Provisioned Throughput</strong>, where model throughput is provisioned separately instead of relying exclusively on normal on-demand inference capacity.</p><p>This doesn’t prove what happened during my two tests.</p><p>I don’t have access to AWS’s internal telemetry, so I cannot say that shared capacity or a “noisy neighbor” effect caused the first run.</p><p>But it provides a plausible explanation for what I observed.</p><p>The first test may have occurred during a period where the inference path available to my requests was under greater demand, while the weekend reproduction may have benefited from more available capacity.</p><p>That’s a hypothesis, not a root-cause finding.</p><p>What the measurements do show is more important: <strong>the same controlled workload experienced materially different latency at different points in time.</strong></p><h3>Why the 900-Second Boundary Changes Everything</h3><p>The deeper problem wasn’t really the 56% figure.</p><p>It was how close the workload was operating to a hard infrastructure limit.</p><p>Consider a simplified example:</p><pre>Higher-latency period</pre><pre>400s ───── 600s ───── 850s ───│── 950s<br>                               │<br>                         Lambda 900s limit</pre><pre>Lower-latency period</pre><pre>300s ───── 350s ───── 410s     │<br>                               │<br>                         Lambda 900s limit</pre><p>The numbers are illustrative, but the principle is important.</p><p>If an LLM response takes 400 seconds instead of 300 seconds, the application is slower.</p><p>But when latency approaches Lambda’s <strong>900-second maximum</strong>, the effect is no longer gradual.</p><p>A request taking 850 seconds succeeds.</p><p>A request taking more than 900 seconds is terminated.</p><p>The tail of the latency distribution therefore becomes much more important than the average.</p><p>A change in inference performance can move an application from apparently stable to highly unreliable without any application code changing.</p><p>That’s exactly why the difference between my two runs matters.</p><h3>Final Takeaway</h3><p>The surprising part of this experiment wasn’t that Claude requests timed out.</p><p>It was that the same controlled experiment later completed with <strong>zero timeouts and a substantially lower latency range</strong>.</p><p>I can’t prove that the weekend timing caused the improvement, nor can I see exactly what happened inside Bedrock’s infrastructure.</p><p>But I can observe the consequence.</p><p><strong>Managed LLM latency isn’t just a model characteristic. The serving environment matters too.</strong></p><p>And when that latency sits close to a hard infrastructure limit, normal variation can become an application reliability problem.</p><p>So my takeaway is simple:</p><p><strong>Don’t benchmark an LLM workload once and treat the result as a permanent truth. Test it over time, measure the tail, and make sure your architecture has enough latency headroom for the bad days, not just the good ones.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e80a72d09b6f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>