<?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 Brian Bwengye on Medium]]></title>
        <description><![CDATA[Stories by Brian Bwengye on Medium]]></description>
        <link>https://medium.com/@bwengyebrian_86632?source=rss-42b31c9265ab------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*PdLbWWq7dwNl-Sx_KwTB4w.jpeg</url>
            <title>Stories by Brian Bwengye on Medium</title>
            <link>https://medium.com/@bwengyebrian_86632?source=rss-42b31c9265ab------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 17:44:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bwengyebrian_86632/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[My 5-Step System for Getting Better Results From AI]]></title>
            <link>https://medium.com/@bwengyebrian_86632/my-5-step-system-for-getting-better-results-from-ai-9c41c0784c60?source=rss-42b31c9265ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c41c0784c60</guid>
            <category><![CDATA[prompt-engineering]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <dc:creator><![CDATA[Brian Bwengye]]></dc:creator>
            <pubDate>Sat, 22 Aug 2026 02:51:36 GMT</pubDate>
            <atom:updated>2026-08-22T02:51:36.809Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BQM4PllRuvkB8xQc0WWicQ.jpeg" /></figure><p>Most people use AI like this:</p><blockquote><strong><em>Prompt → Answer → Done.</em></strong></blockquote><p>That is often enough. But for work I actually care about, I have found that I get better results when I stop treating AI as a single assistant and start treating it more like a small team.</p><p>My current setup has three roles:</p><ul><li><strong>The Brain — ChatGPT:</strong> helps me structure the task, sharpen the prompt, and later judge which feedback is worth acting on.</li><li><strong>The Implementer — Claude:</strong> produces the actual deliverable and handles revisions.</li><li><strong>The Reviewer — Gemini:</strong> independently critiques the work against the original requirements.</li></ul><p>Then I keep cycling between them until the result is good enough.</p><p>The specific models are not the important part. You could use different models, or even separate sessions of the same model. The principle is what matters:</p><blockquote><strong><em>Separate thinking, execution, and evaluation.</em></strong></blockquote><p>That simple shift has changed the way I use AI.</p><h3>Before the Five Steps: Define What Good Looks Like</h3><p>One of the biggest lessons I have learned is that AI performs much better when it has a clear target.</p><p>“<em>Create a great strategy document</em>” <strong>is vague.</strong> “<em>Create a strategy document that covers these eight sections, follows this template, answers these five questions, and can be used by this specific audience” is much easier to execute and review</em>.</p><p>Whenever possible, I give the models something concrete to work toward:</p><ul><li>A template</li><li>An example</li><li>A rubric</li><li>A checklist</li><li>A specification</li><li>A reference document</li><li>An expected structure</li><li>Clear acceptance criteria</li></ul><p>This is especially important because the reviewer also needs a definition of success. If there is no standard, the review quickly becomes subjective: <em>I would phrase this differently</em>, <em>I prefer this structure</em>, <em>maybe add another section</em>.</p><p>But if the goal is explicit, the question becomes much more useful:</p><blockquote><strong><em>Did the result actually satisfy what we asked for?</em></strong></blockquote><p>With that in place, here is the workflow I use.</p><h4>Step 1: Describe What You Need in Plain English</h4><p>I start by writing what I want as clearly as I can. I do not worry about prompt engineering yet — I simply explain the task as I would explain it to a capable colleague.</p><p>I try to cover:</p><ul><li>What I am creating</li><li>Who it is for</li><li>Why I need it</li><li>What inputs are available</li><li>What constraints exist</li><li>What the final output should contain</li><li>What examples or references should guide it</li><li>What success looks like</li></ul><p>For example:</p><blockquote>I need brand guidelines for my company. I already have our logo and a brand-guidelines template that shows the level of detail I want. The final document should cover logo usage, color, typography, tone of voice, imagery, spacing, incorrect usage, and practical examples. It should be detailed enough that an external designer or marketing contractor could use it without needing constant clarification.</blockquote><p>This step matters more than it might seem. If I cannot explain the outcome clearly in plain English, a sophisticated prompt is unlikely to rescue the task.</p><h4>Step 2: Ask the Brain to Build the Execution Prompt</h4><p>Instead of immediately asking a model to do the work, I first ask ChatGPT to turn my description into a stronger execution prompt. A typical version looks like this:</p><blockquote>I want another AI model to execute the task below.<br>Turn my description into a detailed execution prompt designed to produce a high-quality result. The prompt should:</blockquote><blockquote>Clearly define the objective</blockquote><blockquote>Preserve all important requirements and constraints</blockquote><blockquote>Explain what source material or references should be used</blockquote><blockquote>Specify the expected output and structure</blockquote><blockquote>Define what success looks like</blockquote><blockquote>Explain how to handle missing or ambiguous information</blockquote><blockquote>Require a final self-check against the requirements</blockquote><blockquote>Do not perform the task yourself. Give me the prompt I should use.</blockquote><blockquote>Here is my description:</blockquote><blockquote>[PASTE BRIEF]</blockquote><p>I like this because it separates two different jobs. My job is to explain <strong>what I want</strong>. The Brain’s job is to help translate that into <strong>instructions an AI can execute well</strong>.</p><h4>Step 3: Give the Prompt to the Implementer</h4><p>I then take the execution prompt, attach the relevant source material, and give it to Claude.</p><p>Claude’s job in this workflow is straightforward: produce the deliverable. It may be a document, code, analysis, design brief, research synthesis, plan, presentation outline, or something else entirely.</p><p>Often, the first result is already good. I still do not stop there. The model that created the work should not necessarily be the only model deciding whether the work is good.</p><p>That is where the reviewer comes in.</p><h3>Step 4: Have a Different Model Review the Result</h3><p>I give Gemini three things whenever possible:</p><ol><li>The original requirements</li><li>The reference, template, or definition of success</li><li>The result produced by Claude</li></ol><p>Then I ask it to review rather than rewrite:</p><blockquote>Act as an independent reviewer. Compare the completed result against the original requirements and any provided reference material.</blockquote><blockquote>Do not rewrite the deliverable yet. Identify:</blockquote><blockquote>Requirements that were fully satisfied</blockquote><blockquote>Requirements that were only partially satisfied</blockquote><blockquote>Important requirements that were missed</blockquote><blockquote>Factual or logical problems</blockquote><blockquote>Weak, vague, or unsupported sections</blockquote><blockquote>Inconsistencies</blockquote><blockquote>Areas where the output does not match the expected structure or quality bar</blockquote><blockquote>Opportunities to make the result more specific, useful, or complete</blockquote><blockquote>For each criticism, explain why it matters and suggest a concrete correction.</blockquote><blockquote>Separate the findings into:</blockquote><blockquote><strong>Critical fixes</strong></blockquote><blockquote><strong>Important improvements</strong></blockquote><blockquote><strong>Optional improvements</strong></blockquote><blockquote>Finish with the changes that would improve the result the most.</blockquote><p>The important part is that I am asking for an <strong>audit</strong>, not another version of the work. That keeps the reviewer focused on finding weaknesses instead of immediately introducing its own preferences.</p><h4>Step 5: Ask the Brain to Judge the Review</h4><p>This is the part I think is easiest to miss. I do not automatically accept Gemini’s feedback.</p><p>The reviewer is also an AI model. It can misunderstand the goal, suggest unnecessary work, or recommend a change that sounds sensible but actually makes the output worse.</p><p>So I take the original brief, Claude’s result, and Gemini’s review back to ChatGPT. At this point, the Brain becomes the adjudicator. I use something like:</p><blockquote>You are coordinating the final quality of this work. You have:</blockquote><blockquote>The original requirements</blockquote><blockquote>The current result</blockquote><blockquote>An independent review</blockquote><blockquote>Evaluate the review critically rather than accepting it automatically. For each significant recommendation, classify it as:</blockquote><blockquote><strong>Accept</strong> — the criticism is valid and should be addressed</blockquote><blockquote><strong>Modify</strong> — the criticism is directionally correct, but the proposed fix should change</blockquote><blockquote><strong>Reject</strong> — the criticism is not supported by the requirements or would make the result worse</blockquote><blockquote>Briefly explain the reasoning. Then create a prioritized revision brief for the implementer containing only the changes that should actually be made. Preserve anything that is already working well.</blockquote><p>I then give that revision brief back to Claude. Claude revises the output. Gemini reviews it again. ChatGPT evaluates the feedback. Claude makes the next round of changes. I keep going until another iteration is unlikely to add much value.</p><p>So the loop becomes:</p><blockquote><strong>Brain → Implementer → Reviewer → Brain → Implementer</strong></blockquote><h3>What This Looks Like in Practice</h3><p>Imagine your company has grown, but the brand was never really formalized. You have a logo, a few colors, some marketing material, and a general sense of how the company should look and sound — but no single document that brings it all together.</p><p>Here is the workflow I would use, in two phases.</p><h4>Phase 1: Establish the Benchmark</h4><p>Before involving any model, I find a strong brand-guidelines document online or any another organization. I am not looking for something to copy. I am looking for a clear example of what a complete brand system actually contains:</p><ul><li>Logo usage and clear space</li><li>Spacing rules and minimum sizes</li><li>Typography</li><li>Color systems with exact values</li><li>Imagery and photography direction</li><li>Tone of voice</li><li>Misuse cases</li><li>Practical examples</li></ul><blockquote><strong>That template becomes the quality benchmark.</strong></blockquote><p>Instead of asking AI to “create brand guidelines” and leaving it to decide what that means, I am handing it a concrete structure to work toward and a much clearer definition of what “complete” looks like.</p><p>Then I gather the company-specific inputs: the logo, existing brand assets, and information about the company, its audience, positioning, product, and current marketing. The benchmark plus those inputs is everything the loop needs.</p><h4>Phase 2: Run the Loop</h4><blockquote><strong><em>ChatGPT → Claude → Gemini → ChatGPT → Claude</em></strong></blockquote><ul><li><strong>Prompt generation (ChatGPT):</strong> I describe the outcome I want in plain English and hand over the brief, the reference template, and the company inputs. ChatGPT turns all of it into a strong execution prompt.</li><li><strong>First draft (Claude):</strong> Claude takes that prompt and the source material and produces the first version of the guidelines.</li><li><strong>Independent audit (Gemini):</strong> Gemini checks the draft against both the original requirements and the reference template — what is missing, what is too vague to act on, where rules contradict each other, and whether an outside designer or marketing partner could use it confidently. Using a different model matters here: the assumptions that produced the draft do not carry into the critique of it.</li><li><strong>Adjudication (ChatGPT):</strong> ChatGPT separates the useful criticism from the noise and turns what survives into a prioritized revision brief.</li><li><strong>Revision (Claude):</strong> Claude implements the brief. Then the loop repeats.</li></ul><p>For a document this size, it might take two or three passes. I stop when the review stops surfacing structural problems.</p><p>The important part is that the template is not just inspiration. It gives the entire workflow a target. Without it, three models are each guessing at what “good brand guidelines” means. With it, they are all working toward the same concrete thing.</p><h3>Why I Prefer Different Models</h3><p>You can reproduce this workflow using one model in separate conversations. But I often prefer using different models because they tend to approach the same task differently.</p><p>One model may be better at structuring the problem. Another may be stronger at producing the kind of output I want. A third may notice issues that the first two missed.</p><p>I also like separating the creator from the reviewer. The assumptions that produced an answer can easily carry into the review of that same answer. A fresh model gives me another perspective.</p><p>This is similar to how good human teams work:</p><ul><li>The developer who writes the code is not always the only person reviewing it.</li><li>The person who builds the financial model should not be the only person checking the assumptions.</li><li>The person who creates the campaign should not be the only person deciding whether it works.</li></ul><p>AI benefits from the same separation of roles.</p><p>And disagreement is useful. If different models independently arrive at similar conclusions, my confidence goes up. If they disagree, that tells me where I need to pay attention.</p><h3>The Shift That Matters</h3><p>I still use single prompts all the time. Not every task deserves a multi-step workflow. If I need to summarize an email, brainstorm names, or answer a straightforward question, one model is usually enough.</p><p>But for work where quality matters, I increasingly think less about finding the perfect prompt and more about designing a process that improves the output.</p><p>That is the real shift for me. Instead of asking: <strong><em>“What is the perfect prompt?”</em></strong></p><p>I ask : <strong><em>“What process makes it harder for a bad result to survive?”</em></strong></p><p>One model helps define the problem. Another creates the work. Another tries to break it. Then the first model decides which criticism is worth acting on.</p><p>The individual models will change. Their strengths will change. My workflow will probably change too. But the principle is something I expect to keep using:</p><blockquote><strong>Do not just ask AI for an answer. Build a system that forces the answer to get better.</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c41c0784c60" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimizing A Scam Classifier to Under 0.5MB Web Browser Budget]]></title>
            <link>https://medium.com/@bwengyebrian_86632/optimizing-a-scam-classifier-to-under-0-5mb-web-browser-budget-6328831eb3d3?source=rss-42b31c9265ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/6328831eb3d3</guid>
            <category><![CDATA[edge-ai]]></category>
            <category><![CDATA[scam]]></category>
            <category><![CDATA[transformers]]></category>
            <category><![CDATA[mls]]></category>
            <category><![CDATA[linear-regression]]></category>
            <dc:creator><![CDATA[Brian Bwengye]]></dc:creator>
            <pubDate>Thu, 06 Aug 2026 03:35:36 GMT</pubDate>
            <atom:updated>2026-08-06T03:35:36.799Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*frL2n7IICK8IqwPXvP3G2A.png" /></figure><p>Running a text classifier entirely inside the browser sounds simple until the constraints become real:</p><ul><li>No server-side inference</li><li>No user text leaving the device</li><li>Fast enough for interactive use</li><li>Small enough to ship with a browser extension or web application</li><li>Consistent results between Python training and JavaScript inference</li><li>Accurate enough not to classify every urgent retail promotion as fraud</li></ul><p>We built a production text classifier that runs entirely client-side in 280 KiB (57% of a 500 KB target) with a <strong>9.8 ms </strong>warm P90 latency and <strong>152 ms</strong> startup.</p><p>This article is a breakdown on how we shrunk a 915 KiB model package down to 280 KiB, what we sacrificed, and why the biggest wins weren’t fancy compression tricks.</p><h3>Key Performance Highlights</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*WqL1rtowi6yB8oYQOCNxSg.png" /></figure><p><em>Baseline is the unpruned FP32 model (K = 47,382), before hard-negative mining.</em></p><h3>1. Model Choice: Why Linear Model Over Transformer</h3><p>A sub-megabyte budget leaves no room for weight matrices, embedding tables, and vocabulary files let alone holding two versions in memory during a staged rollback.</p><ul><li><strong>Transformer models (MobileBERT, TinnyBERT, MiniLM, DistilBERT):</strong> The embedding table alone exceeds 500 KB.</li><li><strong>Quantized fastText:</strong> Lacks a maintained ONNX Runtime Web path.</li><li><strong>Our Pick:</strong> A Logistic Regression over n-grams (20,000 text features + 16 structural features) exported to ONNX and dynamically quantized.</li></ul><pre>Float32Array[1, 20016] ──&gt; MatMul(W[20016, 2]) ──&gt; Add(b[2]) ──&gt; Logits[1, 2]</pre><p><em>By pushing tokenization, normalization, and feature extraction into TypeScript (inside a Web Worker), the </em><strong><em>ONNX</em></strong><em> graph stays stupidly simple containing only </em><strong>MatMul</strong><em> and </em><strong>Add</strong>.</p><h3>2. The Size Ladder: How We Saved the Bytes</h3><p>Before quantization, the weight matrix was only ~40% of our payload. To hit our target, we had to optimize the whole feature pipeline:</p><pre>Pre-Quantization      Shipped (INT8)<br>model.onnx               158 KiB                43 KiB       (Weight Matrix)<br>vocab.txt                147 KiB               147 KiB       (N-gram -&gt; Index)<br>idf.f32                   78 KiB                78 KiB       (IDF Values)<br>manifests                ~12 KiB               ~12 KiB       (Metadata &amp; Calibration)<br>-------------------------------------------------------------------------------<br>Total                    395 KiB               280 KiB       (57% of Budget)</pre><p><strong>Character 3–5 N-grams (The Quality Leap):</strong> Word-only models broke on misspellings, homoglyphs, and OCR noise. Adding character n-grams boosted adversarial recall from 74.8% to 84.4%, but ballooned vocabulary size (47k features = 915 KiB).</p><p><strong>Pruning the Feature System (520 KiB Saved):</strong> We ranked n-grams by absolute weight and pruned down to K = 20,000, retraining at every level. PR-AUC dropped by just 0.0005, taking package size from 915 KiB to 395 KiB.</p><p><strong>Dynamic INT8 Quantization (115 KiB Saved):</strong> Shrinks model.onnx from 158 KiB to 43 KiB.</p><blockquote><strong><em>Critical catch:</em></strong><em> Quantization broke probability calibration (ECE went from 0.021 to 0.087, against a 0.05 ceiling). Refitting temperature scaling against the quantized INT8 artifact restored calibration (ECE = 0.024). On FP32 the same drift was invisible 0.0281 vs 0.0284 which is exactly what makes it dangerous.</em></blockquote><p><strong>Why keep vocab.txt (147 KiB)?</strong> We could have hashed n-grams straight to indices and saved another 147 KiB. But keeping human-readable tokens allowed us to inspect feature contributions during false-positive debugging. That auditability directly enabled our fix for high-urgency benign messages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uL_xsCcVjXpP1s3MTd6sNw.png" /></figure><h3>3. Browser Pipeline Optimization</h3><p>When profiling our initial browser implementation, we found the ONNX inference took 0.46 ms (1%), while n-gram extraction swallowed 45.3 ms (78%).</p><p>Optimizing the model was pointless , we needed to optimize string handling in JavaScript.</p><pre>L0: String allocations / Map lookups        │ 58.1 ms P90<br>L1: Code-point scan + Rolling FNV-1a hash   │ 19.8 ms<br>L2: Shared feature buffer + zeroing touched │ 17.6 ms<br>L3: Fold feature prefixes into hash seed    │ 13.2 ms<br>L4: Single-pass character processing        │ 11.0 ms<br>L5: ONNX graph optimization                 │ 10.9 ms  (noise)<br>L6: Typed-array open-addressed hash table   │  9.7 ms P90  &lt;-- FP32 FINAL<br>                                              9.8 ms after INT8 quantization</pre><p><strong>Zero Allocations:</strong> Replaced string slicing and Map lookups with a rolling FNV-1a hash directly over code-point arrays.</p><p><strong>Local WASM &amp; Binary Vocab:</strong> Bundled ONNX Runtime WASM binaries locally (saved 495 ms connection overhead) and switched from JSON vocabulary parsing (96 ms) to binary loading (9 ms). Total warm start dropped from 741 ms to 152 ms.</p><h3>4. Data Over Architecture: Fixing High-Urgency Benign False Positives</h3><p>Our initial model learned a dangerous shortcut: <strong>Urgency = Scam.</strong></p><p>Retail flash sales, order updates, and delivery notifications (“Act now”, “Your session expires”) triggered massive false positives (3.80% FPR against a 3.0% limit).</p><pre>Feature Contribution Analysis on False Positives:<br>  c:rgent          +0.388  (&quot;URGENT: your delivery window&quot;)<br>  m_exclam_ratio   +0.341  (Flash sale copy)<br>  w:act now        +0.312  (&quot;Act now - sale ends 11:59pm&quot;)</pre><p>Rather than building a complex Transformer, we fixed the data: we added 4,900 urgency-heavy benign examples (shipping updates, promo codes, tracking links) to the training set.</p><ul><li><strong>Hard-Negative FPR:</strong> Dropped from 3.80% to 1.95%</li><li><strong>Precision:</strong> Increased from 93.1% to 95.6%</li><li><strong>Recall:</strong> 97.5% to 96.9%</li></ul><p>A follow-up scaling fix on the structural feature block (meta_feature_scale 1.00 → 0.75) took FPR the rest of the way, from 1.95% to <strong>1.80%</strong>.</p><h3>Summary of Trade-offs</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*YUPBLSp99wOH7Kv3RUIy5w.png" /></figure><h3>Key Takeaway for Edge ML</h3><p>The smallest deployable model is rarely the one with the fewest bytes or the newest architecture. The smallest system is one where you own the full inference contract: control feature extraction allocations, enforce cross-runtime numeric parity, calibrate against the final quantized artifact, and preserve auditability.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6328831eb3d3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DSA vs. Real-World Coding Interviews — and Where Does AI Leave Us?]]></title>
            <link>https://medium.com/@bwengyebrian_86632/dsa-vs-real-world-coding-interviews-and-where-does-ai-leave-us-fa14b22e12bc?source=rss-42b31c9265ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa14b22e12bc</guid>
            <dc:creator><![CDATA[Brian Bwengye]]></dc:creator>
            <pubDate>Tue, 02 Jun 2026 17:40:18 GMT</pubDate>
            <atom:updated>2026-06-02T17:56:38.000Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*MlqVYI5fIlan7BRzrp9_kA.png" /></figure><p>For a long time, I have come across the debate on the right way to vet technical candidates: should interviews focus on Data Structures &amp; Algorithms (DSA), or on real-world coding problems?</p><p><strong>Two sides of the debate:<br></strong>Some argue that DSA-style interviews are not always applicable to actual engineering work they can feel tricky, abstract, and sometimes unfair when trying to identify great software engineers.</p><p>Others argue that real-world coding interviews can focus too much on expertise in a particular language, framework, or tool. But a good engineer should be able to reason well, regardless of the tools.</p><p>Based on my professional experience vetting other candidates as well as going through vetting myself , I lean toward the former.</p><p><strong>Why DSA still makes sense<br></strong>When you really think about it, DSA is mostly about optimization: compute (time complexity) and storage (space complexity). Even though in real life you may never implement a “<em>Trapping Rain Water</em>” algorithm, the mindset of thinking in terms of optimizing these two limited resources is what matters.</p><p>This is similar to the classic debate about why students have to go through complex mathematics in school. It’s rarely about solving differential equations in daily life rather, it’s about training the mind to think critically about real-life challenges.</p><p><strong>Why this matters at scale<br></strong>After several years working on systems that operate at global scale, performance and efficiency optimization remain some of the most challenging and important problems.</p><ul><li>A small query optimization can sometimes have more business impact than a new feature</li><li>The right data structure can make seemingly impossible storage constraints manageable</li><li>Low latency can tremendously improve user experiences</li><li>Real-time systems that deliver insights to drive sales, prevent harmful content before it reaches users, and support many other critical use cases</li></ul><p>All of this is made possible not just by designing systems that work, but by designing systems that work <strong>efficiently</strong>.</p><p><strong>So where does that leave us?<br></strong>DSA may not be perfect, but in my view it <strong>is</strong> a better way or at least it “<strong>was</strong>.”</p><p>With AI now reshaping how engineers work, the industry seems to be looking to a new set of skills.<strong><em> TokenMaxxing</em></strong> 😊</p><p>I am curious to see what this stabilizes into.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa14b22e12bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Detecting and Extracting Advertising Creatives in the Browser]]></title>
            <link>https://medium.com/@bwengyebrian_86632/detecting-and-extracting-advertising-creatives-in-the-browser-3252676c24db?source=rss-42b31c9265ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/3252676c24db</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[ads-infra]]></category>
            <category><![CDATA[advertising]]></category>
            <dc:creator><![CDATA[Brian Bwengye]]></dc:creator>
            <pubDate>Fri, 29 May 2026 01:49:26 GMT</pubDate>
            <atom:updated>2026-05-29T01:49:26.587Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A systems architecture for finding, normalizing, and preparing web ad creatives for downstream analysis</em></p><p>Modern web pages do not present advertising in one predictable shape. A single creative might show up as across-Orgin iframein the sidebar, a sponsored cardinside a feed, a native commerce module embedded in editorial content, a sticky overlayat the bottom of the page, a recommendationwidget, a video placement, a canvas-rendered unit, or a component hidden behind Shadow DOM.</p><p>That variety is what makes creative detection difficult. There is rarely one selector, one tag, or one network signal that reliably says, “<em>this is the ad</em>.” The browser has to reason from a mix of layout, labels, metadata, visibility, timing, and rendering constraints.</p><p>This article focuses on the architecture of a browser-side system that detects and extracts advertising creatives from live web pages. The output can be passed to downstream systems for different use cases. The job here is more foundational:</p><blockquote>Can we reliably find likely advertising surfaces on a page and extract the best representation the browser can safely access?</blockquote><p>The architecture is built around two core subsystems.</p><p><strong>Detection</strong> finds likely advertising or promotional surfaces and emits structured AdCandidate records. These records describe where the candidate appears, why it looks ad-like, how confident the detector is, and what browser access constraints apply.</p><p><strong>Extraction</strong> takes those candidates and turns them into stable CreativeSnapshot artifacts. A snapshot may contain geometry, visible text, selected metadata, local visual references, access-mode details, and extraction notes explaining what was captured and what could not be accessed.</p><p>Together, these two subsystems create a clean boundary: detection identifies the creative surface, extraction normalizes it into an artifact, and downstream systems decide what to do with it.</p><h3>Why Creative Detection and Extraction Matter</h3><p>Most automated systems cannot reason about an advertisement until they can first isolate it. Whether the goal is ad transparency, brand safety, compliance, or quality assurance, everything hinges on a single prerequisite: <strong>obtaining a clean, accurate representation of the creative itself.</strong></p><p>A specialized classifier might be excellent at spotting scams, unsafe imagery, or technical rendering bugs. However, those capabilities are useless if the browser-side layer fails to correctly identify and extract the creative region.</p><p>Detection quality directly determines the success of every subsequent workflow:</p><ul><li><strong>Missed Detection:</strong> If the detector misses the ad entirely, there is nothing to analyze.</li><li><strong>Over-Selection:</strong> Including too much of the surrounding page introduces noise that confuses downstream models.</li><li><strong>Under-Selection:</strong> Truncating the ad region results in incomplete data and missed context.</li><li><strong>Unstable Extraction:</strong> Inconsistent captures break replay, debugging, and model reliability.</li></ul><blockquote>The Botton line, Creative detection and extraction is a foundational infrastructure requirement.</blockquote><p>The ultimate goal is to produce a stable, trustworthy <strong>CreativeSnapshot</strong> the essential baseline for any upstream system.</p><h3>Architectural Overview</h3><p>At a high level, the system observes the page, discovers candidate ad surfaces, groups and scores them, resolves browser access constraints, extracts the best available creative representation, and emits a structured snapshot. <a href="https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver">MutationObserver</a>, <a href="https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API">IntersectionObserver</a>, and <a href="https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver">ResizeObserver</a> are natural browser primitives for observing dynamic DOM changes, viewport visibility, and element size changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jni8xLt-jAcuxq45qhbEEw.png" /></figure><h3>5. Core Data Contracts</h3><h4>5.1 AdCandidate</h4><p>An AdCandidaterepresents a likely advertising or promotional surface found on a page. It captures where the candidate is, why it was considered ad-like, how confident the system is, what browser access mode applies, and which signals contributed to the score.</p><p>TypeScript contract: AdCandidate</p><pre>interface AdCandidate {<br>  candidateId: string;<br>  adLikelihood: number;<br><br>  accessMode:<br>    | &quot;dom_subtree_accessible&quot;<br>    | &quot;cross_origin_iframe_metadata_only&quot;<br>    | &quot;shadow_host_only&quot;<br>    | &quot;canvas_region_only&quot;<br>    | &quot;video_container_only&quot;<br>    | &quot;metadata_and_bounds_only&quot;;<br><br>  bounds: { x: number; y: number; width: number; height: number };<br>  coordinateSpace: &quot;viewport&quot; | &quot;page&quot;;<br>  signals: CandidateSignal[];<br><br>  source: {<br>    tagName?: string;<br>    nodeRole?: string;<br>    frameOriginHint?: string;<br>    discoveredAtEpochMs: number;<br>  };<br>}<br><br>interface CandidateSignal {<br>  name: string;<br>  value: number;<br>  weight: number;<br>  contribution: number;<br>  explanation: string;<br>}</pre><h4>5.2 CreativeSnapshot</h4><p>A CreativeSnapshotis the normalized extraction output for a candidate. It captures the best locally available representation of the creative and records whether extraction was complete, partial, visual-only, or metadata-only.</p><p><strong>TypeScript contract: CreativeSnapshot</strong></p><pre>interface CreativeSnapshot {<br>  candidateId: string;<br>  snapshotId: string;<br><br>  snapshotType:<br>    | &quot;dom_text_and_image&quot;<br>    | &quot;image_only&quot;<br>    | &quot;iframe_region&quot;<br>    | &quot;canvas_region&quot;<br>    | &quot;video_container&quot;<br>    | &quot;metadata_only&quot;;<br><br>  captureEpochMs: number;<br>  bounds: { x: number; y: number; width: number; height: number };<br><br>  domText?: string;<br>  accessibleText?: string;<br>  linkUrls?: string[];<br>  imageRefs?: string[];<br><br>  visualCapture?: {<br>    localRef: string;<br>    width: number;<br>    height: number;<br>    format: &quot;png&quot; | &quot;jpeg&quot; | &quot;webp&quot;;<br>  };<br><br>  extractionNotes: string[];<br><br>  privacy: {<br>    localOnly: boolean;<br>    containsRawDom: boolean;<br>    containsScreenshot: boolean;<br>    ttlEpochMs?: number;<br>  };<br>}</pre><h3>6. Detection Layer</h3><p>The detection layer discovers likely advertising or promotional surfaces. It should be broad-recall, incremental, explainable, and efficient. Modern pages mutate continuously, so detection should not depend on a one-time scan alone. <strong><em>MutationObserver</em></strong> reports changes to the DOM tree, <strong><em>IntersectionObserver</em></strong> reports target visibility relative to a viewport or ancestor, and <strong><em>ResizeObserver</em></strong> reports element size changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m9WiS8d17s-sL94O8AIvnQ.png" /></figure><h4>6.1 Candidate Discovery Signals</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UOueEegCE77b264RG45Ecg.png" /></figure><h4>6.2. Candidate Grouping and Deduplication</h4><p>Raw detection often produces too many candidate nodes. A single ad may include an outer slot wrapper, an iframe, a container div, an image, a CTAbutton, and a disclosure label. If the system emits all of these independently, downstream extraction becomes noisy and expensive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4cWxbWDmDI5q3hcFT5aNhg.png" /></figure><h4>6.3. Ad-Likelihood Scoring</h4><p>The detector should assign a continuous likelihood score rather than immediately declaring an element to be an ad. This allows downstream systems to select thresholds based on their use case and tolerance for false positives or false negatives.</p><blockquote>The score answers one question: <strong>is this candidate likely enough to extract</strong></blockquote><pre>ad-likelihood(c) =<br>  clamp(positive ad signals − negative page signals, 0, 1)</pre><ul><li><strong>Positive signals</strong> increase the score: sponsored labels, ad-like attributes, iframe hints, CTA text, promotional language, and standard ad sizes.</li><li><strong>Negative signals</strong> reduce the score: article content, navigation menus, headers, footers, and other normal site UI.</li><li><strong>Clamp</strong> keeps the score between 0 and 1.</li></ul><p>A score near 0 means the candidate is probably not an ad.<br> A score near 1 means the candidate is very likely to be an ad or promotional creative.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cijK2FxWpiQrzNrnbQf0SQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jjaqQEThS6w5bSZoKn01vw.png" /></figure><h4>6.4. Access Mode Resolution</h4><p>Detection and extraction must respect browser boundaries. Some candidates are fully accessible through the DOM. Others are opaque because they are cross-origin iframes cross-origin iframes, encapsulated behind <a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM">Shadow DOM</a>, or rendered as pixels. The <a href="https://developer.mozilla.org/en-US/docs/Web/Security/Defenses/Same-origin_policy">same-origin policy</a> restricts how scripts from one origin can interact with resources from another origin, and iframe sandboxing can introduce additional restrictions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lP7wTZsEJbqPpzIT8zlzsA.png" /></figure><blockquote><a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM">Shadow DOM </a>is especially important because it enables component encapsulation: internal implementation can be hidden from JavaScript and CSS running in the page. A robust detector should treat this as an explicit access mode rather than as an error.</blockquote><h3>7. Extraction Layer</h3><p>Detection alone is not enough. Once a candidate is found, the system must extract a stable, analyzable representation of the creative. The extraction layer converts anAdCandidate into a CreativeSnapshop. It should be deterministic, privacy-aware, and explicit about partial extraction. Its is the normalization step that prepares creative artifacts for downstream consumers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6AxmVVXJasvU1gEFW5H4ow.png" /></figure><h4>7.1 Extraction Output Example</h4><pre>{<br>&quot;candidateId&quot;: &quot;cand_p8k2m&quot;,<br>&quot;snapshotId&quot;: &quot;snap_01j3v9&quot;,<br>&quot;snapshotType&quot;: &quot;iframe_region&quot;,<br>&quot;captureEpochMs&quot;: 1763698800000,<br>&quot;bounds&quot;: { &quot;x&quot;: 120, &quot;y&quot;: 430, &quot;width&quot;: 300, &quot;height&quot;: 250 },<br>&quot;extractionNotes&quot;: [<br>&quot;cross_origin_iframe&quot;,<br>&quot;dom_not_accessible&quot;,<br>&quot;visual_crop_captured&quot;<br>]<br>}</pre><h3>8. Runtime Sequence</h3><p>At runtime the layers cooperate as an event-driven pipeline. Observers batch DOM and visibility events, the detector scores candidates, and only those clearing the threshold proceed to extraction, storage, and dispatch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*upP237VFCWlyRz0cIVuDUw.png" /></figure><h3>9. Worked Example: News Page Detection and Extraction</h3><p>Consider a simplified news page with one sidebar display ad, one sponsored native recommendation card, one sticky promotion, and one organic editorial recommendation. The detector should extract the first two by default, extract the sticky promo only in broad-recall mode, and ignore the editorial card.</p><p><strong>Simplified page markup</strong></p><pre>&lt;body&gt;<br>  &lt;header&gt;<br>    &lt;nav&gt;News · Markets · Technology · Sports&lt;/nav&gt;<br>  &lt;/header&gt;<br><br>  &lt;main&gt;<br>    &lt;article&gt;<br>      &lt;h1&gt;Electric Vehicle Sales Rise Again&lt;/h1&gt;<br>      &lt;p&gt;Global EV sales increased this quarter...&lt;/p&gt;<br>    &lt;/article&gt;<br><br>    &lt;aside class=&quot;rail&quot;&gt;<br>      &lt;div class=&quot;ad-slot&quot; data-ad-unit=&quot;sidebar-300x250&quot;&gt;<br>        &lt;span class=&quot;disclosure&quot;&gt;Advertisement&lt;/span&gt;<br>        &lt;iframe src=&quot;https://ads.example-network.com/render?id=abc123&quot; width=&quot;300&quot; height=&quot;250&quot;&gt;&lt;/iframe&gt;<br>      &lt;/div&gt;<br>    &lt;/aside&gt;<br><br>    &lt;section class=&quot;recommended&quot;&gt;<br>      &lt;h2&gt;Recommended for you&lt;/h2&gt;<br>      &lt;div class=&quot;card sponsored-card&quot; data-promoted=&quot;true&quot;&gt;<br>        &lt;span class=&quot;label&quot;&gt;Sponsored&lt;/span&gt;<br>        &lt;img src=&quot;/images/credit-card-offer.jpg&quot; /&gt;<br>        &lt;h3&gt;Earn rewards faster with the Nova Card&lt;/h3&gt;<br>        &lt;a href=&quot;https://offers.example.com/nova-card&quot;&gt;Apply now&lt;/a&gt;<br>      &lt;/div&gt;<br>      &lt;div class=&quot;card&quot;&gt;<br>        &lt;img src=&quot;/images/editorial-story.jpg&quot; /&gt;<br>        &lt;h3&gt;How battery recycling is changing supply chains&lt;/h3&gt;<br>        &lt;a href=&quot;/stories/battery-recycling&quot;&gt;Read more&lt;/a&gt;<br>      &lt;/div&gt;<br>    &lt;/section&gt;<br>  &lt;/main&gt;<br><br>  &lt;div class=&quot;promo sticky-bottom&quot;&gt;<br>    &lt;span&gt;Limited time offer&lt;/span&gt;<br>    &lt;button&gt;Shop now&lt;/button&gt;<br>  &lt;/div&gt;<br>&lt;/body&gt;</pre><h4>11.1 Candidate Detection Output</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rB5PFu66oYn1zwiQaM2-4g.png" /></figure><h4>11.2 Extracted Snapshot: Cross-Origin iframe Ad</h4><p>The sidebar ad is likely a display creative, but the iframe is cross-origin. The system should not attempt to inspect its internal DOM. Instead, it captures metadata, bounds, a visible crop reference, and extraction notes.</p><p><strong><em>CreativeSnapshot example: iframe region</em></strong></p><pre>{<br>  &quot;candidateId&quot;: &quot;cand_sidebar_001&quot;,<br>  &quot;snapshotId&quot;: &quot;snap_sidebar_001&quot;,<br>  &quot;snapshotType&quot;: &quot;iframe_region&quot;,<br>  &quot;captureEpochMs&quot;: 1763698800000,<br>  &quot;bounds&quot;: { &quot;x&quot;: 1030, &quot;y&quot;: 220, &quot;width&quot;: 300, &quot;height&quot;: 250 },<br>  &quot;visualCapture&quot;: {<br>    &quot;localRef&quot;: &quot;local://snapshots/snap_sidebar_001.webp&quot;,<br>    &quot;width&quot;: 300,<br>    &quot;height&quot;: 250,<br>    &quot;format&quot;: &quot;webp&quot;<br>  },<br>  &quot;extractionNotes&quot;: [<br>    &quot;cross_origin_iframe&quot;,<br>    &quot;dom_not_accessible&quot;,<br>    &quot;advertisement_label_detected&quot;,<br>    &quot;visual_crop_captured&quot;<br>  ],<br>  &quot;privacy&quot;: {<br>    &quot;localOnly&quot;: true,<br>    &quot;containsRawDom&quot;: false,<br>    &quot;containsScreenshot&quot;: true,<br>    &quot;ttlEpochMs&quot;: 1763702400000<br>  }<br>}</pre><h4>11.3 Extracted Snapshot: Sponsored Native Card</h4><p>The sponsored native card is DOM-accessible. The system can extract visible text, link URLs, metadata, and a visual crop.</p><p><strong><em>CreativeSnapshot example: DOM-accessible native card</em></strong></p><pre>{<br>  &quot;candidateId&quot;: &quot;cand_native_002&quot;,<br>  &quot;snapshotId&quot;: &quot;snap_native_002&quot;,<br>  &quot;snapshotType&quot;: &quot;dom_text_and_image&quot;,<br>  &quot;captureEpochMs&quot;: 1763698800500,<br>  &quot;bounds&quot;: { &quot;x&quot;: 120, &quot;y&quot;: 760, &quot;width&quot;: 640, &quot;height&quot;: 180 },<br>  &quot;domText&quot;: &quot;Sponsored Earn rewards faster with the Nova Card Apply now&quot;,<br>  &quot;linkUrls&quot;: [&quot;https://offers.example.com/nova-card&quot;],<br>  &quot;imageRefs&quot;: [&quot;local://assets/credit-card-offer.jpg&quot;],<br>  &quot;visualCapture&quot;: {<br>    &quot;localRef&quot;: &quot;local://snapshots/snap_native_002.webp&quot;,<br>    &quot;width&quot;: 640,<br>    &quot;height&quot;: 180,<br>    &quot;format&quot;: &quot;webp&quot;<br>  },<br>  &quot;extractionNotes&quot;: [<br>    &quot;dom_accessible&quot;,<br>    &quot;sponsored_label_detected&quot;,<br>    &quot;cta_detected&quot;,<br>    &quot;link_metadata_captured&quot;,<br>    &quot;visual_crop_captured&quot;<br>  ],<br>  &quot;privacy&quot;: {<br>    &quot;localOnly&quot;: true,<br>    &quot;containsRawDom&quot;: false,<br>    &quot;containsScreenshot&quot;: true,<br>    &quot;ttlEpochMs&quot;: 1763702400000<br>  }<br>}</pre><h3>12. Reference Implementation Sketch</h3><p><strong><em>Pipeline orchestration</em></strong></p><pre>class CreativeDetectionPipeline {<br> constructor(<br> private detector: AdCreativeDetector,<br> private extractor: CreativeExtractor,<br> private consumer: CreativeSnapshotConsumer,<br> private metrics: MetricsStore,<br> ) {}<br> <br> start(): void {<br> this.detector.onCandidate(async (candidate) =&gt; {<br> this.metrics.increment(&quot;candidate.emitted&quot;);<br> <br> if (candidate.adLikelihood &lt; 0.4) {<br> this.metrics.increment(&quot;candidate.below_threshold&quot;);<br> return;<br> }<br> <br> const snapshot = await this.extractor.extract(candidate);<br> <br> if (!snapshot) {<br> this.metrics.increment(&quot;snapshot.extraction_failed&quot;);<br> return;<br> }<br> <br> this.metrics.increment(&quot;snapshot.extraction_success&quot;);<br> await this.consumer.handle(snapshot, candidate);<br> });<br> <br> this.detector.start();<br> }<br> }</pre><p><strong><em>Access-mode-based extraction dispatch</em></strong></p><pre>class CreativeExtractor {<br> async extract(candidate: AdCandidate): Promise&lt;CreativeSnapshot | null&gt; {<br> switch (candidate.accessMode) {<br> case &quot;dom_subtree_accessible&quot;:<br> return this.extractDomAccessibleCreative(candidate);<br> case &quot;cross_origin_iframe_metadata_only&quot;:<br> return this.extractCrossOriginIframeRegion(candidate);<br> case &quot;shadow_host_only&quot;:<br> return this.extractShadowHostRegion(candidate);<br> case &quot;canvas_region_only&quot;:<br> return this.extractCanvasRegion(candidate);<br> case &quot;video_container_only&quot;:<br> return this.extractVideoContainer(candidate);<br> default:<br> return this.extractMetadataOnly(candidate);<br> }<br> }<br> }</pre><h3>13. Key Considerations for Creative Extraction</h3><p>A reliable extraction system is not just a screenshot tool. It is a browser-aware subsystem that turns live ad surfaces into structured, trustworthy CreativeSnapshot artifacts.</p><blockquote><strong><em>Core principle:</em></strong><em> capture enough to understand the creative, but no more than the creative requires.</em></blockquote><p>The system should optimize for five considerations:</p><h4>13.1. Extraction Fidelity</h4><p>The snapshot must accurately represent the creative.</p><p>It should capture the primary message, disclosure label, call to action, visual asset, destination metadata, and visible bounds where available. It should avoid unrelated article text, navigation, comments, or neighboring widgets.</p><p>A sidebar iframe may only produce a frame crop and nearby “Advertisement” label. A native sponsored card may produce richer text, image, link, and geometry metadata. A Shadow DOM creative may only expose host bounds and a visual crop.</p><p>The important thing is that the snapshot is complete enough for downstream analysis and honest about what was captured.</p><h4>13.2. Browser Constraint Awareness</h4><p>The extractor must respect browser reality.</p><p>Some creatives are fully DOM-accessible. Others are cross-origin, sandboxed, Shadow DOM-encapsulated, canvas-rendered, video-based, lazy-loaded, or continuously mutating.</p><p>The system should assign an access mode before extraction, such as:</p><ul><li>dom_subtree_accessible</li><li>cross_origin_iframe_metadata_only</li><li>shadow_host_only</li><li>canvas_region_only</li><li>video_container_only</li><li>metadata_and_bounds_only</li></ul><p>Partial extraction is acceptable when it is explicit. A snapshot that says “cross-origin iframe, DOM inaccessible, visual crop captured” is better than a silent failure or an overbroad full-page capture.</p><h4>13.3. Privacy by Design</h4><p>Creative extraction can become invasive if it captures too much of the page.</p><p>The default posture should be local-first and minimal:</p><ul><li>capture candidate regions, not full pages,</li><li>prefer selected text and metadata over raw HTML,</li><li>use ephemeral candidate and snapshot IDs,</li><li>avoid persistent cross-site identifiers,</li><li>apply short retention windows,</li><li>disable screenshot, raw DOM, and content upload by default,</li><li>record what was captured and why.</li></ul><p>The system should remain a purpose-limited creative extraction layer, not a browsing-history archive.</p><h4>13.4. Runtime Discipline</h4><p>The detector and extractor run inside the user’s browsing experience. If they cause jank, block rendering, drain battery, or flood the runtime with capture jobs, the architecture fails.</p><p>The system should do cheap work first and expensive work only when justified:</p><ul><li>batch DOM mutations,</li><li>use lightweight prefilters,</li><li>prioritize visible or near-visible candidates,</li><li>score before visual capture,</li><li>debounce repeated extraction,</li><li>cache stable candidates,</li><li>apply backpressure when queues are busy,</li><li>defer or skip low-confidence candidates under load.</li></ul><p>Accuracy matters, but deployability matters just as much.</p><h4>13.5. Downstream Usefulness</h4><p>A CreativeSnapshot should be useful to multiple downstream consumers without being tied to one use case.</p><p>Policy enforcement may use it to warn, blur, label, or block. Transparency systems may use it to explain what appeared on a page. Scam detection models may use it for OCR and visual analysis. Creative QA systems may use it to verify rendering. Researchers may use it to build structured datasets.</p><p>This is why the snapshot should include text, image references, geometry, selected metadata, access mode, extraction notes, and privacy metadata where available.</p><blockquote><strong><em>Final takeaway:</em></strong><em><br>A trustworthy extraction system balances fidelity, browser constraints, privacy, performance, and downstream usefulness. It does not try to capture everything. It captures the right creative artifact, at the right boundary, with the right explanation.</em></blockquote><h3>14. Downstream Use Cases</h3><p>The detection and extraction system is intentionally reusable. Its output can serve many downstream consumers without embedding those consumers into the detector itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L0aM1eLXZ6cDMzTpUbZB-w.png" /></figure><h3>15. Final Takeaway</h3><p>A browser-side creative intelligence system begins with detection and extraction. Detection identifies likely advertising or promotional surfaces. Extraction converts those surfaces into stable local artifacts that downstream systems can analyze.</p><p>That separation is important. A policy engine may later decide to warn, blur, block, or label. A research system may catalog the creative. A QA system may verify rendering. A brand-safety system may evaluate placement quality. A scam-detection model may classify risk. But all of those systems depend on the same foundation: find the creative accurately, extract it safely, describe what was captured, and preserve enough structure for downstream analysis without over-collecting the page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mbd_8Qyd4U-iehxBI7mtTw.png" /></figure><h3>References</h3><p>MDN Web Docs. <a href="https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver">MutationObserver</a>.</p><p>MDN Web Docs. <a href="https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API">Intersection Observer API</a>.</p><p>MDN Web Docs. <a href="https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver">ResizeObserver</a>.</p><p>MDN Web Docs. <a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM">Using shadow DOM</a>.</p><p>MDN Web Docs. <a href="https://developer.mozilla.org/en-US/docs/Web/Security/Defenses/Same-origin_policy">Same-origin policy</a>.</p><p>MDN Web Docs. <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe">&lt;iframe&gt;: The Inline Frame element</a>.</p><p>Chrome for Developers. <a href="https://developer.chrome.com/docs/extensions/reference/api/declarativeNetRequest">chrome.declarativeNetRequest API.</a></p><p>Adblock Plus Help Center. <a href="https://help.adblockplus.org/adblock-plus-help-center/how-to-write-filters">How to write filters</a>.</p><p>MDN Web Docs. <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-label">Document Object Model (DOM).</a></p><p>MDN Web Docs. <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-label">ARIA: aria-label attribute</a>.</p><p>uBlock Origin Wiki. <a href="https://github.com/gorhill/uBlock/wiki/static-filter-syntax">Static filter syntax.</a></p><p>AdGuard Knowledge Base. <a href="https://adguard.com/kb/general/ad-filtering/create-own-filters/">How to create your own ad filters</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3252676c24db" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>