# How inference works

<figure><img src="/files/mYJFo2RmjGAbL8AJIjoS" alt=""><figcaption></figcaption></figure>

The Airflux inference engine is an AI-powered system that makes real-time decisions on whether to display an ad or not at a particular moment for maximum ad revenue. When a player reaches a point where an ad is supposed to be displayed, the Airflux SDK sends the in-game events and player attribute data to the Inference server. Using the data, a decision regarding ad display is made and returned to the client. The inferencing process includes the following steps:

<table><thead><tr><th width="149.1875">Steps</th><th>Description</th></tr></thead><tbody><tr><td><ol><li>Data Collection</li></ol></td><td>The SDK gathers data such as in-game events, player attributes, revenue, device information, and other relevant data in real-time.</td></tr><tr><td><ol start="2"><li>Data Preprocessing</li></ol></td><td>The collected data is converted into formats usable by the AI engine, including recent event count, session information, and eCPM metrics.</td></tr><tr><td><ol start="3"><li>Model Inference</li></ol></td><td>The AI engine selects a model based on player profile and game context, and performs inference to determine optimal ad display timing. </td></tr><tr><td><ol start="4"><li>Ad Display Decision</li></ol></td><td>The AI engine returns a result aligned with the optimization goal, indicating whether or not to display an ad.</td></tr></tbody></table>

## **Data used by the model**

The Airflux AI engine takes into account a variety of variables. The variables detailed in the table below are used to identify the best timing and approach for displaying ads, maximizing ad revenue while ensuring a positive play experience.

<table><thead><tr><th width="116.66796875">Category</th><th>Example</th><th>Purpose</th></tr></thead><tbody><tr><td>Player profile</td><td>Country, OS, Language</td><td>Player segmentation</td></tr><tr><td>In-session behavior</td><td>Accumulated playtime, recent session duration, event count</td><td>Churn and retention prediction</td></tr><tr><td>Ad response</td><td>Recent responses to ads </td><td>Ad resistance assessment</td></tr><tr><td>Revenue signal</td><td>The recent average of in-app revenue amount, eCPM</td><td>High-value user identification</td></tr><tr><td>Game context</td><td>Current stage, currency inventory</td><td>Adjustment for optimal play experience </td></tr><tr><td>Time series signal</td><td>Current date, day of week</td><td>Optimization around holidays and weekends</td></tr></tbody></table>

## Model updates

The models used by the Airflux AI engine evolve through several training loops:

* **Online feedback loop:** Internal model parameters are adjusted based on ad responses to each API call. Underperforming policies are discarded.
* **Model retraining loop:** When a large volume of events is aggregated or significant pattern changes are detected (e.g., new stages, patches), retraining is triggered.
* **Version update:** The data science team continues to develop and deploy new, improved models that outperform the previous versions.

## Performance & reliability

The Airflux inference engine’s architecture is built on the following key components:

* **CloudFront Global CDN:** All inference requests are routed through CloudFront, a top-tier global CDN, to the nearest PoP (Point of Presence), minimizing latency.
* **AWS Services:** Airflux uses services such as Application Load Balancer, Lambda\@Edge, Aurora (RDS), DynamoDB, and S3 to ensure high durability and scalability across multiple Availability Zones (AZs).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.airflux.ai/airflux-reference/how-inference-works.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
