Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

first-principles-rtb

Physics-Informed Generative World Models for Real-Time Bidding — Reproducibility Package

Code and synthetic dataset for reproducing all paper figures and Table 1 (identifiability crisis) experiments.

Citation

@inproceedings{wu2026physics,
  title     = {Physics-Informed Generative World Models for Real-Time Bidding: Deriving Statistical Laws from First Principles},
  author    = {Wu, Chenyang and Wang, Tianyu and Fang, Shengjun and Cao, Mingjun and Liu, Pengfei and Zhang, Zongzhang and Li, Yeshu and Zhang, Zhilin},
  booktitle = {Proceedings of the 32nd ACM SIGKDD Conference on Knowledge Discovery and Data Mining V.2},
  series    = {KDD '26},
  pages     = {},
  year      = {2026},
  month     = {August},
  address   = {Jeju Island, Republic of Korea},
  publisher = {ACM},
  doi       = {10.1145/3770855.3818160},
  isbn      = {979-8-4007-2259-2/2026/08},
}

Setup

pip install -r requirements.txt

All commands below should be run from the open_source/ directory.


Synthetic Dataset

A pre-generated synthetic dataset is included at data/synthetic_bidding_data.csv (5,000 rows, seed=42). It is produced by fitting the real data and sampling from the fitted joint model:

Variable Model Role
inc_pv, inc_click ZI-PLN (Zero-Inflated Poisson-LogNormal) Count marginals
inc_cost, inc_pgmv ZI-TLN (Zero-Inflated Compound-Poisson-Gamma-LogNormal) Value marginals
Joint dependence Normalizing Flow Copula (spline, 4 flows) Fitted on rank-transformed real data

Fitted parameters are stored in:

  • data/zipln_zitln_marginal_params.json — ZI-PLN/ZI-TLN marginal parameters fitted on real data
  • data/nf_copula_weights.pt — NF copula weights (1.3 MB)

To regenerate the synthetic dataset (no real data needed):

python data/generate_dataset.py --n 5000 --seed 42

The fitting code (requires private real data) is not included in this repository.

This reproduces the three statistical properties documented in the paper: zero-inflation (zero rate matches real data within ±2%), heavy tails (Hill index α within 30% of real data at k>50), and cross-dimensional tail dependence (captured by the NF copula).


Figures

Figure Script Output Notes
Fig 1 (Heavy Tail) python figures/fig1_heavy_tail.py figures/output/fig1_heavy_tail_viz.png Hill plot, uses synthetic data
Fig 2 (QQ Plot) python figures/fig2_qq_plot.py figures/output/fig2_qq_plot.png Uses inc_pgmv params from data/zipln_zitln_marginal_params.json; R² ≈ 0.9996
Fig 3 (Tail Dependence) python figures/fig3_tail_dependence.py figures/output/fig3_tail_dependence_cond_prob.png Copula comparison; allow ~10–15 min for NF training

Identifiability Crisis (Table 1 in Paper)

Pre-computed results on real data (not released) are provided in:

  • identifiability_crisis/results/real_data_pgmv_cost_nll.csv
  • identifiability_crisis/results/real_data_pv_clk_nll.csv

Pre-computed results on the synthetic dataset are provided in:

  • identifiability_crisis/results/synthetic_pgmv_cost_nll.csv
  • identifiability_crisis/results/synthetic_pv_clk_nll.csv

To rerun on synthetic data:

python identifiability_crisis/pgmv_cost_parametric_nll.py --data synthetic
python identifiability_crisis/pv_clk_parametric_nll.py   --data synthetic

The mean-variance estimation experiments (supporting Table 1) can also be run:

python identifiability_crisis/pgmv_cost_mean_variance.py --data synthetic
python identifiability_crisis/pv_clk_mean_variance.py    --data synthetic

Surrogate Selection Experiment

Pre-computed checkpoints and result heatmaps are in surrogate_selection/. This experiment uses no real data — ground truth is sampled from a parametric ZI-CPGLN model.

To view pre-computed results:

surrogate_selection/leaderboard_results/full_heatmap_mu_*.png

To resume from checkpoints (the checkpoints allow continuation without rerunning completed cells):

python surrogate_selection/cpgln_surrogate_selection.py

To run a quick smoke test (2×2 grid, 500 samples, ~2 minutes):

python surrogate_selection/cpgln_surrogate_selection.py --smoke

Fitted Parameters

All fitted parameters are in data/zipln_zitln_marginal_params.json. To load the ZI-TLN parameters for inc_pgmv:

import json, math, torch
from utils.zero_inflation import ZeroInflatedCompoundPoissonGammaLogNormal

with open("data/zipln_zitln_marginal_params.json") as f:
    p = json.load(f)["inc_pgmv"]

dist = ZeroInflatedCompoundPoissonGammaLogNormal(
    torch.tensor(p["gate_logit"]),
    torch.tensor(math.exp(p["log_alpha"])),
    torch.tensor(math.exp(p["log_theta"])),
    torch.tensor(p["loc"]),
    torch.tensor(math.exp(p["log_scale"])),
    n_level=7, validate_args=False,
)

Directory Structure

open_source/
├── data/                          # Synthetic dataset, generator, and fitted parameters
├── figures/                       # Fig 1–3 scripts and output PNGs
├── identifiability_crisis/        # Table 1 experiment scripts and results
├── surrogate_selection/           # Surrogate selection experiment + checkpoints
├── utils/                         # Core distribution library (ZI-CPGLN, copulas, etc.)
├── requirements.txt
└── README.md

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages