AdFL: In-Browser Federated Learning for Online Advertisement

Ahmad Alemari, Pritam Sen, Cristian BorceaarXiv 2026 · arXiv · OpenReview

TL;DR

This paper introduces AdFL, a novel in-browser Federated Learning (FL) framework designed to balance user privacy with publisher revenue in online advertising. AdFL enables the training of ad preference models directly within users' browsers, aggregating these models on the publisher's server without ever exposing raw user data, achieving high accuracy while respecting privacy regulations.

What Problem Does This Paper Address?

The online advertising ecosystem faces a critical tension: publishers rely on targeted ads for revenue, but increasing privacy regulations (like GDPR and CCPA) restrict the collection and sharing of user data. When users decline data collection, advertisers can only serve less effective contextual ads, leading to lower revenue. Existing Federated Learning (FL) solutions for online ads often struggle with integration into current ad serving infrastructure, require complex hierarchical server setups, or depend on synthetic data. Furthermore, many in-browser FL approaches lack the specific capabilities needed for real-time ad data collection and processing. This paper addresses the need for a practical, privacy-preserving FL framework that can be seamlessly integrated into the existing online advertising landscape, working directly within the user's browser.

Methods

AdFL is an end-to-end FL framework that operates entirely within the user's web browser. Its core innovation lies in its client-side architecture, which comprises several JavaScript-based components:

  • Session Manager (SM): Manages user sessions, loads AdFL components, and handles browser storage.
  • Data Collector (DC): Gathers contextual data (user agent, cookies, page content, etc.) and session details.
  • Ad Utility (AdU): Captures ad-specific features and metrics like viewability and click-through rates in real-time as ads load.
  • Data Preprocessing and Storage (DPS): Cleans and preprocesses raw data, storing it locally in the browser using IndexedDB.
  • Model Utility (MU): Handles local model training and inference, leveraging TensorFlow.js.

AdFL employs horizontal FL, meaning data samples are distributed across users, and the global model is built without altering model architecture. The publisher hosts a single AdFL server that coordinates the aggregation of local model updates using the FedAvg algorithm. A key aspect is its ability to work with any model that uses browser-available features and any aggregation algorithm. The framework also supports the integration of differential privacy (DP) to further safeguard local model parameters.

Datasets

The authors used two non-overlapping datasets collected from a website with approximately 40,000 visitors per day. These datasets were collected over 10-day and 30-day periods. The data includes user, page, session, and ad attributes. The paper notes that the datasets lack explicit user identifiers due to the website's nature.

Key Insights and Ideas

  • Browser-Native FL is Feasible for Ads: AdFL demonstrates that complex FL pipelines, including data collection, preprocessing, training, and inference, can be effectively executed within the constraints of a web browser, without requiring any client-side software installation.
  • Real-time Ad Data Capture is Crucial: The Ad Utility (AdU) component's ability to capture ad-specific metrics in real-time as ads load is vital for building accurate models for online advertising.
  • Privacy-Preserving Models Can Be Accurate: By leveraging FL and optionally DP, AdFL achieves a good balance between user privacy and model performance, showing only modest declines compared to centralized learning approaches.
  • Flexibility is Key: AdFL's design is model-agnostic and aggregation-agnostic, allowing publishers to adapt it to various machine learning models and FL strategies relevant to online advertising.
  • Ad Blockers Pose a Challenge, but AdFL Offers an Alternative: While AdFL doesn't work with ad blockers, it's positioned as an alternative for publishers who might otherwise struggle with revenue loss due to ad blocking, offering a privacy-conscious way to serve targeted ads.

Key Results

  • Latency: AdFL operations are fast, with feature preprocessing taking less than 3ms on desktop and 7ms on mobile. Inference is also very quick, allowing for real-time adjustments to ad serving.
  • Model Performance: The proof-of-concept ad viewability prediction model achieved an AUC of up to 92.59% in FL settings. Performance was comparable to centralized learning (CL), with only a few percentage points difference.
  • Differential Privacy: Incorporating DP provided privacy benefits with only modest declines in performance, demonstrating its viability for sensitive applications.
  • Memory Overhead: AdFL itself requires around 50MB of memory, with model training and inference adding less than 200MB, making it feasible for most modern devices.
  • Data Impact: Longer data collection periods (30 days vs. 10 days) led to better model performance, highlighting the importance of sufficient user data.

Limitations and Future Work

  • Ad Blocker Compatibility: AdFL does not function when ad blockers are active. The authors suggest that publishers might need to implement strategies to encourage users to enable ads or subscribe.
  • Publisher-Specific Data: The experimental data was collected from a single publisher's website. While the authors believe the core features are generalizable, further testing across diverse publishers would be beneficial.
  • Communication Costs: While manageable, FL inherently involves communication costs for model updates. The paper notes that higher DP noise levels can increase communication rounds.
  • Future Work: The authors suggest exploring other FL aggregation techniques and integrating more advanced privacy-preserving methods. They also envision AdFL supporting a wider range of ad-related models and use cases beyond viewability prediction.

Summary updated

Abstract

Since most countries are coming up with online privacy regulations, such as GDPR in the EU, online publishers need to find a balance between revenue from targeted advertisement and user privacy. One way to be able to still show targeted ads, based on user personal and behavioral information, is to employ Federated Learning (FL), which performs distributed learning across users without sharing user raw data with other stakeholders in the publishing ecosystem. This paper presents AdFL, an FL framework that works in the browsers to learn user ad preferences. These preferences are aggregated in a global FL model, which is then used in the browsers to show more relevant ads to users. AdFL can work with any model that uses features available in the browser such as ad viewability, ad click-through, user dwell time on pages, and page content. The AdFL server runs at the publisher and coordinates the learning process for the users who browse pages on the publisher's website. The AdFL prototype does not require the client to install any software, as it is built utilizing standard APIs available on most modern browsers. We built a proof-of-concept model for ad viewability prediction that runs on top of AdFL. We tested AdFL and the model with two non-overlapping datasets from a website with 40K visitors per day. The experiments demonstrate AdFL's feasibility to capture the training information in the browser in a few milliseconds, show that the ad viewability prediction achieves up to 92.59% AUC, and indicate that utilizing differential privacy (DP) to safeguard local model parameters yields adequate performance, with only modest declines in comparison to the non-DP variant.
BibTeX
@misc{alemari2026adfl,
  author = {Ahmad Alemari and Pritam Sen and Cristian Borcea},
  title = {{AdFL: In-Browser Federated Learning for Online Advertisement}},
  year = {2026},
  eprint = {2602.06336},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2602.06336},
}
Figure