DISCLAIMER: This code is a work in progress and has passed preliminary checks, but might still contain bugs. Thorough testing is yet to come, feedback and questions are very welcome.
This repository is a JAX/Haiku implementation of the paper "Auction Learning as a Two-Player Game" (extended arXiv version). It uses an architecture inspired by GANs to learn (near-)optimal multi-bidder, multi-item auctions.
The GAN example from dm-haiku was used as a starting point.
- Install Python 3.7+
- Install CUDA (optional)
- follow the instructions for installing JAX with CUDA support
- clone this repository and
cd
into it - run
pip3 install -r requirements.txt
To run the auction experiment with specific parameters:
python algnet.py with num_steps=100 misr_updates=50 misr_reinit_iv=500 misr_reinit_lim=1000 batch_size=100 bidders=3 items=10 hidden_width=50 n_hidden=3 num_test_samples=20 attack_mode=None
You can also run the experiment with parameters given by a configuration file. You can find some example configs in baseline_configs.
# run experiment with parameters from config file
python algnet.py with baseline_configs/config_2x2.json
# run experiment with parameters from config file, overriding the number of hidden layers
python algnet.py with baseline_configs/config_2x2.json n_hidden=5
This implementation also includes the option to simulate adversarial attacks against the auction learner. There are two types of attack scenarios that can be simulated:
- Offline attack: The adversary chooses a bidding distribution prior to to taking part in the auction, and then samples their bids from that distribution, which may not represent their true valuation profile.
- Online attack: The adversary receives the outcome of every auction during training and can adapt their bidding strategy during every iteration of the auction.
To simulate an offline attack, set attack_mode="offline"
as well as the misreport_type
and the corresponding misreport_params
.
Currently the offline attack only supports uniform and normal distributions.
# offline attack with uniformly distributed misreports
python algnet.py with baseline_configs/config_2x2.json attack_mode="offline" misreport_type="uniform" misreport_params="{'low': 0.0, 'high': 0.8}" num_steps=100
# offline attack with normally distributed misreports
python algnet.py with baseline_configs/config_2x2.json attack_mode="offline" misreport_type="normal" misreport_params="{'mean': 0.4, 'stddev': 0.2}" num_steps=100
To simulate an online attack, set attack_mode="online"
.
python algnet.py with baseline_configs/config_2x2.json attack_mode="online" num_steps=100
You can enable differentially private stochastic gradient descent (DPSGD) by setting dp=True
during training.
python algnet.py with baseline_configs/config_2x2.json attack_mode="online" dp=True num_steps=1000
Initial tests suggest that this aids in achieving improved auction outcomes under attack conditions, but additional experiments are needed for confirmation.
The project uses the Sacred framework for experiment tracking.
- Logs and experiment metadata are saved to an SQLite database named
results.db
. - The state parameters of the last trained model are saved to
tpal_state_params.pkl
.
For a quick overview over your past completed runs, you can use db_inspect.py
to output summaries as a markdown table:
python db_inspect.py
This module is kept simple to make it suitable for use with computational experiment frameworks, or as a component in larger systems. Black is used as a code formatter.
This project is funded through the NGI Assure Fund, a fund established by NLnet with financial support from the European Commission's Next Generation Internet program. Learn more on the NLnet project page.