\begin{algorithm}[!ht]
	\caption{A weighted training approach for A/B tests}
	\label{algo:weighted}
	\begin{algorithmic}[1]
		\Require{The probability of treatment assignment: $p$; a model class for the weight prediction: $\mathcal{G}=\{G_{\theta_W}: \mathbb{R}^d \rightarrow \{0,1\}, {\theta_W}\in \Theta_W\}$; the machine learning model class: $\mathcal{M}=\{M_\theta: \mathcal{X}  \rightarrow \mathcal{Y} , \theta\in \Theta\}$; loss functions: $\ell(M(X),Y)$ (could be $m$-dimensional).}
	    \State Initialize two models, the treatment model ${M}_{\theta_T}$ and the control model ${M}_{\theta_C}$, both of which are set to the current production model.
		\For{$t \gets 1$  to the end of the experiment  }
		\For{$i \gets 1$  to $n_t$  } 
		\State User $i$ arrives. The platform randomly assigns user $i$ to the treatment group with probability $p$. 
		\State When a user is assigned to the treatment group, the platform recommends an item based on the treatment algorithm and model, and vice versa.
		\State Collect data $(X_{i,t},Y_{i,t},Z_{i,t})$.
		\EndFor 
		\State Compute weights: 
		$$W_{T,i,t}=\frac{G_{\theta_W}(X_{i,t})}{p} \text{ and } W_{C,i,t}=\frac{1-G_{\theta_W}(X_{i,t})}{1-p} \text{ , for } i=1,2,\ldots,n_t. $$ 
		\State Update the treatment model  ${M}_{\theta_T}$ by minimizing the weighted loss 
	$$\frac{1}{n_t}\sum_{i=1}^{n_t}W_{T,i,t}\ell({M}_{\theta_T}(X_{i,t}),Y_{i,t}).$$
	    \State Update the control model  ${M}_{\theta_C}$ by minimizing the weighted loss 
	    $$\frac{1}{n_t}\sum_{i=1}^{n_t}W_{C,i,t}\ell({M}_{\theta_C}(X_{i,t}),Y_{i,t}).$$
		\State Update the model $G_{\theta_W}$ using data $\{(X_{i,t},Z_{i,t}),i=1,\ldots,n_t\}$.
		\EndFor
		
		\Return the estimator (\ref{naive_estimator}).
	\end{algorithmic}
\end{algorithm}

\begin{algorithm}
[!ht]
\caption{A weighted training approach for A/B tests}
\begin{algorithmic}
[1]
\Require{The probability of treatment assignment: $p$; a model class for the weight prediction: $\mathcal{G}=\{G_{\theta_W}: \mathbb{R}^d \rightarrow \{0,1\}, {\theta_W}\in \Theta_W\}$; the machine learning model class: $\mathcal{M}=\{M_\theta: \mathcal{X} \rightarrow \mathcal{Y} , \theta\in \Theta\}$; loss functions: $\ell(M(X),Y)$ (could be $m$-dimensional).}
\State Initialize two models, the treatment model ${M}_{\theta_T}$ and the control model ${M}_{\theta_C}$, both of which are set to the current production model.
\For{$t \gets 1$ to the end of the experiment }
\For{$i \gets 1$ to $n_t$ }
\State User $i$ arrives. The platform randomly assigns user $i$ to the treatment group with probability $p$.
\State When a user is assigned to the treatment group, the platform recommends an item based on the treatment algorithm and model, and vice versa.
\State Collect data $(X_{i,t},Y_{i,t},Z_{i,t})$.
\EndFor
\State Compute weights:
$$W_{T,i,t}=\frac{G_{\theta_W}(X_{i,t})}{p} \text{ and } W_{C,i,t}=\frac{1-G_{\theta_W}(X_{i,t})}{1-p} \text{ , for } i=1,2,\ldots,n_t. $$
\State Update the treatment model ${M}_{\theta_T}$ by minimizing the weighted loss
$$\frac{1}{n_t}\sum_{i=1}^{n_t}W_{T,i,t}\ell({M}_{\theta_T}(X_{i,t}),Y_{i,t}).$$
\State Update the control model ${M}_{\theta_C}$ by minimizing the weighted loss
$$\frac{1}{n_t}\sum_{i=1}^{n_t}W_{C,i,t}\ell({M}_{\theta_C}(X_{i,t}),Y_{i,t}).$$
\State Update the model $G_{\theta_W}$ using data $\{(X_{i,t},Z_{i,t}),i=1,\ldots,n_t\}$.
\EndFor
\Return the estimator (\ref{naive_estimator}).
\end{algorithmic}
\end{algorithm}
{
    "title": "tackling interference induced by data training loops in a/b tests: a   weighted training approach",
    "id": "2310.17496",
    "abstract": "in modern recommendation systems, the standard pipeline involves training machine learning models on historical data to predict user behaviors and improve recommendations continuously. however, these data training loops can introduce interference in a/b tests, where data generated by control and treatment algorithms, potentially with different distributions, are combined. to address these challenges, we introduce a novel approach called weighted training. this approach entails training a model to predict the probability of each data point appearing in either the treatment or control data and subsequently applying weighted losses during model training. we demonstrate that this approach achieves the least variance among all estimators that do not cause shifts in the training distributions. through simulation studies, we demonstrate the lower bias and variance of our approach compared to other methods.",
    "categories": "stat.me cs.lg econ.em",
    "doi": "",
    "created": "2023-10-26",
    "updated": "2024-02-03",
    "authors": [
        "nian si"
    ],
    "affiliation": [],
    "url": "https://arxiv.org/abs/2310.17496"
}
{
    "ToxicityFilter": {
        "text_to_toxicity_attributes": {
            "main.tex": {
                "toxicity_score": 0.010304171,
                "severe_toxicity_score": 0.00092983246,
                "identity_attack_score": 0.002848835,
                "insult_score": 0.0072278744,
                "profanity_score": 0.014259194,
                "threat_score": 0.0070164283,
                "sexually_explicit_score": 0.011205662,
                "flirtation_score": 0.25324678
            },
            "main.bbl": {
                "toxicity_score": 0.012566062,
                "severe_toxicity_score": 0.0011873245,
                "identity_attack_score": 0.0040327664,
                "insult_score": 0.0076268767,
                "profanity_score": 0.014976538,
                "threat_score": 0.007637825,
                "sexually_explicit_score": 0.012444182,
                "flirtation_score": 0.21330994
            }
        },
        "reason": null
    }
}
{
    "num_done": {
        "figure": 0,
        "algorithm": 2,
        "plot": 0
    }
}
{
    "NonTrivialRenderingFilter": {
        "white_pixels_ratio": 92.06317286562798,
        "hash": "000700bfdfefef0f",
        "most_frequent_color_ratio": 92.06317286562798
    }
}