Behind the paper: Niklas Karlsson applies feedback control to juggle complex ad demands

Engineers know feedback control as the process of adjusting a system and correcting for a desired outcome; for example, a robot encounters an obstacle and reroutes itself. This same approach underpins recent work by Niklas Karlsson, a Senior Principal Scientist at Amazon Ads. As a former robotics engineer, Niklas has applied that background—as well as nearly two decades in advertising tech—to the problem of delivering complex advertising goals for customers.
Niklas holds advanced degrees in engineering and statistics from the University of California at Santa Barbara and Lund University in Sweden, and he is an Institute of Electrical and Electronics Engineers (IEEE) fellow. Seeking a change from his early foray into robotics in the early 2000s, Niklas joined Advertising.com to help overhaul its ad optimization system. The interest in ad technology stuck, and Niklas joined Amazon in July 2022. Here he talks about his career and recent paper, which was accepted to the 63rd IEEE Conference on Decision and Control (2023) in Singapore.
Why did you join Amazon Ads?
I had been in the online advertising industry since 2005, and in early 2022, a recruiter approached me about the possibility of joining Amazon Ads. I was compelled by the idea of tackling similar types of problems that I was used to but for a different company. The prospect of working at Amazon was intriguing. Amazon's size, reputation, and ambitious Leadership Principles—Bias for Action, Think Big, Deliver Results—resonated with me.
What is your main research area?
My research interest is feedback control, dynamic systems, and optimization. My charter at Amazon is to provide expertise in algorithms for optimization and control of advertising campaigns managed by Amazon Demand Side Platform (ADSP) and to advance ADSP for the benefit of our customers. Our customers are advertisers that wish to spend their budgets to achieve some campaign objective. For example, an advertiser may approach us with a monthly budget of $100,000 to spend in such a way that the total number of conversions, or sales, is maximized. The desire is to spend the budget throughout the month—not to spend everything on the first day or the last day. Additional delivery constraints are common—for example, to serve half of the ad impressions to female users or to spend at most a certain amount, on average, per conversion or per impression. An ad impression is when an ad is shown to a user.
An advertising campaign can be defined as an extremely high-dimensional multi-constrained optimization problem. Via some clever mathematics, this problem can be decomposed into sub-problems that are slightly easier to solve. The solutions to the sub-problems involve advanced techniques from machine learning, feedback control, and statistics; when combined, they are used to compute bids that are submitted for ad impressions on behalf of the advertiser.
Tell us about your paper.
My paper, "Feedback-control based hierarchical multi-constraint ad campaign optimization", solves a previously overlooked optimization problem. Note that advertisers typically want to maximize, for example, the total number of conversions subject to one or more delivery constraints. Historically, such constraints applied to the entire campaign budget. But in recent years, advertisers often impose certain delivery constraints to the overall campaign budget and others only to sub-campaigns. A sub-campaign is defined by a unique ad creative and is subject to its own constraints—for example, on spend, female-to-male ratio, and average spend per impression or per conversion.
It follows that campaign objectives today often correspond to hierarchical multi-constrained optimization problems. This leads to interesting and challenging research problems. A simple solution had been developed prior to my research, but that solution had important limitations and was incompatible with the grand vision of ADSP. My research and paper address the problem holistically by deriving the mathematically optimal solution and devising a decentralized implementation of the solution.
How did the paper come about?
It started with an audit I conducted of the overall ADSP optimization system during my first couple of months at Amazon. During the audit, I identified strengths and weaknesses of the optimization system and established opportunities for improved campaign delivery and performance for our advertisers. One specific weakness caused me to think a lot. Although I knew that improvements could be made, I didn’t immediately know how to describe the problem, and I didn’t have a solution in mind. However, near the end of 2022 when I was in between projects and had more time to think, I gained clarity and worked out the details—first by defining the problem adequately using mathematics and thereafter by deriving the optimal solution and a sound implementation. I prepared the first draft of the paper in December 2022 and further generalized the results in the weeks ahead. As the paper was being finalized, we began developing a prototype to demonstrate the concept, and the result was overwhelmingly positive. It was proven beyond a reasonable doubt that this solution should be put into production and rolled out widely, which has now happened.
What kind of impact did you see?
First of all, the solution immediately allowed ad campaigns to deliver their budgets more efficiently. Less advertising budget was left on the table, and campaign performance was measured by metrics, such as the average cost per conversion and other key performance indicators, which improved by several percentage points each.
But besides the improved metrics, the new solution also enabled a wide range of other delivery constraints that were incompatible with the old solution. To achieve near-optimality, the old system could only be used for campaigns with nothing but spend constraints. This meant that campaigns with constraints on cost per conversion, cost per impression, cost per click, in-view rate, in-target rate, etc., were out of reach. The new system is general and forward-looking and easily handles an arbitrary number of hierarchical multi-constraint problems.
What is notable about this approach?
The differentiator of the new system is how the problem is modularized and thereafter how multiple feedback controllers are implemented in concert to solve the various sub-problems robustly and efficiently.
People are fascinated with how one can turn a complex ad technical problem into a control problem because that’s not the traditional use of feedback control; conventional applications are found in aerospace and robotics. But the beauty of feedback control as a scientific discipline is that it’s based on abstraction that permits the same tools to be used across many applications. You can turn problems from ad tech into a form that allows you to use the exact same tools that are used to develop control systems for jet engines, self-driving cars, and power plants.
In the paper, I take a holistic approach and incorporate first principles reasoning wherever I can. Most of the paper is math, but once you’re familiar with the notation, it’s quite simple and intuitive.
Did your background in robotics enable you to think this way?
Absolutely. Many people have asked me if it was a big change to go from robotics into online advertising. I say no because when I worked in robotics, I used the same approach. I took a business problem and turned it into a mathematical problem; I solved the mathematical problem and then implemented a solution in a real system. That's exactly what I'm doing now. It’s all about abstraction.
What is a highlight for you about working as a scientist at Amazon Ads?
I’m surrounded by a lot of smart people who are hungry to make an impact. Many academic backgrounds are represented in the Amazon science community. There are plenty of computer scientists, for sure, but there are also people from statistics, economics, feedback control, pure mathematics, chemistry … you name it.
What I like about ad tech in general is that it’s so cross-disciplinary. It's not possible to know everything; everybody brings something to table, and you will always learn from others and encounter a lot of interesting problems that are just waiting to be solved.
Amazon offers a culture where you’re truly encouraged to share new ideas. You will receive plenty of questions on your ideas, and typically there's a lot of back and forth where you debate the merits of what you have in mind. But people are very receptive to new ideas, and the process helps you really test your thinking and deliver high-quality work. It's a very supportive organization.
How are you re-imagining advertising in your role?
Online advertising has been around for many years. We’ve come a long way, but there’s still so much to do. To put things in perspective, when I entered the industry, there was no user-level data, algorithms were primitive, and advertisers had a poor idea of what automated advertising could do for them.
Now, a massive amount of granular data is available for modeling and optimization; advanced algorithms for optimization and control have been developed; and new types of ad formats have emerged. Also, advertisers today are savvy and demanding, and they expect a good return on investment. Despite the tremendous progress over the last 20 years, there is so much ahead of us that will require people with a variety of skill sets to research and solve problems. For people with backgrounds in machine learning, AI, feedback control, statistics, and applied mathematics, I expect there will be many opportunities to grow exciting careers at Amazon Ads or in the advertising industry.