<?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[ogury-engineering - Medium]]></title>
        <description><![CDATA[Fueled by data. Grounded in privacy. - Medium]]></description>
        <link>https://medium.com/ogury-engineering?source=rss----ac2745efe76b---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>ogury-engineering - Medium</title>
            <link>https://medium.com/ogury-engineering?source=rss----ac2745efe76b---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 09:59:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/ogury-engineering" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Act 3 — Overview of Speed-Threshold core elements & architecture]]></title>
            <link>https://medium.com/ogury-engineering/overview-of-speed-threshold-core-elements-architecture-act-3-cbf18e70ad63?source=rss----ac2745efe76b---4</link>
            <guid isPermaLink="false">https://medium.com/p/cbf18e70ad63</guid>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[advertising]]></category>
            <category><![CDATA[adtech]]></category>
            <category><![CDATA[optimization-algorithms]]></category>
            <dc:creator><![CDATA[Willy Ayissi]]></dc:creator>
            <pubDate>Mon, 26 Feb 2024 16:07:21 GMT</pubDate>
            <atom:updated>2024-02-29T13:13:13.891Z</atom:updated>
            <content:encoded><![CDATA[<h3>Act 3 — Overview of Speed-Threshold core elements &amp; architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KB4gZY9Gf9tgft5e" /><figcaption>Photo by <a href="https://unsplash.com/@homajob?utm_source=medium&amp;utm_medium=referral">Scott Graham</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><ul><li><a href="https://wdechanelo.medium.com/366a84e41a1d">Medium</a></li><li><a href="https://wdechanelo.medium.com/6eab79108c50">Medium</a></li></ul><h3>Operational Process &amp; Architecture</h3><p>In order to understand the full process of Speed-Threshold, let’s consider an example where we received as described on the workflow below a new Ad request at time t (t between 0 and 1440 minutes in a day). The initial action done in our Delivery System is to <strong>identify all the potential Ad Campaign candidates</strong> for this Ad request.</p><p>Subsequently, these candidates undergo Speed-Threshold <strong>pre-filtering steps</strong> and services like Brand Safety or Fraud Detection for instance.</p><blockquote>Brand Safety ensures that Ad Campaigns candidates and inventories meet quality and content standards, protecting our advertisers’ brand reputation. Likewise, fraud detection identifies and excludes fraudulent or non-compliant candidates or inventories, ensuring the integrity of our Ad Delivery ecosystem.</blockquote><p>Once this pre-filtering process is complete, the remaining candidates enter the <strong>core Speed-Threshold process</strong>. This process can be decomposed into two main stages for each Ad Campaign candidate:</p><ul><li><strong>Stage 1</strong>: <strong>compute a composite score</strong> that qualifies the match between the candidate and the Ad Request. This also implies retrieving the Ad Campaign Pacing Data such as the Ad Campaign Delay and Threshold computed by the PID controller (<em>computation for both threshold and composite score are detailed in next sections</em>).</li><li><strong>Stage 2:</strong> <strong>filter candidates</strong> where the composite score doesn’t meet the Ad Campaign Threshold requirement (i.e <strong>composite score &lt; threshold).</strong></li></ul><p>This process not only maintains Ad Campaigns’ pacing by controlling the volume of associated inventories but also ensures that Ad Campaigns are delivered on the highest-performing Ad Requests, as the composite score is directly linked to Ad Campaign performance.</p><blockquote>Once completed, the Delivery System proceeds to the <strong>post-speed-threshold filtering steps</strong> for the remaining candidates, which<strong> involves the selection of either one single Ad Campaign or no Ad Campaign for the Ad Request</strong>.</blockquote><blockquote>It is important to note that the decision of the Delivery System to not respond, meaning no candidate passing the delivery filters, is normal and in most cases is the most reasonable outcome.</blockquote><blockquote>In many cases, it is more strategic to wait for a better request later rather than engaging with a suboptimal one (as mentioned earlier in the article, we received more than 3 billions Ad Requests per day, so much more than what is actually needed).</blockquote><blockquote>This can also happen in cases where candidates eligible to the request are already over delivering (in advance to the schedule).</blockquote><p>If a candidate is selected then we push the delivery of the ad onto the publisher’s UI (website / app) corresponding to the request and we increment the counters. Here, the Speed-Threshold comes again to compute the new pacing data (threshold and delay) and updates the information in the dedicated data storage (<em>all those steps are presented in the workflow below</em>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-4sl9o9fECeXUzGD" /></figure><h3>How do we compute the composite score ?</h3><p>As mentioned above, the composite score is a ponderation of the quality. It is a weighted average of several scores, and it qualifies the matching between an ad request and a campaign candidate. There are several scores used for its computation, including :</p><blockquote>→ The <strong><em>Audience Score</em></strong>: the matching rate between the campaign description and the asset of the ad request</blockquote><blockquote>→ The <strong><em>Accomplish Rate</em></strong>: the probability of achieving the campaign objective with the ad request</blockquote><blockquote>→ The <strong><em>Diversity Score</em></strong>: a penalty score that ensures that the campaigns don’t always deliver on the same assets.</blockquote><p>In addition to the weighted average, we also include in the Composite Score, a coefficient related to the pacing of the publishers corresponding to the request as shown in the following formula</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sKLFXEyCjh7hLCwT" /></figure><p><em>Where W represents the the vector of score weights</em></p><p><em>T(r) represents the threshold from the publishers pacing data</em></p><h3>How do we compute Ad Campaign Dynamic Threshold ?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EkA4tiTcSXExZ8V6" /></figure><p>To understand the computation of the Ad Campaign Dynamic Threshold it is essential to deep dive into the functioning of PID regulators. But before that, let’s revisit the concept of Ad Campaign Pacing, which relates to the alignment between the actual budget spent and the scheduled budget. One way to quantify the pacing of an <strong><em>Ad Campaign c</em></strong> at <strong><em>time t</em></strong> is by using the delay metric <strong><em>D(c, t)</em></strong>, which represents the ratio of the actual spent budget to the scheduled budget. This metric helps assess how closely the campaign is adhering to its budgetary schedule.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/0*CL_F6ocjwy-EyWeo" /></figure><p>Understanding the delay metric <strong><em>D(c,t)</em></strong> is crucial for Ad Campaign pacing.</p><blockquote>→ If <strong>D(c, t) = 1</strong>; it means that the campaign’s actual spending aligns perfectly with the scheduled budget, representing <strong>on-time pacing</strong>.</blockquote><blockquote>→ If <strong><em>D(c, t) &gt; 1</em></strong>; it suggests <strong>overdelivery</strong>, indicating the campaign is progressing faster than planned.</blockquote><blockquote>→ If <strong><em>D(c, t) &lt; 1</em></strong>; it implies <strong>underdelivery</strong>, signifying a lag in campaign progress according to the schedule.</blockquote><p>The objective is to minimize deviations from 1, as this ensures that Ad Campaigns are delivered efficiently and in line with their schedules. Thus, <strong>the setpoint (or goal) of each Ad Campaign regulator is then 1</strong>. So the regulator’s objective is to try to keep the Ad Campaign as close to that value as possible. In order to do so:</p><blockquote>→ <strong>At the initial time step (t = 0)</strong>, PID regulators start by initializing threshold values for each campaign.</blockquote><blockquote>→ <strong>As time progresses <em>(t &gt; 0)</em></strong>, regulators compute the error <strong><em>e(t)</em></strong> as the difference between the <em>setpoint</em> and the <em>actual delay </em><strong><em>D(c, t)</em></strong>, then adjust the campaign threshold using a correction term <em>u(t)</em> computed using the proportional, the integral and the derivative gain.</blockquote><pre>Speudo Code &gt; Speed-Threshold PID Regulation for Ad Campaigns<br>------------------------------------------------------------<br>Input: Set of active Ad Campaigns C, Time T<br>Output: Optimized threshold values for each Ad Campaign over time<br><br>1: Initialize:<br>   For each campaign c ∈ C:<br>      Initialize threshold value θ_c(0) // at time t=0<br>2: For each time step t ∈ {1, 2, ..., T}:<br>     For each campaign c ∈ C:<br>         a. Compute the delay D(c, t):<br>            D(c, t) = Budget_spent(c, t) / Budget_scheduled(c, t)<br>            // Budget_spent(c, t) is the actual amount spent for campaign c up to time t<br>            // Budget_scheduled(c, t) is the scheduled budget for campaign c up to time t<br>         b. Compute the current error e_c(t):<br>            e_c(t) = Setpoint - D(c, t) <br>            // Setpoint is the desired pacing ratio<br>         c. Compute the correction term u_c(t) for campaign c:<br>            u_c(t) = K_p * e_c(t) + K_i * ∑ e_c(τ) + K_d * (e_c(t) - e_c(t-1))<br>            // K_p, K_i, K_d are proportional, integral, and derivative gains respectively<br>            // ∑ e_c(τ) is the sum of past errors up to time t (discrete integral)<br>            // (e_c(t) - e_c(t-1)) is the discrete derivative of error at time t<br>         d. Update the campaign threshold:<br>            θ_c(t) = θ_c(t-1) + u_c(t)<br>            // Update threshold based on previous value and correction term<br>3: Return updated thresholds θ_c(T) for each campaign c at final time T</pre><p>At <em>time t</em>, the proportional gain Kp will capture the pacing error <em>e(t)</em> between the pacing setpoint (=1) and the actual delay at time t. The relationship between the <em>Proportional</em> gain and the corrective term to applied to the threshold is given by the formula:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/292/0*Fd4PJ18kHpGDwOWi" /></figure><p>The <em>Integral</em> gain on its side will sum the past pacing errors e(t) until <em>time t</em> to reduce the discrepancies and the steady state error. Therefore, g(t) above can be rewritten as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/0*lfIUSUCWxqfE_9fh" /></figure><p>The <em>Derivative</em> component tries to anticipate the future pacing errors by measuring the “slope” or the rate of change of the pacing error. Thus, the function gamma(t) can deduced and u(t) rewritten as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/0*DZ21RwZW1HHMaQls" /></figure><p>Finally, the corrective term is then used to update the campaign threshold at each time step, hence assuring the campaign pacing each time.</p><blockquote>Note that Kp, Ki, and Kd are adjustable parameters that significantly affect the performance of the PID controller. To determine the optimal parameters for our delivery problem, we currently employ an offline trial-and-error approach.</blockquote><blockquote>This involves using historical data and conducting hyperparameter optimization using well-known techniques such as UCB and TPE. For more information, you can refer to this (for more info you can check : <a href="https://arxiv.org/pdf/2304.11127.pdf">https://arxiv.org/pdf/2304.11127.pdf</a>)</blockquote><h3>On-going Improvements</h3><p>The main limit of this approach (to optimize budget pacing with regulators) resides on the PID parameter tuning. In fact, as described above, we are using an offline trial and error approach which is suboptimal for several reasons</p><ul><li>H<strong>yper-parameterization is done offline</strong> and with a limited amount of data. In fact, we replicate a part of the delivery system and then try to find the best parameters for all the campaigns (like campaign regulation for example). Hence, the system doesn’t get feedback from the “real world”, we can’t then guarantee that the parameters are optimal when used them in production</li><li><strong>“Guess and check” approach we used is limited</strong>: In the partial delivery implementation, we apply a grid search approach and iterate over the different combinations to find the best parameters within the predefined set with grid search. This approach is also limited, because there is no guarantee of convergence.</li><li><strong>Identical PID parameters for all the campaigns</strong>: different campaigns actually have different business context and features/characteristics, so they should be treated differently but the current implementation uses the same PID parameters for all the campaign regulators (the optimal parameters for one campaign are most probably different for another).</li></ul><p>For all those reasons, we are currently testing new strategies for PID coefficients hyper-parameterization per campaign, one of which is a Reinforcement Learning based solution to optimise more accurately PID controllers’ settings for each campaign. The main idea is to implement a custom agent, observing the “state” of the global delivery system and adjusting regulators’ parameters in real time.</p><p>We will explore this topic in depth in an upcoming article. Stay tuned !!!</p><p>Meanwhile, feel free to suggest new approaches, we would be glad to get your feedback! :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cbf18e70ad63" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ogury-engineering/overview-of-speed-threshold-core-elements-architecture-act-3-cbf18e70ad63">Act 3 — Overview of Speed-Threshold core elements &amp; architecture</a> was originally published in <a href="https://medium.com/ogury-engineering">ogury-engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Act 2 — Introduction to Speed-Threshold, A custom solution for Ad Delivery leveraging principles of…]]></title>
            <link>https://medium.com/ogury-engineering/introduction-to-speed-threshold-a-custom-solution-for-ad-delivery-leveraging-principles-of-control-6eab79108c50?source=rss----ac2745efe76b---4</link>
            <guid isPermaLink="false">https://medium.com/p/6eab79108c50</guid>
            <category><![CDATA[optimization-algorithms]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[advertising]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[adtech]]></category>
            <dc:creator><![CDATA[Willy Ayissi]]></dc:creator>
            <pubDate>Mon, 26 Feb 2024 15:58:57 GMT</pubDate>
            <atom:updated>2024-02-26T16:08:30.559Z</atom:updated>
            <content:encoded><![CDATA[<h3>Act 2 — Introduction to Speed-Threshold, A custom solution for Ad Delivery leveraging principles of control systems</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hqyKe51RsfZ0S3xx" /><figcaption>Photo by <a href="https://unsplash.com/@diggitymarketing?utm_source=medium&amp;utm_medium=referral">Diggity Marketing</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><a href="https://wdechanelo.medium.com/366a84e41a1d">Medium</a></p><h3>Speed-threshold Description</h3><p>As mentioned in the <a href="https://wdechanelo.medium.com/366a84e41a1d">previous article</a>, the <strong>Speed-threshold</strong> is tailored to tackle the challenges of our Ad Delivery System, and its implementation leverages the principles of <em>Control Systems</em>, especially the ones from a sub-family known as <a href="https://en.wikipedia.org/wiki/Proportional%E2%80%93integral%E2%80%93derivative_controller">PID controllers</a>. PID Controllers, which stands for <strong><em>Proportional</em></strong>, <strong><em>Integral</em></strong> and <strong><em>Derivative</em></strong> controllers, are sophisticated feedback mechanisms used to maintain the system around a desired output (or setpoint), by applying three distinct types of control actions corresponding to the 3 components (Proportional, Integral and Derivative controllers).</p><blockquote>The <strong>Proportional component</strong> responds to the current error, which corresponds to the deviation from the desired output (difference between the desired output and the current output of the system). In fact, the proportional component adjustment is computed by scaling the error with a factor Kp (known as the proportional Gain). This adjustment helps the system to reduce the overall error on the next time-step.</blockquote><blockquote>The <strong>Integral part </strong>accumulates the past errors over time in order to address any persistent discrepancies. In this case, the adjustment is obtained by summing the past errors over time and scaling the result using a factor Ki (known as the Integral Gain). This adjustment is designed to counteract any persistent discrepancy that the proportional component alone can’t address, thereby bringing the system’s output closer to the desired setpoint.</blockquote><blockquote>The <strong>Derivative component</strong> on its side tries to predict the future errors based on the rate of change of the current error.</blockquote><p>One practical application of <em>PID controllers</em> in an industrial system could be the regulation of temperature of a chemical reactor. In this scenario, the <em>PID controller</em> continuously compares the reactor’s actual temperature with the desired output (or setpoint) temperature. The <em>Proportional</em> component of the controller will hence compute the error (i.e the difference between these temperatures and make adjustments) to reduce this gap. The <em>Integral</em> part accumulates past temperature deviations, aiding in correcting any accumulated drift over time. The <em>Derivative</em> segment, meanwhile, predicts future temperature changes based on current trends, allowing for preemptive adjustments. This methodology ensures that the temperature of the reactor remains stable and at the optimal level for the chemical process, despite external influences or internal changes. Nowadays, PID controllers are widely used outside industrial systems especially to solve online optimisation problems.</p><p>The PID controller’s ability to adapt to changing conditions and its precision in maintaining a target parameter is what we wanted to replicate at each campaign level in our <strong>‘Speed-Threshold’</strong> algorithm for Ad Delivery. Just as the PID controller keeps the reactor’s temperature within a narrow range to ensure product quality and process safety, our algorithm <strong>dynamically adjusts</strong> and <strong>regulates </strong>Ad Campaign Budget Pacing for each Ad Campaign and Publisher Objective Pacing for each publisher in <strong>real-time</strong> while managing all the other constraints mentioned above.</p><p>This proxy optimal performance and efficiency in our Ad Delivery system while managing key technical constraints like <strong>latency</strong>, <strong>effectiveness</strong>, and <strong>scalability.</strong></p><blockquote>→ <strong>Effectiveness</strong> assumes the system needs to be both <em>proactive</em> and <em>reactive</em>; <em>proactive</em> by taking into account the campaign’s budget and the publisher’s objectives, and <em>reactive</em> in the selection of the campaign once we decided to respond to an Ad Request.</blockquote><blockquote>→ <strong>Latency</strong> reflects the fact that we have to decide in real time when and where to deliver every time we have incoming requests.</blockquote><blockquote>→ <strong>Scalability</strong> finally, as the system has to be easily scalable to a large volume of Ad Requests and Ad Campaigns impressions (at Ogury we received billions of ad requests per day, hence our algorithm needs to be applicable for large data scale).</blockquote><p>The <strong>Speed-Threshold</strong> algorithm is named to emphasize two key functionalities:</p><ul><li>‘<strong>Speed</strong>’ designates the <strong>pacing</strong> functionality of both Ad Campaigns and Publishers Revenue Objectives critical for Ogury Delivery System.</li><li>‘<strong>Threshold</strong>’ designates the process of <strong>decision-making</strong> or <strong>filtering</strong> that involves the pairings of inventories with Ad Campaigns.</li></ul><p>Thus, its primary goals are to smoothly deliver Ad Campaigns within their budget on the Demand side and to meet revenue objectives for publishers on the Supply side, while satisfying all technical requirements presented above, and schematized as below (Fig 1. Ogury’s Delivery Constraints)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/0*L29n5gCopuFqeD35" /></figure><h3>Well, but how does Speed-Threshold work?</h3><h4>Data Requirements</h4><p><strong>Speed-Threshold</strong> works by meticulously accessing and updating a variety of real-time data sources. This process is critical for aligning our Ad Delivery with the rapidly changing dynamics of our Advertising ecosystem. The system continually retrieves data from Ad <strong>Campaigns and Publishers Configurations</strong>.</p><blockquote>This includes specific details such as <em>the Ad Campaign duration, the Ad Campaign Budget and Publisher Revenue Objectives</em>.</blockquote><p>In addition to accessing Ad Campaigns and Publishers Configurations, Speed-Threshold also tracks real-time data on the budget already spent and the number of impressions delivered for each Ad Campaign. This information is accessed by Speed-Threshold through <strong><em>Ad Campaigns Counters</em></strong>.</p><blockquote>By integrating this data, Speed-Threshold can make more accurate and real-time decisions, vital for maintaining the efficiency and effectiveness of the Ad Delivery system.</blockquote><p>Speed-Threshold actively updates several data sources, crucial for keeping the system aligned with the current state of Ad Campaigns and Publishers Objectives. It recalculates <strong><em>Ad Campaigns daily budget schedule</em></strong>, breaking it down to minutes through time series algorithms which is essential for maintaining Ad Campaigns Pacing. Similarly, it computes minute-by-minute breakdowns of <strong><em>Publishers’ daily objectives schedule</em></strong>, ensuring that the Supply side of the system is accurately represented and managed.</p><blockquote>Each time step, the Delivery System uses information from Ad Campaigns Counters to compute the <strong><em>Ad Campaign Delay,</em></strong> the gap between the effective number of billed events and the scheduled number of billed events. Same for the Publishers Objectives Pacing data.</blockquote><h4>Ensuring the Campaign Pacing with PID Controllers</h4><p>In the introduction, we presented the delivery problem as a mapping problem. This mapping problem can be described by a function <em>f(r)</em> that maps Ad requests to Ad Campaigns. Considering this formalization, we can clearly establish that our function will be <strong>surjective</strong>, which means that each active Ad Campaign has to be mapped to an Ad inventory. In contrast, not all Ad Requests have to be filled with Ad Campaigns, the decision system can then clearly decide not to respond to an Ad Request. However, an Ad Campaign can be a candidate to several Ad Requests at the same time (meaning that our function <em>f(r)</em> is not <strong>injective</strong>).</p><blockquote>Therefore, we can deduce that at a given timestep t, while an <strong><em>Ad Request can exclusively be paired to one Ad Campaign, an Ad Campaign can be associated to several Ad Requests</em></strong>.</blockquote><p>This property highlights the importance of the number of Ad Requests associated with an Ad Campaign, when managing Ad Campaigns Schedule throughout the time. In fact, at each time step, we could actually <strong>control</strong> the Ad Campaign Pacing (difference between the scheduled and the actual number of impressions for each Ad Campaign) by <strong>regulating </strong>the number of inventories paired with it accordingly.</p><blockquote>Hence, at each time step ,when the actual number of impressions is ahead of the scheduled value for an Ad Campaign, we could decrease the volume of Delivery (i.e. ad delivered) for that Ad Campaign by <strong>lowering the volume of inventories</strong> where the Ad Campaign is a candidate. Conversely, when the actual value is below the targeted number, we could <strong>increase the volume of Ad Requests</strong> where the Ad Campaign is a candidate.</blockquote><p>These control and regulation tasks are done in Speed-Threshold using the PID controllers. In fact <strong>we associate a PID regulator to each Ad Campaign</strong>, which is tasked to <strong>control</strong> the Ad Campaign and <strong>regulates</strong> the volume of Ad Requests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pgpSZk9TnlKkwOXa" /></figure><p>However, adjusting the volume of Ad Requests alone is not enough to guarantee the pacing of the Ad Campaign. In fact, while <strong>an impression is guaranteed </strong>(except if there is a loading error), the<strong> engagement of the end user receiving the Ad Campaign on his device isn’t guaranteed</strong>. An Ad Campaign displayed on an Ad Placement doesn’t necessarily imply a <em>billed event</em> (the end user receiving the Ad Campaign will not necessarily engage with the Ad by viewing the video until the end nor click on the Ad).</p><p>Since <strong>Ogury pays Publishers for Impressions on the one hand and gets paid by Advertisers for billed events</strong> (impressions, clicks or video views, according to negotiated contract);</p><blockquote>the Delivery System needs to make sure that the budget spent for impressions on inventories meets the performance objectives of Ad Campaigns (number of billed events).</blockquote><p>To achieve this, <em>Speed-Threshold</em>, when regulating Ad Requests volume for Ad Campaigns, also takes into account the probability of achieving a billed event for one Ad Placement impression. This probability called <strong><em>accomplished rate*</em></strong> is used to update the Ad Campaign Schedule and is integrated into the regulation process through a “<strong><em>composite score”</em></strong> used to qualify the match between Ad Campaigns and Ad Requests. This composite score, computed by Speed-Threshold, is used to filter Ad Requests for Ad Campaigns.</p><blockquote>In fact, Speed-Threshold filters Ad Requests at the Ad Campaign level by comparing the composite score to a<strong> <em>dynamic Ad Campaign threshold</em></strong> provided by the Ad Campaign PID regulator.</blockquote><p>This <em>dynamic threshold</em> adjusts its value according to the Ad Campaign Pacing:</p><p>→ <strong><em>If the Ad Campaign is late according to the schedule</em></strong>, meaning we have less billed events than what was planned or scheduled at time t (time periods, where the delay curve is below the pacing objective; orange areas on the next graph), the <strong><em>Ad Campaign Threshold value is lowered</em></strong>. This enables the delivery system to be less restrictive by allowing more Ad Requests to be associated with the Ad Campaign to catch up on the delay for the next time steps.</p><p>→ <strong><em>If the Ad Campaign is in advance according to the schedule</em></strong>, meaning that the number of billed events is higher than what is required by the Ad Campaign configuration (time periods where the delay is above the pacing target; green areas on the next graph), the<strong><em> Ad Campaign Threshold is increased</em></strong>. This enables the delivery system to be more selective by reducing the number of Ad Requests to be associated with the Ad Campaign to reduce the overdelivery for the next time steps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hOkI2qR96Dt7GGSS" /></figure><p>This way the system ensures campaigns meet their daily budget (pacing) by prioritizing when possible, the best eligible requests using the threshold adjustments. However, these adjustments have a cascading effect on all campaigns. Increasing a campaign’s threshold reduces its eligibility, benefiting other campaigns with more available inventory. Conversely, lowering a threshold increases eligibility, potentially impacting other campaigns’ pacing by reducing available inventory. Therefore, the adjustment of one campaign’s threshold can significantly affect the pacing of other campaigns.</p><p>This interplay distinguishes our case from common PID controllers usage, where one controller manages one output. In the case of Speed-Threshold, multiple regulators (one per campaign) must simultaneously converge to optimize all Ad Campaigns’ pacing together.</p><h3>Challenge Encountered by Speed-Threshold: Interplay of Campaigns Pacing regulators — Demo</h3><h4>Simulation settings for the demo</h4><p>Various factors can greatly influence the interplay between Ad Campaigns. These include shifts in the competitive landscape brought about by the introduction or removal of campaigns, updates of Ad Campaigns’s Budget Schedule, fluctuations in available inventory volume, and changes in campaigns privileges, particularly their eligibility with publishers.</p><p>To illustrate these dynamics, let’s create a simple simulation of an Ad Delivery System (<a href="https://github.com/Ogury/ogury-public-resources/blob/023eae7981e2eceb77a7e60f478dabeb87f582a2/speed-threshold%20simulation/Speed-Threshold%20Simulation%20-%20Demo.ipynb">GitHub Notebook</a>) with four campaigns (c1, c2, c3 and c4) for one day. For this simulation we will only consider 2 publishers “A” and “B” where the amount of Ad Requests per minute is given by the following graph:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*phJRZLhxK6unI79B" /></figure><p>For the simulation, we assume as well that all campaigns in our simulated environment follow the same trend as shown on the following graph:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TX5E2ktr3dk-ZvVY" /></figure><p>In our simulation we explore four scenarios to demonstrate the interdependence of Ad Campaigns regulators :</p><ul><li><strong>Scenario 1</strong>: All campaigns can access inventories from both publishers.</li><li><strong>Scenario 2</strong>: Inventories from publisher “B” are exclusively allocated to campaign C4.</li><li><strong>Scenario 3</strong>: Like scenario 2, but two new campaigns C5 and C6 are introduced in <em>Scenario 2</em> at 10:00 a.m and 06:00 p.m respectively. Those two campaigns have to all publishers, introducing competition to C4 on inventories from “B”</li><li><strong>Scenario 4</strong>: Like scenario 3, but let’s imagine that the campaigns C2 and C3 are suddenly stopped within the day at 03:00 p.m and 09:00 p.m respectively.</li></ul><h4>Scenario 1: Naïve Case</h4><p>In the first scenario, where all campaigns have access to both publishers’ inventories, the simulation results demonstrated a consistent pacing curves across all Ad Campaigns.</p><p>Initially, the Ad Campaign Threshold for all campaigns starts at 3, the initialisation value. At this threshold, the campaigns’ delay drops abruptly from one to zero. Consequently, the <strong><em>Speed-Threshold</em></strong> algorithm <strong>reduces</strong> the threshold to zero, attempting to compensate for the accumulated delay until it gets close to the pacing line.</p><blockquote>This adjustment phase, occurring from 12 p.m to 2 a.m, represents the <strong>warm-up phase</strong> where the regulator struggles to determine the optimal threshold value that ensures consistent campaign pacing.</blockquote><p>After this warm-up phase, the threshold curves almost stabilise although we can observe some oscillations aligned to the delay curves which fluctuate around the pacing line. Specifically, when the delay curves are below the pacing line (<em>observed between 06:00 a.m to 09:00 a.m and 12:00 a.m to 02:00 p.m</em>), the associated thresholds also decrease concurrently. This indicates a less restrictive Speed-Threshold algorithm, which adjusts the campaigns’ thresholds to allow more incoming inventories. Conversely, when the delay curves are above the pacing line (<em>notably between 01:30 a.m and 03:00 a.m, 06:00 a.m to 09:00 a.m, and 02:00 p.m to 05:00 p.m</em>), the threshold curves rise, signifying a more selective Speed-Threshold algorithm. These variations reflect the regulatory mechanisms employed to synchronize each Ad Campaign with its Delivery Schedule.</p><blockquote>This scenario is the ideal case but in reality, there are several constraints that require our delivery system to be able to prioritize some campaigns over others and this can highly influence the system.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*l1xufNhy2pZj64bX" /></figure><h4>Scenario 2: Add privileges to some campaigns</h4><p>As mentioned above, in reality campaigns are not equally treated the same by the delivery system. In fact, considering brand safety or audience targeting, it might not make sense to display some inventory on some publishers</p><blockquote>for example, if we have an Ad Campaign with a target audience in Paris, displaying the Ad Campaign for a publisher with all inventories coming from Boston might not make sense.</blockquote><p>This new scenario aims to show how this impacts our delivery system. Allocating inventories from publisher B exclusively to Campaign C4, as we can observe in the next graph, has the consequence of disrupting significantly the delay and balance curves compared to the previous scenarios.</p><p>First, we can clearly notice that unlike the precedent scenario, we now have <strong>longer warm-up phases</strong> for campaigns without exclusive access unlike campaign C4. Also we can notice that <strong>all the campaigns except C4 are late most of the time</strong> (delay below the pacing line). This obliges the Speed-Threshold to lower the threshold values, resulting in lower threshold curves as observed on the graph.</p><blockquote>The graph also indicates a small increase at the end of the day for C2 and C1 of their threshold values as their delay curves approach the pacing target. This contrasts with the C3 threshold curve that stays down to zero although it finally reaches the pacing target at the end of the day. Those differences can be explained by the difference in volume of the delivery schedule between these 3 campaigns.</blockquote><p>This scenario demonstrates the substantial impact of granting exclusive privileges to specific Ad Campaigns within the Ad Delivery System.</p><blockquote>These privileges do not only influence the pacing of the concerned campaigns but also have cascading effects on the pacing of others, potentially reducing their pacing.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IoOn-yrIwZA4e2ik" /></figure><h4>Scenario 3: Add new campaigns within the day</h4><p>In this adjusted scenario, we consider a new constraint / event that often happens in Ogury’s Ad Delivery System: new campaigns are added by the Ad Ops and started in the middle of the day.</p><p>Thus, in order to simulate this aspect, the exclusivity previously granted to campaign C4 is here lifted with the introduction of two additional campaigns, C5 and C6 which become eligible for all inventories, irrespective of the publisher, at 10:00 a.m. and 06:00 p.m., respectively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HqrCoVaHJk5ZIkNB" /></figure><p>Prior to 10:00 a.m, the <strong>delay and threshold curves mirror those observed in the previous scenario</strong> (Scenario 2). Once C5 enters the game, although C4 continues to track close to the pacing objective, but with a threshold metric notably dips between 10:00 a.m and 01:00 p.m. But right after the <strong>threshold restarts it increases until 05:00 p.m</strong>.</p><blockquote>This is due to the fact that, C4 who previously had all inventories exclusively is now challenged by C6, so the Speed-Threshold reacts to that by adjusting its threshold to maintain it on track according to the schedule.</blockquote><p>On the other hand, we can notice that others campaigns are struggling even more, especially campaign C1 which reached the pacing in the 2nd configuration at 05:30 but now is still below the pacing curve on that same period of time.</p><blockquote>This can be explained by the fact that the arrival of C5 increased the competition for inventories from publishers A.</blockquote><p>The <strong>introduction of C6 accentuated those observations</strong>, by intensifying competition both for inventories from publisher A but also for publisher B.</p><blockquote>This even results in C3 and C2 finishing the day not respecting their delivery schedule. And Unlike the previous case, campaign C1, and C2 just as C3 thresholds’ now remained to zero.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dXpnCuFtZiRYrD97" /></figure><p>Scenario 3 reveals that introducing new campaigns during the day disrupts pacing and thresholds for existing campaigns.</p><blockquote>It underscores the intricacies of campaign interplay, showcasing how changes in campaign eligibility can have a domino effect on other campaigns performance, potentially negatively impacting their pacing due to the increase of competition for the existing inventories.</blockquote><h4>Scenario 4: Stop running campaigns within the day</h4><p>We mentioned that at Ogury campaigns can start at any time throughout the day, but it is also true that they can actually finish / stop in the middle of it. To represent that, this scenario simulates the abrupt halting of campaigns C2 and C3 during the day respectively at 03:00 p.m and 09:00 p.m.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*l0Av6t-a-alh0k80" /></figure><p>Before these interruptions, all campaigns behaved consistently with what we observed in the previous simulation case. We can observe that the interruptions had low impact on the campaigns already on Pacing but significantly helped the ones struggling, especially campaign C3 which in previous configurations suffered the most from the competition introduced by the arrival of new campaigns. Campaign C3, although it finishes the day on track with its schedule unlike in the previous simulation case, its threshold was not improved at all as it consistently remains at zero.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*d9Ms3aMZIeDFlGsS" /></figure><p>This scenario highlights how stopping certain campaigns during the day can lead to substantial impacts on the performance of the remaining campaigns.</p><blockquote>It underscores the interconnected nature of campaign dynamics within the Ad Delivery System, where the cessation of campaigns influences threshold levels and pacing metrics for others, leading to positive effects on their performance as this imply freeing more inventories for the live campaigns.</blockquote><h3>Conclusion: Speed-Threshold is tailored to react to the dynamic nature of Ad Delivery</h3><p>Speed-Threshold, as elaborated in the article and demonstrated through various scenarios, is specifically designed to adapt to the dynamic and complex nature of Ad Delivery. Its core functionality is rooted in the principles of PID controllers, which enables it to effectively manage and optimise the pacing and allocation of Ad Campaigns in real-time. This adaptability is crucial due to the constantly changing landscape of advertising, influenced by factors such as varying Ad Campaign budgets, shifting publisher objectives, and fluctuating volumes of Ad Requests.</p><p>The system’s design also incorporates the concept of thresholds, which are dynamically adjusted to manage the allocation of Ad Requests to different campaigns. This approach ensures that each campaign receives an appropriate share of Ad Requests, based on its current pacing status and the overall campaign strategy.</p><p>Furthermore, the introduction of scenarios like exclusive publisher access, introduction of new campaigns during the day, and sudden stops of running campaigns, showcases Speed-Threshold’s capability to handle complex interplays between different campaigns. The system effectively recalibrates itself to address these challenges, ensuring that the pacing of each campaign is optimised, regardless of the shifting competitive landscape.</p><p>In essence, Speed-Threshold’s ability to dynamically adjust to the real-time conditions of the advertising ecosystem makes it a highly effective tool for managing Ad Campaign delivery. Its application of PID controller principles in the context of Ad Delivery exemplifies a novel approach to handling the intricacies of ad exchange systems, ensuring that both the demands of advertisers and the objectives of publishers are met with precision and efficiency.</p><p>The <a href="https://wdechanelo.medium.com/cbf18e70ad63">next Article</a> focus on presenting the architecture and operational process of the Speed-Threshold algorithm.</p><p><a href="https://wdechanelo.medium.com/cbf18e70ad63">Medium</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6eab79108c50" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ogury-engineering/introduction-to-speed-threshold-a-custom-solution-for-ad-delivery-leveraging-principles-of-control-6eab79108c50">Act 2 — Introduction to Speed-Threshold, A custom solution for Ad Delivery leveraging principles of…</a> was originally published in <a href="https://medium.com/ogury-engineering">ogury-engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Act 1 — Optimization of competing interests: How Ogury maximizes value for both sides of an…]]></title>
            <link>https://medium.com/ogury-engineering/optimization-of-competing-interests-how-ogury-maximizes-value-for-both-sides-of-an-advertising-366a84e41a1d?source=rss----ac2745efe76b---4</link>
            <guid isPermaLink="false">https://medium.com/p/366a84e41a1d</guid>
            <category><![CDATA[optimization-algorithms]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[advertising]]></category>
            <category><![CDATA[adtech]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Willy Ayissi]]></dc:creator>
            <pubDate>Mon, 26 Feb 2024 15:58:35 GMT</pubDate>
            <atom:updated>2024-02-26T16:07:57.726Z</atom:updated>
            <content:encoded><![CDATA[<h3>Act 1 — Optimization of competing interests: How Ogury maximizes value for both sides of an Advertising marketplace</h3><p>At Ogury, our job is to bridge the gap between brands that want to drive marketing outcomes, and content publishers that monetize their websites or apps via ads. Our aim is to make the relationship between both possible, by helping our advertiser clients to run ad campaigns that suit their objectives while ensuring relevance and performance to our partner publishers. This is a complex task, which presents significant mathematical optimization challenges and requires complex algorithmic solutions.</p><p>If you want to know more about how that we are tackling those challenges, follow us along this three part journey as we describe the nature of the market and dive deep into potential solutions !!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6oJUw9hXXtqDFv4A" /><figcaption>Photo by <a href="https://unsplash.com/@austindistel?utm_source=medium&amp;utm_medium=referral">Austin Distel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Understanding the challenge of entire supply chain</h3><p>Maximizing performance across multiple constituencies in a network is a complex process. In advertising, it requires precise <strong>targeting</strong>, <strong>timing</strong> and <strong>optimization</strong> to ensure that the right advertisements reach the right <strong>audience</strong> at the right time in order to reach the best outcome. Knowing the audience, understanding the platforms where advertisements are placed and aligning with the advertisers goals are therefore the 3 main core elements for a successful and optimal <strong><em>Ad Delivery System*</em></strong>. At Ogury, this challenge can be pictured as a mapping task where we have two key players.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*c9etFU_65Z00OW-v" /></figure><ol><li>On one side of the marketplace, we have <strong><em>the Supply</em></strong>, which refers to the set of web properties and apps which expose advertising inventory, upon which advertisements can be placed, in exchange for financial returns. In some cases, <strong><em>publishers*</em></strong> might have customized objectives that they are seeking to meet. These objectives, when defined, are broken down into time periods (days or months) which together form a <strong>publishers’ objective schedule</strong>.</li><li>On the other side of the marketplace, we have <strong><em>the Demand</em></strong>, which consists of all the advertisers working directly or through a third party with Ogury to manage their digital <strong><em>Ad Campaigns*</em></strong>. For each ad campaign, advertisers define a desired duration, budget, the targeting criteria, and most importantly, the specific goal they intend to achieve with the campaign. The <strong><em>Ad performance criteria</em></strong>, usually referred to as the <em>number of billed events</em>, corresponds to the <em>target number of impressions</em>, the <em>target number of views</em> or the <em>target number of clicks</em> on Ad Campaigns. When an Ad Campaign is added to Ogury system, a budget schedule is computed with respect to the total budget of the advertisement campaign and the campaign duration. This <strong><em>Ad Campaign Budget Schedule</em></strong> will provide to the delivery system the budget to spend at each time-step throughout the life duration of the Ad Campaign. At each time step, <strong><em>Ogury Delivery System</em></strong> will then have to make sure for each Ad Campaign to respect that budget schedule and the target number of billed events.</li></ol><blockquote>The main goal of Ogury Delivery System is to find the <strong>most effective pairings</strong> between publishers’ inventories and the available ad campaigns that respect the Demand and Supply constraints.</blockquote><h3>Ad Delivery as an Optimization Problem</h3><p>This problem we are trying to solve could be related to a well known mathematical problem referred to as <a href="https://en.wikipedia.org/wiki/Constrained_optimization">Optimization Under Multiple Constraints</a>, where the goal is, as its name suggests, to optimise an <strong><em>objective function</em></strong> with respect to some variables in presence of constraints on those variables. In mathematical terms, this problem is often represented using equations and inequalities. Each constraint is formulated as an equation that the solution must satisfy. The objective function is then optimized according to the boundaries set by these constraints. The complexity resides in the fact that we have to balance multiple, sometimes conflicting constraints while trying to achieve the best possible outcome, which in our case is the <strong>optimal pairing</strong> of <strong><em>Ad Requests*</em></strong> with <strong><em>Ad Campaigns</em></strong> that <strong>maximizes</strong> the <strong><em>Ad performances*</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/0*L0VCF3xTP_0Dquix" /></figure><p>Therefore, the objective function in our context is a “composite score” that balances the interests of the Demand and Supply.</p><blockquote>→ For Demand, the focus is on achieving the Targeted Performance (number of billed events) for each Ad Campaign. Equally important is, as mentioned above, ensuring that during the Ad Campaign lifetime we follow the Ad Campaign Budget Schedule (that we do not exceed nor underspent). The metric used to measure this criteria is the <strong>Campaign Budget Pacing*</strong>, computed for each Ad Campaign by comparing the budget actually spent on all publishers to the scheduled budget at time-step.</blockquote><blockquote>→ Regarding Supply, the objective is to align with the Publisher’s Objectives. This is the role of the <strong>Publisher Objective Pacing* </strong>metric, which just like the Campaign Budget Pacing, is determined by comparing the actual expenditure on a publisher to the expected expenditure given by the Publisher Objectives Schedule.</blockquote><p>The constraints in our configuration can be summarized by 3 main elements namely, <strong><em>total number of Ad Campaigns</em></strong>, the <strong><em>total number of Ad requests</em></strong> received at each time step and the <strong><em>duration of the Ad Campaigns</em></strong>.</p><ul><li>The total number of Ad Campaigns is critical to know as there is competition between campaigns for the incoming Ad Requests.</li><li>Similarly the total number of Ad Requests is important as this provides the information to know whether there will be sufficient inventories to display all the Ad Campaigns according to Ad Campaigns Schedules.</li><li>The campaign duration is also a critical factor as this impacts the competition between Ad Campaigns and helps the system to plan the Demand according to the Supply.</li></ul><p>Considering this formalization of the Ad Delivery, there are 3 main challenges.</p><blockquote>→ The primary one involves the dynamic nature of Ad Campaigns on the Demand Side and inventories on the Supply Side. In fact, Ad Campaigns can be added at any time, so their number can change any time during the day, making it hard for the system to anticipate the total number of inventories that will allow us to be aligned with the schedule of all Ad Campaigns.</blockquote><blockquote>→ Additionally, Ad Requests are received in real-time, making it difficult also to anticipate the total amount of inventories (so, we don’t know beforehand whether we will have enough inventory to align with the Ad Campaigns Schedules).</blockquote><blockquote>→ Finally we have to comply with the fact that each publisher’s inventory can host one and only one single Ad Campaign.</blockquote><p>These three uncertainties combined with our limited predictions capabilities prevent us from solving the delivery problem offline using solutions generally applied to <strong><em>constrained optimization</em></strong> such as <a href="https://en.wikipedia.org/wiki/Linear_programming">linear programming</a>. <strong><em>Linear Programming</em></strong> is a method to achieve the best outcome in a mathematical model whose requirements are presented by linear relationships. It’s widely used for various applications, from business, economics to engineering, where the goal is to maximize or minimize an output in a well known environment (which is not our case as we don’t know in advance the number of Ad Campaigns for the Demand side and the number of inventories on the Supply side).</p><p>But, as explained previously, this method, albeit efficient, can not be really applied in our case due to the (hardly predictable) uncertainties we encounter at Ogury.</p><h3>Ad Delivery as a Reinforcement Learning Problem</h3><p><a href="https://en.wikipedia.org/wiki/Reinforcement_learning"><strong><em>Reinforcement Learning</em></strong></a><strong><em> (RL)</em></strong> is a <a href="https://en.wikipedia.org/wiki/Machine_learning"><em>machine learning</em></a> technique where an algorithm, referred to as an <em>agent</em>, learns to make decisions by interacting with its <em>environment</em>. The agent performs actions within this environment and receives feedback in the form of rewards or penalties. This process involves the agent observing the current state of the environment, making a decision (action), and then receiving a new state and feedback, which it uses to refine its decision-making strategy. This cycle of action, observation, and feedback helps the agent to learn the best actions to take in various states to achieve its objectives.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/0*Dsq_qHomV7jQJdd8" /></figure><p>In our Ad Delivery system, a RL agent would be responsible for selecting optimal pairings of Ad Requests and Ad Campaigns, aiming to maximize overall performance across various dimensions, including Demand, Supply, and Ogury’s goals. The agent would learn from each interaction (time step), continuously adapting its strategy to optimize ad delivery.</p><p>Despite RL’s potential, its practical application in our context faces considerable hurdles. The primary challenge lies in the RL agent’s requirement to process and adapt to complex, multi-dimensional data in real-time. The constantly changing nature of ad campaigns and inventories makes it difficult for the RL model to accurately predict and optimize outcomes, especially during training time with historical data which might not accurately represent current or future market conditions. This limitation hinders the RL agent’s ability to learn and adapt effectively.</p><p>Additionally, developing an RL model for this decision-making process involves creating a nuanced reward mechanism that optimally aligns with the multifaceted objectives of Demand and Supply which is quite complex to implement. Furthermore, integrating an RL-based solution into our existing Ad Delivery framework demands a high level of technological integration and system compatibility, ensuring seamless, real-time decision-making in line with ongoing ad operations.</p><p>Given these complexities and the necessity for immediate, precise decision-making, we concluded that although RL offers a theoretically robust framework, it is less suitable for the immediate and dynamic demands of our Ad Delivery system. This is the reason why we decided to explore more immediately applicable solutions that could effectively meet the changing and evolving requirements of our system.</p><h3>Conclusion</h3><p>Given these complexities and the online nature of Ad Delivery, we opted for an alternative strategy to solve our issue. We designed and implemented a custom solution named “<strong><em>Speed-Threshold</em></strong>” that leverages the principle of <a href="https://en.wikipedia.org/wiki/Control_system#:~:text=A%20control%20system%20manages%2C%20commands,for%20controlling%20processes%20or%20machines."><strong><em>Control Systems</em></strong></a>. Control Systems are a branch of engineering and mathematics focused on methods of managing dynamic systems or problems (systems where states are constantly changing). This is made possible by a feedback loop that allows real-time adjustments to align the system output with the desired objective. They are widely used in various fields to ensure <strong>optimal performance especially changing conditions</strong>.</p><p>The focus of <a href="https://wdechanelo.medium.com/6eab79108c50">next article</a> will henceforth be to present the building blocks of this innovative solution, illustrating how we have adapted the principles of Control Systems to solve our Ad Delivery Optimization problem.</p><p><a href="https://wdechanelo.medium.com/6eab79108c50">Medium</a></p><pre>Glossary <br><br>- Ad Delivery System: decision-making system that selects on which platforms or website a digital advertisement is displayed.<br>- Ad Request: A signal from a publisher indicating ad space is ready for an advertisement.<br>- Inventory: The total ad placements a publisher has available for advertisements within a certain timeframe.<br>- Publishers: entities that provide space (ad placement) on digital platforms for advertisers to display their ads.<br>- Ad Campaigns: contents created to promote brands, companies or institutions products or services.<br>- Ad Performance: The effectiveness of an ad campaign measured by metrics such as clicks, conversions, views...Etc.<br>- Campaign Budget Pacing: The ratio of actual to targeted budget expenditure at a given time for an Ad Campaign.<br>- Publisher Objective Pacing: The ratio of actual budget spent to expected expendititure on a publisher&#39;s inventory. The expected expendititure corresponds to the objective.</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=366a84e41a1d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ogury-engineering/optimization-of-competing-interests-how-ogury-maximizes-value-for-both-sides-of-an-advertising-366a84e41a1d">Act 1 — Optimization of competing interests: How Ogury maximizes value for both sides of an…</a> was originally published in <a href="https://medium.com/ogury-engineering">ogury-engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create a future-proof SDK]]></title>
            <link>https://medium.com/ogury-engineering/how-to-create-a-future-proof-sdk-14d26c7ac584?source=rss----ac2745efe76b---4</link>
            <guid isPermaLink="false">https://medium.com/p/14d26c7ac584</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[sdk]]></category>
            <category><![CDATA[architecture-pattern]]></category>
            <dc:creator><![CDATA[Perret Nicolas]]></dc:creator>
            <pubDate>Mon, 15 Jan 2024 16:42:06 GMT</pubDate>
            <atom:updated>2024-01-15T17:16:19.634Z</atom:updated>
            <content:encoded><![CDATA[<h4>Three years ago, the iOS SDK was built using a limited number of classes to manage all functionalities. Although this approach fulfilled our initial objectives, newly added features necessitated extensive maintenance, and it became challenging to support this architecture as it was becoming outdated. Consequently, we made the strategic choice to reconstruct the SDK entirely, prioritizing a future-proof approach. In this article, we will explore the considerations and thought processes that went into the SDK’s reconstruction.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mcCxg4mWgcQ7eurq" /><figcaption>Photo by <a href="https://unsplash.com/@raagesh?utm_source=medium&amp;utm_medium=referral">Raagesh C</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>What does “future-proof” mean?</h3><p>To start, it’s important to establish what we mean by “future-proof.” A future-proof SDK is one that’s crafted with the ability to adapt and remain valuable even as technology, user experience and market trends evolve over time. Simply put, a future-proof SDK can weather changes in the industry and continue providing lasting benefits to its users.</p><p>The key characteristics are:</p><ul><li>Modularity: The SDK should be designed in a modular way, with each module serving a specific function. This allows greater flexibility and easier integration with new technologies.</li><li>Scalability: The SDK should be designed to scale as your product grows without sacrificing its performance or its stability.</li><li>Flexibility: The SDK should be flexible enough to adapt to new use cases and market trends. This means that it should be easy to customize and extend as needed.</li></ul><p>After examining various SDK architectures, we focused our studies on one in particular: <strong>the modular architecture principle?</strong>.</p><h3>The modular architecture principle</h3><p>The modular architecture principle involves dividing all code and classes into separate modules and establishing a contract for communication between them. Each module is independent, which makes it effortless to add or remove modules as necessary, and enables module reuse across different parts of the codebase, reducing the need for duplication.</p><h3>Big picture to define SDKs</h3><p>To enhance our flexibility, it’s imperative to precisely define the products we’re delivering and identify which SDKs we need to construct. In our case, we provide two products: an Ads SDK for displaying ads and a Choice Manager SDK (CM SDK) for displaying user consent.</p><p>As both of these SDKs require common modules like network access and device settings access, creating a specialized SDK that incorporates these modules could be advantageous. This approach can simplify development and guarantee consistency across all our SDKs.</p><p>To simplify the integration process, creating a wrapper SDK that allows publishers to call a single method to start all necessary SDKs helps simplify the integration method. This approach also reduces the complexity of integration and makes it easier for publishers to use our SDKs.</p><p><strong>We have 4 SDKs:</strong></p><ul><li>Wrapper</li><li>Ads</li><li>CM</li><li>Core</li></ul><p><em>List of all SDKs and how they are implemented</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/0*UTfBVjscJuhDuwpx" /></figure><h3>Define the different module</h3><p>Once we have split the SDKs, the next step is to delve deeper into each one to define the various modules needed. To accomplish this, we must identify the different features we have and group them by type. These types represent our modules, and we can construct the architecture based on these modules.</p><p>For example, if we look at the Ads SDK, we want to display Mobile Rich Media Ad Interface Definition (MRAID) Ads, but in the future, we may display ads with a video player via Interactive Media Ads (IMA). Ads can be displayed as fullscreen, banners, or thumbnails.</p><p>We have two types: the ways that we display ads and the container of the ad.</p><p>In our case, we have created two modules:</p><ul><li>The Ad displayer, and behind that: the MRAID Webview.</li><li>The Ad container, and behind that: the different containers like fullscreen, banner, and thumbnail.</li></ul><p>We also created a module for user and publisher interaction (the user can click on the ad</p><p>which induces actions and the publisher can show the ad): The ad controller, is then in charge of controlling all the actions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/0*KbD2sBevqij5C8TT" /></figure><p><em>Visual representation of an ad flow</em></p><p>Displayers and containers never call ads directly to avoid having several action sources.</p><h3>Create the different module</h3><p>After defining the different modules, the next step is to establish a communication contract between them. This is among the most critical elements to define, as it will ultimately determine how future-proof the architecture will be.</p><p>To define the contract, we create an interface that is as generic as possible. It’s essential to avoid passing objects directly through the interface but rather through another interface. By doing so, it becomes much simpler to create and pass another class that conforms to the interface.</p><p>For example, for the ad container, we create an interface that is the most simple and generic possible</p><blockquote>@property (nonatomic, strong, read-only) NSString *name;</blockquote><blockquote>@property (nonatomic, assign, read-only) OGAAdContainerStateType type;</blockquote><blockquote>@property (nonatomic, strong, read-only) id&lt;OGAAdDisplayer&gt; displayer;</blockquote><blockquote>- (instancetype)init;</blockquote><blockquote>- (BOOL)display:(id&lt;OGAAdDisplayer&gt;)displayer error:(OguryError * _Nullable * _Nullable)error;</blockquote><blockquote>- (void)cleanUp;</blockquote><p>To create a new state, we need to define the behavior on display and on clean. Then it’s ready to be added to the code, at the right place without having to change the logic, avoiding regression.</p><h3>Constraint of communication</h3><p>In some cases, it’s essential to maintain communication between different SDKs. Most developers might consider creating a public API and communicating through it, but this approach involves a hard dependency between both SDKs, which is not ideal.</p><p>To be as flexible and future-proof as possible, we must find another way to communicate between SDKs.</p><p>In our particular case, we decided to create an event bus system to transmit information between SDKs without dependencies.</p><p>The Core module generates an event bus during initialization and provides it to the Ads and CM SDKs, this event bus is similar to a notification center. The SDK can create an event with a topic name, and all registered SDKs that listen to this topic will receive the event.</p><p>This approach is highly flexible and future-proof. If we need to send an existing event to a new SDK, we simply register the new SDK to the event’s topic without making any modifications to the sender SDK.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/351/0*MJrl9_AI4VUComcU" /></figure><p><em>Event bus communication</em></p><h3>Remote configuration</h3><p>Once SDKs are pushed to production, they can remain in use for a prolonged period. Therefore, it’s crucial to ensure flexibility and future-proofing to be able to have an impact on already deployed SDKs. One way to achieve this is by using a remote configuration. A remote configuration involves the SDK pinging a server at regular intervals and upon initialization. The server responds with a list of parameters that tell the SDK which options to take, such as stopping or activating a feature.</p><p>A remote configuration also presents an excellent opportunity for A/B testing. We can activate a feature in a subset of the deliveries to compare results and make data-driven decisions.</p><h3>Conclusion</h3><p>To build SDKs that are future-proof, we have adopted a modular architecture that separates the code into independent modules, which can be easily added or removed. This approach saves time in development and testing while minimizing the risk of regression issues.</p><p>Although there are some challenges in communication between modules, we overcame them by using an event bus system that allows information to be sent between SDKs without creating dependencies.</p><p>Our modular architecture already proved its worth, like when we added the ability to display StoreKit Ads with SKAdNetwork. We simply added the StoreKit module, which implemented the Ad Container State module, and inserted it in the right place. This took only two weeks of development and one week for testing, which is much faster and more efficient than the old architecture and reduces the risk of regression issues.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14d26c7ac584" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ogury-engineering/how-to-create-a-future-proof-sdk-14d26c7ac584">How to create a future-proof SDK</a> was originally published in <a href="https://medium.com/ogury-engineering">ogury-engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[About Ogury Engineering]]></title>
            <link>https://medium.com/ogury-engineering/about-ogury-engineering-2587b025f5c7?source=rss----ac2745efe76b---4</link>
            <guid isPermaLink="false">https://medium.com/p/2587b025f5c7</guid>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[adtech]]></category>
            <dc:creator><![CDATA[Carles Sistaré]]></dc:creator>
            <pubDate>Sat, 13 Jan 2024 12:28:53 GMT</pubDate>
            <atom:updated>2024-01-15T12:53:36.902Z</atom:updated>
            <content:encoded><![CDATA[<iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F889953960%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F889953960&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F1763230082-a13da352a14920654bfd95e6a0da5b56ff1faac222fd99f1d66996ca9fee9cde-d_1280&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1080" frameborder="0" scrolling="no"><a href="https://medium.com/media/726edbe29a1fefca86d377d5afa9bcdc/href">https://medium.com/media/726edbe29a1fefca86d377d5afa9bcdc/href</a></iframe><h3>Fueled by data. Grounded in privacy.</h3><p><strong>Ogury is a global AdTech company that delivers advertising solutions grounded in privacy to brands, agencies and publishers by targeting personas, not people.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*caFCkarAj7iZzDoYy1iFxQ.jpeg" /></figure><p>Welcome to the dynamic world of Ogury, a global adtech company that stands at the forefront of advertising solutions anchored in privacy. As a powerhouse in the industry, Ogury is not just a workplace; it’s an ecosystem where innovation thrives, and challenges are opportunities for growth. Our team of 100 diverse engineers, each armed with core skills spanning frontend technologies, Android and iOS development, backend services, data engineering, data science, and cloud engineering, is the driving force behind our success.</p><h3>Challenges Await</h3><p>At Ogury, we believe in pushing boundaries and redefining what’s possible in the realm of adtech. Our engineers tackle some of the most exhilarating challenges, creating an environment where ingenuity flourishes. Picture this — high availability services managing high spikes of traffic, low response time budgets, and machine learning tailored for live decisioning. We process terabytes of data daily using cutting-edge streaming technologies, ensuring our multi-regional operations maintain top-notch performance.</p><h3>Technological Landscape</h3><p>The arsenal of technologies at Ogury reflects our commitment to staying at the forefront of innovation. Our engineers work with Swift and Kotlin for mobile development, React.js and Typescript for robust frontend solutions, Golang and Python for highly performant backend services, Spark and Airflow for data processing, Kubernetes for container orchestration, and AWS services for scalable cloud infrastructure. It’s a technological symphony that ensures our solutions are not just effective but also future-proof.</p><h3>Beyond the Norm</h3><p>Our commitment to excellence transcends conventional boundaries. At Ogury, we seamlessly integrate control systems and reinforcement learning, advanced machine learning techniques that enable us to learn and optimize our ad delivery allocations in real time. We also revolutionize ad creative experiences with unparalleled motion design techniques unique in the market. We conduct surveys at scale, leveraging contextual targeting enriched with behavioral data while upholding the highest standards of privacy. Globally, we lead the way in empowering advertisers to connect with their audience post the 3rd party cookie apocalypse.</p><p>Ogury is more than just a workplace for engineers; it’s a great place for those seeking to elevate their skills and redefine the benchmarks of excellence in adtech.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2587b025f5c7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ogury-engineering/about-ogury-engineering-2587b025f5c7">About Ogury Engineering</a> was originally published in <a href="https://medium.com/ogury-engineering">ogury-engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>