<?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 Augusto Peres on Medium]]></title>
        <description><![CDATA[Stories by Augusto Peres on Medium]]></description>
        <link>https://medium.com/@augusto.peres_57056?source=rss-b1d531ad8c39------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*KHaRds04qcun7rMP</url>
            <title>Stories by Augusto Peres on Medium</title>
            <link>https://medium.com/@augusto.peres_57056?source=rss-b1d531ad8c39------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 19:57:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@augusto.peres_57056/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[Doing More by Storing Less: Speeding Up Real-Time Machine Learning]]></title>
            <link>https://medium.com/feedzaitech/doing-more-by-storing-less-speeding-up-real-time-machine-learning-23639ae00e22?source=rss-b1d531ad8c39------2</link>
            <guid isPermaLink="false">https://medium.com/p/23639ae00e22</guid>
            <dc:creator><![CDATA[Augusto Peres]]></dc:creator>
            <pubDate>Thu, 19 Nov 2026 15:40:40 GMT</pubDate>
            <atom:updated>2026-11-19T15:40:40.687Z</atom:updated>
            <content:encoded><![CDATA[<p>Modern fraud detection systems rely heavily on tracking behavior over time. For example:</p><p><strong><em>How much money has a person spent this month? Or, how many purchases have they made in the last week?</em></strong></p><p>Any event-streaming system worth its salt tracks hundreds of such metrics. Every time a new transaction even arrives, these are retrieved from a database, updated, and then written back to persistent storage. This process is known as the <strong>read-modify-write</strong> cycle, and its final write stage is a major source of latency, database contention, and infrastructure cost.</p><p>But here is the catch: In many financial applications, a small set of <em>heavy-hitter </em>entities triggers most of these cycles and accounts for a disproportionate number of transactions.</p><p>Statistically, the more events we process for any entity, the less information each individual event adds to their overall profile. Thus, here at Feedzai we developed a process and system that automatically stops writing every single event for large financial entities, saving significant compute without losing downstream ML accuracy.</p><h3>A friendly introduction to feature profiles</h3><p>Before we go any deeper into discarding events, we briefly explain what <strong>feature profiles</strong> are. Essentially, feature profiles aggregate events over a period of time. Two common examples are:</p><ul><li><strong>Counts</strong>: How many times have we seen an entity doing <em>something</em>? e.g., the number of transactions for a specific debit card in the last month.</li><li><strong>Sums</strong>: The running total of a quantity associated with an event, e.g., the total spend of a user in the last week.</li></ul><p>In a real-time fraud detection system, when a single event arrives, the feature profiles for its associated entity must be retrieved from persistent storage, (e.g., a relational database or key-value store). Then, the profiles must be updated with the information on the new event. Next, the updated profiles are sent to a Machine Learning inference service for classification (e.g., fraud or not fraud) and written back to persistent storage.</p><p>The first few steps in the pipeline are unavoidable in a well-functioning system. You are required to read what is stored on disk, and every transaction event must be sent for classification. However, we argue that the final step for serialization and mutation into persistent storage can often be skipped, and doing so effectively decouples the inference path (reading, updating, and scoring) from the persistence path (saving to disk).</p><p>This matters because this last step is a major source of latency contention, where multiple workers coordinate access and execute write jobs to databases.</p><h3>Deciding what to discard</h3><p>How do we choose which database updates to skip? Consider this thought experiment: You are tracking the daily spend of two entities (e.g., their daily <strong>sum</strong> of transaction amounts). Entity A makes roughly 10,000 purchases a day, while Entity B makes about two.</p><p>If you are forced to skip some database updates to save system resources, intuitively, skipping a few events from the high-volume entity (Entity A) will impact your overall math a lot less than skipping events from the small entity. Because Entity A has such high volume, updating its profile on the 10,001st transaction yields diminishing returns. The more events you have to draw statistical estimates, the less information each event carries.</p><p>Thus, an effective filtering system should prioritize saving every single update for entities with low transaction volume. This is achieved in two steps:</p><ol><li><strong>Set a speed limit:</strong> We choose a threshold for how fast we want to write to the database. For example: “Our system will process no more than 10 database writes per millisecond, per entity.”</li><li><strong>Randomize writes:</strong> If a cardholder or merchant transacts below that threshold, we write every event to the database. . If they cross the threshold, we probabilistically discard database updates. The higher their volume, the lower the “inclusion” probability for writing any single event to disk.</li></ol><p>A common heuristic for calculating the <strong>inclusion probability</strong> is to divide your speed limit, or threshold, by the entity’s actual event arrival rate. For example, if a merchant generates 2000 events per second, and your system threshold is 1000, we process every incoming event with a 50% probability (a coin flip). In expectation, only 1,000 events trigger a full read-modify-write cycle. We call this process <strong>event filtering</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*B4b3RyjsB_lAQjRjh1EAbg.gif" /></figure><p>This setup suits fraud detection use cases where transaction volume per entity follows a power law. That is, a small set of financial entities account for the majority of events in any observable stream. As such, when event filtering is applied, aggregations for most entities remain unaffected. Only the entities with substantial transaction volumes lose database updates.</p><h3>Correcting for discarded events</h3><p>Wait…</p><p><strong><em>If we don’t save all the events to the database, won’t our feature profiles be wrong?</em></strong></p><p>Yes, but only if we update the profiles naively. Let’s go back to our merchant doing 2 thousand events per second. If we save their data only 50% of the time, our “Count” and “Sum” profiles will be only half of what they should be.</p><p>The fix is simple: we <strong>scale the contribution</strong> of the events that trigger updates by the inverse of their inclusion probability. If we are only keeping 1 out of every 2 events (50%), we count the kept event twice. We add “2” to the transaction count instead of “1”, and we double the dollar amount of transactions before adding them to the running sum. This mathematically corrects the profile to account for the events we intentionally ignored.</p><h3>Doing this without adding memory overhead</h3><p>But…</p><p><strong><em>Does this mean we have to track the arrival rate of every single entity in memory, to know what their disk-write probability should be?</em></strong></p><p>Yes! However, we can replace the true estimate of the arrival rate with a proxy, e.g., an hourly count, which is itself a persistence-path element of the feature profiles.</p><p>Moreover, in our system, these arrival rates are updated using the same filtering rules:</p><ol><li>We recover the arrival rate from a database.</li><li>We update the rate in memory.</li><li>We compute the probability of writing it back to disk.</li><li>If we write it to disk, we scale the rate up to cover the events we missed.</li><li>If we skip the write, the persisted rate stays the same.</li></ol><p>Intuitively, this keeps arrival-rate estimates anchored to their true value. If we accidentally overestimate an entity’s speed, the system lowers its coin-flip probability. Because the probability is now lower, we start skipping updates. Thus, the system begins to underestimate their speed on the next check, which raises the probability and triggers more updates again.</p><p>By using filtered statistics to make the filtering decisions, the system acts like a self-stabilizing thermostat, constantly auto-correcting itself so the estimates never drift far from reality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*NaPngqsj3oA7TOn3OWv_wQ.gif" /></figure><h3>But what about downstream model performance?</h3><p>By now, you’ve noticed that by skipping events, the numbers stored in the database are estimations, not exact pennies-and-cents totals. The natural question is:</p><p><strong>How useful are these estimations for actually catching fraud?</strong></p><p>The short answer is: <strong>Very useful</strong>. The plot below shows model performance at different event-filtering volumes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TiPNNchu9UdAcioABzN3BQ.png" /></figure><p>As you can see, even when we filter heavily, the model’s accuracy doesn’t drop. In some specific cases, we actually saw a small increase in predictive performance. <strong>Why? </strong>Because training a machine learning model on slightly randomized, filtered data introduces “training noise.” This forces the model to learn broader, more robust patterns rather than memorizing exact numbers.</p><h3>Conclusion</h3><p>In this post, we covered:</p><ul><li><strong>The Power-Law Effect: </strong>As an entity’s transaction volume explodes, each event adds less relevant statistical information to its behavioral profile.</li><li><strong>The Fix: </strong>We can leverage this to cap the number of expensive read-modify-write cycles our database performs.</li><li><strong>Stateless Tracking: </strong>We can make these filtering decisions using the filtered data itself, creating a self-correcting loop without expensive in-memory tracking.</li><li><strong>The ML Bonus: </strong>Downstream fraud detection models aren’t hurt by this data filtering — and sometimes, the added noise actually makes them smarter.</li></ul><h3>Further reading</h3><p>Interested in learning more? Read the full paper <a href="https://arxiv.org/abs/2606.16981">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23639ae00e22" width="1" height="1" alt=""><hr><p><a href="https://medium.com/feedzaitech/doing-more-by-storing-less-speeding-up-real-time-machine-learning-23639ae00e22">Doing More by Storing Less: Speeding Up Real-Time Machine Learning</a> was originally published in <a href="https://medium.com/feedzaitech">Feedzai Techblog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>