Compare commits

..

4 Commits

14 changed files with 253 additions and 219 deletions

View File

@@ -26,18 +26,3 @@ jobs:
with:
name: thesis-pdf
path: paper/build/main.pdf
- name: Deploy PDF to GitHub Pages
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
# Copy PDF to docs directory for GitHub Pages
mkdir -p docs/static/pdfs
cp paper/build/main.pdf docs/static/pdfs/thesis.pdf
# Configure git
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
# Commit and push if there are changes
git add docs/static/pdfs/thesis.pdf
git diff --quiet && git diff --staged --quiet || (git commit -m "Update thesis PDF [skip ci]" && git push)

190
README.md
View File

@@ -1,191 +1 @@
# PHANTOM: Pricing Heuristics Against Non-human Transaction Orchestration Mechanisms
[![Build PDF](https://github.com/velocitatem/PHANTOM/actions/workflows/latex.yml/badge.svg)](https://github.com/velocitatem/PHANTOM/actions/workflows/latex.yml)
> Bachelor's Thesis Project by Daniel Rösel, IE University Madrid (2025)
> Advisor: Alberto Martín Izquierdo
## Overview
PHANTOM is an academic research project investigating **pricing heuristics to protect e-commerce platforms from exploitation by LLM agents** in dynamic pricing environments. This project explores behavioral signature detection for agent identification and develops protection mechanisms against automated transaction orchestration.
**Research Focus Areas:**
- AI security in e-commerce systems
- Behavioral signature detection for autonomous agent identification
- Dynamic pricing protection mechanisms
- LLM agent behavior analysis and exploitation patterns
## Project Structure
This repository contains both the research thesis and a full-stack experimental platform:
```
PHANTOM/
├── paper/ # LaTeX Bachelor's Thesis
│ ├── src/ # LaTeX source files
│ ├── build/ # Compiled PDF output
│ └── concat_code.sh # Auto-concatenate code for appendix
├── docs/ # GitHub Pages academic project page
│ └── index.html # Academic project showcase
├── web/ # Next.js research platform dashboard
│ └── src/ # Frontend application
├── backend/ # Python backend services
│ ├── provider/ # Data provider service
│ └── worker/ # Kafka consumer worker
├── experiments/ # Research experiments and data analysis
│ └── data_export.ipynb
└── docker/ # Infrastructure configurations
```
## Quick Start
### Prerequisites
- Docker & Docker Compose (for infrastructure)
- Node.js 18+ (for web application)
- Python 3.9+ (for backend services)
- LaTeX distribution (for building thesis paper)
### Infrastructure Setup
Start Kafka, Redis, and monitoring services:
```bash
docker-compose up -d
```
**Services:**
- Redis: `localhost:6379`
- Kafka: `localhost:9092`
- Zookeeper: `localhost:2181`
- Redpanda Console (Kafka UI): `http://localhost:8080`
### Web Application
```bash
cd web
npm install
npm run dev
```
Access at `http://localhost:3000`
### Backend Services
Install dependencies:
```bash
pip install -r requirements.txt
```
Run worker:
```bash
cd backend/worker
python main.py
```
## Building the Thesis Paper
### Using Make
```bash
make pdf # Compile LaTeX to PDF
make watch # Continuous compilation (live preview)
make clean # Remove build artifacts
```
### Manual Build
```bash
cd paper/src
latexmk -pdf main.tex
```
**Output**: `paper/build/main.pdf`
### Automated CI/CD
The thesis PDF is automatically built via GitHub Actions on every push to `main` that affects `paper/**`. The compiled PDF artifact is available in the Actions tab.
## Technical Architecture
**Frontend**: Next.js 14, React 18, TypeScript, Tailwind CSS
**Backend**: Python, Kafka (event streaming)
**Infrastructure**: Redis (cache), Kafka + Zookeeper
**Monitoring**: Redpanda Console
**Data Analysis**: Jupyter Notebooks, Pandas, Matplotlib
### Event-Driven Architecture
The platform uses Kafka for real-time event streaming, enabling:
- Asynchronous task processing
- Scalable data collection
- Experiment tracking and analysis
- Behavioral pattern detection
## Research Experiments
Jupyter notebooks in `experiments/` contain:
- Data exploration and analysis
- Behavioral pattern visualizations
- Statistical analysis of agent behaviors
- Experiment result processing
Run experiments:
```bash
cd experiments
jupyter notebook data_export.ipynb
```
## Documentation
- **Academic Project Page**: Hosted on GitHub Pages at `/docs`
- **Thesis Paper**: Latest PDF available via GitHub Actions artifacts
- **Web App README**: See `web/README.md`
- **Backend READMEs**: See `backend/provider/README.md` and `backend/worker/README.md`
## Development Workflow
1. **Paper Development**: Edit LaTeX files in `paper/src/`, use `make watch` for live preview
2. **Web Development**: Standard Next.js workflow in `web/`
3. **Backend Development**: Python services in `backend/`
4. **Experiments**: Jupyter notebooks in `experiments/`
### Code in Thesis Appendix
The `paper/concat_code.sh` script automatically generates a LaTeX appendix containing all source code from:
- `backend/` (Python, JavaScript, Shell, YAML)
- `experiments/` (Analysis scripts)
- `docker/` (Infrastructure configs)
- `web/src/` (TypeScript/React components)
This runs automatically during PDF compilation.
## Contributing
This is an academic thesis project. For questions or collaboration inquiries, please open an issue.
## License
Academic research project - all rights reserved.
## Citation
```bibtex
@thesis{rosel2025phantom,
title={Pricing Heuristics Against Non-human Transaction Orchestration Mechanisms},
author={Rösel, Daniel},
year={2025},
school={IE University},
address={Madrid, Spain},
type={Bachelor's Thesis}
}
```
## Acknowledgments
Special thanks to Alberto Martín Izquierdo for academic supervision and guidance throughout this research project.

View File

@@ -47,7 +47,7 @@
<meta name="citation_author" content="Rösel, Daniel">
<meta name="citation_publication_date" content="2025">
<meta name="citation_conference_title" content="IE University Bachelor's Thesis">
<meta name="citation_pdf_url" content="static/pdfs/thesis.pdf">
<meta name="citation_pdf_url" content="TODO">
<!-- Additional SEO -->
<meta name="theme-color" content="#2563eb">
@@ -238,14 +238,14 @@
<div class="column has-text-centered">
<div class="publication-links">
<!-- Thesis PDF - automatically updated via GitHub Actions -->
<!-- TODO: Update with your arXiv paper ID -->
<span class="link-block">
<a href="static/pdfs/thesis.pdf" target="_blank"
<a href="https://arxiv.org/pdf/<ARXIV PAPER ID>.pdf" target="_blank"
class="external-link button is-normal is-rounded is-dark">
<span class="icon">
<i class="fas fa-file-pdf"></i>
</span>
<span>Thesis PDF</span>
<span>Paper</span>
</a>
</span>
@@ -270,8 +270,8 @@
</a>
</span>
<!-- TODO: Update with your arXiv paper ID when available -->
<!-- <span class="link-block">
<!-- TODO: Update with your arXiv paper ID -->
<span class="link-block">
<a href="https://arxiv.org/abs/<ARXIV PAPER ID>" target="_blank"
class="external-link button is-normal is-rounded is-dark">
<span class="icon">
@@ -279,7 +279,7 @@
</span>
<span>arXiv</span>
</a>
</span> -->
</span>
</div>
</div>
</div>

View File

@@ -6,11 +6,17 @@
(setq TeX-command-extra-options
"-file-line-error -interaction=nonstopmode")
(TeX-add-to-alist 'LaTeX-provided-class-options
'(("report" "12pt") ("article" "12pt") ("acmart" "sigconf" "nonacm")))
'(("report" "12pt") ("article" "12pt") ("acmart" "sigconf" "nonacm" "natbib=false")))
(TeX-run-style-hooks
"latex2e"
"preamble"
"chapters/01-intro"
"chapters/02-literature-review"
"chapters/03-methodology"
"chapters/04-results"
"chapters/05-discussion"
"chapters/06-conclusion"
"../build/concatenated_code"
"acmart"
"acmart10")
(TeX-add-symbols

View File

@@ -0,0 +1,98 @@
@phdthesis{,
abstract = {Algorithmic pricing is an emerging business practice that uses computational algorithms to determine
the prices of products and services based on a number of dynamic factors. The aim of this thesis is to
draw attention to the existence of these business practices, and the ethical and social implications that
derive from them, and then focus on what could be effective solutions to increase the well-being of
the community.
In Chapter 2 of the thesis, a general introduction to the topic will be made, starting from its history
and its evolution over the years; Chapter 3 will examine the different types of pricing algorithms.
Subsequently, in Chapter 4 we will analyze the sectors in which they are most applicable, and the
relative advantages and disadvantages they bring with them, with a critical analysis of the trade-offs
generated. The effect of algorithmic pricing on competition will be studied, considering how the
ability of algorithms to adapt quickly to market conditions can foster anti-competitive practices, such
as price discrimination. Later, in Chapter 5, we will look at the issue of price transparency and how
the opacity of algorithms can make it difficult for consumers to understand the pricing process and
assess whether they are receiving fair treatment.
To address these ethical issues, several possible solutions will be brought to light, described in
Chapter 6, which will focus on the role of the government, as a regulatory, of the end consumer, who
must be encouraged to educate and inform himself about the use of these practices, and of the
company, as responsible for making its customers aware and acting in compliance with government
laws, for fair and non-discriminatory use.},
author = {Fabio Salassa and Paolo Pautassi},
school = {Politecnico di Torino},
title = {Politecnico di Torino Algorithmic Pricing in the digital age "Ethical considerations on its economic and social implications, and an analysis of possible solutions to overcome its critical issues" Tutor: Candidate},
url = {https://webthesis.biblio.polito.it/secure/31375/1/tesi.pdf}
}
@inproceedings{Mueller2019,
author = {Jonas W Mueller and Vasilis Syrgkanis and Matt Taddy},
booktitle = {Advances in Neural Information Processing Systems 32 (NeurIPS 2019)},
pages = {15442-15452},
title = {Low-Rank Bandit Methods for High-Dimensional Dynamic Pricing},
url = {https://proceedings.neurips.cc/paper/2019/file/0a3df70393993583a13c0dd6686f3f32-Paper.pdf},
year = {2019}
}
@article{Prez-Ricardo2025,
abstract = {The study aims to explore tourists' booking intentions by analyzing the price elasticity of demand in tourist accommodations. This analysis should reveal how changes in price affect booking behavior across different customer segments, using online booking records. A dataset was compiled from 106 hotels in Malaga, Spain, comprising 27,910 online bookings sourced exclusively from hotel websites. To understand the price elasticity of demand, a simple log-log regression was applied, segmenting the data based on key revenue-related variables. Subsequently, a cluster segmentation was performed using the Elbow method and K-means algorithm to identify distinct market segments. The findings highlighted that Family Travelers and Short Stay Travelers segments exhibited elastic demand, indicating higher sensitivity to price fluctuations. In contrast, Early Bookers and Mid-Season Long Stayers demonstrated inelastic demand, with lower responsiveness to changes in tourist accommodation prices. The number of variables analyzed in this study, along with the cluster analysis, represent a novelty and contribute to the existing literature on market segmentation and price elasticity of demand. This integration enriches both fields of research, offering mutual benefits and deeper insights that enhance the understanding of booking intention and pricing strategies.},
author = {Elizabeth del Carmen Pérez-Ricardo and Josefa García-Mestanza},
doi = {10.1016/j.iedeen.2025.100271},
issn = {24448834},
issue = {1},
journal = {European Research on Management and Business Economics},
keywords = {Booking intention,Price elasticity,Tourist segmentation},
month = {1},
publisher = {European Academy of Management and Business Economics},
title = {Exploring booking intentions through price elasticity of demand in tourism accommodations using large-scale data analytics},
volume = {31},
year = {2025}
}
@article{ArnoudVdenBoer2015,
author = {Arnoud V. den Boer},
doi = {10.1016/j.sorms.2015.03.001},
issue = {1},
journal = {Surveys in Operations Research and Management Science},
month = {6},
pages = {1-18},
title = {Dynamic pricing and learning: Historical origins, current research, and new directions},
volume = {20},
url = {https://www.sciencedirect.com/science/article/pii/S1876735415000021},
year = {2015}
}
@article{Iliou2021,
author = {Christos Iliou and Theodoros Kostoulas and Theodora Tsikrika and Vasilis Katos and Stefanos Vrochidis and Ioannis Kompatsiaris},
doi = {10.1145/3447815},
issue = {3},
journal = {Digital Threats: Research and Practice},
pages = {1-26},
title = {Detection of Advanced Web Bots by Combining Web Logs with Mouse Behavioural Biometrics},
volume = {2},
url = {https://dl.acm.org/doi/10.1145/3447815},
year = {2021}
}
@article{Amjad2017,
abstract = { In this paper, the question of interest is estimating true demand of a product at a given store location and time period in the retail environment based on a single noisy and potentially censored observation. To address this question, we introduce a %non-parametric framework to make inference from multiple time series. Somewhat surprisingly, we establish that the algorithm introduced for the purpose of "matrix completion" can be used to solve the relevant inference problem. Specifically, using the Universal Singular Value Thresholding (USVT) algorithm [7], we show that our estimator is consistent: the average mean squared error of the estimated average demand with respect to the true average demand goes to 0 as the number of store locations and time intervals increase to $\infty$. We establish naturally appealing properties of the resulting estimator both analytically as well as through a sequence of instructive simulations. Using a real dataset in retail (Walmart), we argue for the practical relevance of our approach. },
author = {Muhammad J. Amjad and Devavrat Shah},
doi = {10.1145/3154489},
issue = {2},
journal = {Proceedings of the ACM on Measurement and Analysis of Computing Systems},
month = {12},
pages = {1-28},
publisher = {Association for Computing Machinery (ACM)},
title = {Censored Demand Estimation in Retail},
volume = {1},
url = {https://par.nsf.gov/servlets/purl/10066022},
year = {2017}
}
@article{Calvano2018,
author = {Emilio Calvano and Giacomo Calzolari and Vincenzo Denicolo and Sergio Pastorello},
doi = {10.2139/ssrn.3304991},
journal = {SSRN Electronic Journal},
title = {Artificial Intelligence, Algorithmic Pricing and Collusion},
url = {https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3304991},
year = {2018}
}
@misc{gha_ffary_day_2025_amazon_perplexit,
author = {Shirin Ghaffary and Matt Day},
note = {Updated 2025-11-05},
title = {Amazon Sues to Stop Perplexity From Using AI Tool to Buy Stuff},
url = {https://www.bloomberg.com/news/articles/2025-11-04/amazon-demands-perplexity-stop-ai-agent-from-making-purchases}
}

View File

@@ -6,5 +6,11 @@
%% \label{fig:example}
%% \end{figure}
\section{Know They Enemy}
To know how to overcome we need to
\section{Introduction}
Research Objectives and Contribution: What are we making, why and who should care?
\subsection{Motivation and Market Context}
Current market dynamics and trends of dynamic pricing and AI agents. Future projections of AI agents. Key stakeholders that are discussing this and reporting on it (Thales). Who is most affected
\subsection{Solution Space Overview}
Different approaches and perspectives, here also add a preview of what will be developed and explored in the lit review.

View File

@@ -0,0 +1,17 @@
\section{Literature Review}
\subsection{Foundational Concepts}
What is the taxonomy and definition of an agent and an actor in this case, a bit more about interaction models in sessions and about dynamic pricing algorithms.
\subsection{Problem Evidence and Market Impact}
Documented instances of agent-driven market disruptions - Quantitative evidence of pricing manipulation - Case studies from affected industries
\subsection{Theoretical Foundations: Economic Prallels}
Economic foundations: relating the problem to options pricing theory. Cost of Information (COI) concept and its relevance
\subsection{Landscape of Existing Work}
Previous efforts in adversarial computer use LLM agents, show how multi-faceted the whole problem is
Here we can show a market visualization (venn-like-diagram)

View File

@@ -0,0 +1,68 @@
\section{Methodology}
\subsection{Problem Formalization}
Mathematical formalization of agent-induced pricing distortions. Formal definition of potential loss mechanisms $\alpha D$
We consider a business across time during which we have an evolving vector $p_t \in \Re^N$ where $N$ is the number of products in our catalogue. our price vector is directly dependent on a demand function $q_t$ which we define as a linear method of a price elasticity matrix $B_t$. This is the same setup that Microsoft created in their research. \autocite{Mueller2019}
We gether interaction data from users interacting with a sample platform simulating a hotel/airline which generates interaction distributions $I_t = \{(p_t, q_t^\text{obs}, \pi_t)\}_{t=1}^T$
\subsection{Cost of Information Framework}
Mathematical demonstration and validation of the COI and citation backed evidence, and framework overview + show harm to user via other cost distortions. Maybe split into 3.2.1 (COI Theory) and 3.2.2 (Framework Design)
\subsection{System Architecture}
\begin{figure}[ht]
\centering
\begin{tikzpicture}[
node distance=1.5cm and 2.5cm,
box/.style={rectangle, draw, thick, minimum height=1cm, minimum width=3cm, align=center, fill=blue!10},
kafka/.style={rectangle, draw=orange, thick, minimum height=1cm, minimum width=3cm, align=center, fill=orange!15},
arrow/.style={thick,->,>=Stealth}
]
% Nodes
\node[box] (webapp) {Web Application \\ (Producer \& Consumer)};
\node[kafka, below=of webapp] (kafka) {Apache Kafka \\ Cluster};
\node[box, below=of kafka] (backend) {Backend Services / Microservices \\ (Producers and Consumers)};
% Connections
\draw[arrow] (webapp) to[out=210,in=150] node[above]{Publish} (kafka);
\draw[arrow] (kafka) to[out=50,in=330] node[below]{Consume} (webapp);
\draw[arrow] (backend) -- node[above]{Publish/Consume} (kafka);
% Optional: Kafka internal components
%\node[below=0.7cm of kafka, align=center] (topics) {Topics \\ Partitions};
% Optional background
\begin{scope}[on background layer]
\node[draw, rounded corners, fill=orange!5, fit=(kafka), inner sep=0.3cm] {};
\end{scope}
\end{tikzpicture}
\caption{Technical Diagram}
\end{figure}
High level overview of how it works
\subsection{Experimental Design}
Study methodology and approach. Data acquisition strategy. Defined objectives and success criteria. Observable metrics and KPIs
\subsection{Dynamic Pricing Algorithm Analysis}
Deep dive into how the algorithm works, different kinds and justification for chosen appraoches + agent impact modeling and quantification.
\subsection{Reinforcement Learning Formulation}
How do we define the state space, action space and reward function breakdown and algorithm benchmarking.
POSSIBLY: Expand into full subsections: 3.6.1 (State-Action Space), 3.6.2 (Reward Design), 3.6.3 (Benchmarking)
\begin{algorithm}[t]
\DontPrintSemicolon
\KwIn{stepsize $\eta$, smoothing $\delta$, rank $d$}
\For{$t=1$ \KwTo $T$}{
Sample $u_t$ on unit sphere; set $x_t^\prime=x_t+\delta u_t$\;
Set $p_t \gets U x_t^\prime$ and observe $q_t, R_t(p_t)$\;
$x_{t+1} \gets \Pi\_{\mathcal{X}}(x_t-\eta R_t(p_t) u_t)$\;
}
\caption{Online Pricing Optimization (template)}
\end{algorithm}

View File

@@ -0,0 +1,16 @@
\section{Results}
\subsection{Behavioral Analysis}
Include markov chains of transition matrices, compare distributions (look at Divergence metrics)
\subsection{Experimental Outcomes}
Align with defined objectives, show results and statistical significance (or not).
\subsection{Interpretation and Insights}
Inference from given patterns and show key findings.
\subsection{Anomalies}

View File

@@ -0,0 +1,9 @@
\section{Discussion}
\subsection{Risk Assessment and Limitations}
Acknowledge risks and constraints and data sizes.
\subsection{Implications of Findings}
Interpretation of results and altenrative scenarios with broader market implications.

View File

@@ -0,0 +1,8 @@
\section{Conclusion}
\subsection{Summary of contributions }
Restate the thesis and key findings with validation of research objectives.
\subsection{Future Works and Next Steps}
Identify the research gaps here and potential business implications and setup of business + Proposed extensions and a long term agenda.

View File

@@ -0,0 +1,3 @@
\section{Acknowledgements}
Eugene Bykovets, PhD - ETH

View File

@@ -35,11 +35,17 @@ The primary objective of this thesis is to develop and validate pricing heuristi
\maketitle
\input{chapters/01-intro}
\input{chapters/02-literature-review}
\input{chapters/03-methodology}
\input{chapters/04-results}
\input{chapters/05-discussion}
\input{chapters/06-conclusion}
\printbibliography
\clearpage
\onecolumn
\printbibliography
\clearpage
\appendix
\input{../build/concatenated_code}

View File

@@ -4,10 +4,12 @@
\usepackage{csquotes}
\usepackage{subcaption}
\usepackage{siunitx}
\usepackage{tikz}
\usepackage{listings}
\usepackage{xcolor}
\usepackage[ruled,vlined]{algorithm2e}
\usetikzlibrary{positioning, shapes, arrows.meta, fit, backgrounds}
\lstset{
basicstyle=\ttfamily\footnotesize,
breaklines=true,