Causal Intervention for Leveraging Popularity Bias in Recommendation

Recommender system usually faces popularity bias issues: from the data perspective, items exhibit uneven (long-tail) distribution on the interaction frequency; from the method perspective, collaborative filtering methods are prone to amplify the bias by over-recommending popular items. It is undoubtedly critical to consider popularity bias in recommender systems, and existing work mainly eliminates the bias effect. However, we argue that not all biases in the data are bad -- some items demonstrate higher popularity because of their better intrinsic quality. Blindly pursuing unbiased learning may remove the beneficial patterns in the data, degrading the recommendation accuracy and user satisfaction. This work studies an unexplored problem in recommendation -- how to leverage popularity bias to improve the recommendation accuracy. The key lies in two aspects: how to remove the bad impact of popularity bias during training, and how to inject the desired popularity bias in the inference stage that generates top-K recommendations. This questions the causal mechanism of the recommendation generation process. Along this line, we find that item popularity plays the role of confounder between the exposed items and the observed interactions, causing the bad effect of bias amplification. To achieve our goal, we propose a new training and inference paradigm for recommendation named Popularity-bias Deconfounding and Adjusting (PDA). It removes the confounding popularity bias in model training and adjusts the recommendation score with desired popularity bias via causal intervention. We demonstrate the new paradigm on latent factor model and perform extensive experiments on three real-world datasets. Empirical studies validate that the deconfounded training is helpful to discover user real interests and the inference adjustment with popularity bias could further improve the recommendation accuracy.

INTRODUCTION
Recommender system provides personalized service for users to seek information, playing an increasingly important role in a wide range of online applications, such as e-commerce, news portal, content-sharing platform, and social media. However, the system faces popularity bias issues, which stand on the opposite of personalization. On one hand, the user-item interaction data usually exhibits long-tail distribution on item popularity -a few head items occupy most of the interactions whereas the majority of items receive relatively little attention [2,30]. On the other hand, the recommender model trained on such long-tail data not only inherits the bias, but also amplifies the bias, making the popular items dominate the top recommendations [1,20]. Worse still, the feedback loop ecology of recommender system further intensifies such Matthew effect [29], causing notorious issues like echo chamber [16] and filter bubble [41]. Therefore, it is essential to consider the popularity bias issue in recommender systems.
Existing work on popularity bias-aware recommendation mainly performs unbiased learning or ranking adjustment, which can be categorized into: • Inverse Propensity Scoring (IPS), which adjusts the data distribution to be even by reweighting the interaction examples for model training [17,38]. Although IPS methods have sound theoretical foundations, they hardly work well in practice due to the difficulties in estimating propensities and high model variance. • Causal Embedding, which uses bias-free uniform data to guide the model to learn unbiased embedding [8,27], forcing the model to discard item popularity. However, obtaining such uniform data needs to randomly expose items to users, which has the risk of hurting user experience. Thus the data is usually of a small scale, making the learning less stable. • Ranking Adjustment, which performs post-hoc re-ranking on the recommendation list [3,50] or model regularization on the training [2,50]. Both types of methods are heuristically designed to intentionally increase the scores of less popular items, which however lack theoretical foundations for effectiveness. Instead of eliminating the effect of popularity bias, we argue that the recommender system should leverage the popularity bias. The consideration is that not all popularity biases in the data mean bad effect. For example, some items demonstrate higher popularity because of better intrinsic quality or representing current trends, which deserve more recommendations. Blindly eliminating the effect of popular bias will lose some important signals implied in the data, improperly suppressing the high-quality or fashionable items. Moreover, some platforms have the need of introducing desired bias into the system, e.g., promoting the items that have the potential to be popular in the future. This work aims to fill the research gap of effectively leveraging popularity bias to improve the recommendation accuracy.
To understand how item popularity affects the recommendation process, we resort to the language of causal graph [35] for a qualitative analysis first. Figure 1(a) illustrates that traditional methods mainly perform user-item matching to predict the affinity score: (user node) and (item node) are the causes, and is the effect node to denote the interaction probability. An example is the prevalent latent factor model [18,32], which forms the prediction as the inner product between user embedding and item embedding. Since how a model forms the prediction implies how it assumes the labeled data be generated, this causal graph could also interpret the assumed generation process of the observed interaction data. Item popularity, although exerts a significant influence on data generation process, is not explicitly considered by such coarse-grained modeling methods.
We next consider how item popularity affects the process, enriching the causal graph to Figure 1(b). Let node denote item popularity, which has two edges pointing to and , respectively. First, → means the item popularity directly affects the interaction probability, since many users have herd mentality (a.k.a., conformity), thus tend to follow the majority to consume popular items [28,48]. Second, → means item popularity affects whether the item is exposed, since recommender system usually inherits the bias in the data and exposes popular items more frequently 1 . Remarkably, we find is the common cause for and , acting as the confounder [35] between the exposed items and the observed interactions. It means that, item popularity affects the observed interaction data with two causal paths: 1) → and 2) → → , wherein the second path contains the bad effect of bias amplification, since it increases observed interactions of popular items even though they may not well match user interest.
To remove the bad effect of popularity bias on model training, we need to intervene recommended items to make them immune to their popularity . Experimentally, it means we need to alter the exposure policy to make it free from the impact of item popularity and then recollect data, which is however costly and impossible to achieve for academia researchers. Thanks to the progress on causal science, we can achieve the same result with do-calculus [35] without performing interventional experiments. In short, we estimate the user-item matching as ( | ( , )) that cuts off the path → during training, differing from the correlation ( | , ) estimated by existing recommender models that confounds user 1 Note that we assume users make interaction choice on the exposed items only, and do not consider other information seeking choices like search which is not the focus of this work. Thus the observed interactions are conditioned on the exposure of the interacted items before.  : Causal graphs to describe the recommendation process. U: user, I: exposed item, C: interaction probability, Z: item popularity. We identify as the confounder between and , and propose deconfounded training with ( | ( , )) as the interest matching. interest with popularity bias. Through such deconfounded training, ( | ( , )) estimates user interest matching on items more accurately than ( | , ), removing the spurious correlations between and due to the confounder of . During the inference stage, we infer the ranking score as ( | ( , ), ( )), intervening the item popularity with our desired bias (e.g., the forecasted popularity in the testing stage).
The main contributions of this work are summarized as follows: • We analyze how popularity bias affects recommender system with causal graph, a powerful tool but is seldom used in the community; we identify that the bad impact of popularity bias stems from the confounding effect of item popularity. • We propose Popularity-bias Deconfounding and Adjusting (PDA), a novel framework that performs deconfounded training with do-calculus and causally intervenes the popularity bias during recommendation inference. • We conduct extensive experiments on three real datasets, validating the effectiveness of our causal analyses and methods.

PRIMARY KNOWLEDGE
We use uppercase character (e.g., ) to denote a random variable and lowercase character (e.g., ) to denote its specific value. We use characters in calligraphic font (e.g., U) to represent the sample space of the corresponding random variable, and use (·) to represent probability distribution of a random variable. Let D denote the historical data, which is sequentially collected through stages, i.e., D = {D 1 ∪· · ·∪D }; U = { 1 , . . . , |U | } and I = { 1 , . . . , |I | } denote all users and items, respectively. Through learning on historical data, the recommender system is expected to capture user preference and serves well for the next stage + 1. That is, it aims to obtain high recommendation accuracy on D +1 . In this work, we are interested in the factor of item popularity, defining the local popularity of item on the stage as: where denotes the number of observed interactions for item in D . We can similarly define the global popularity of an item based on its interaction frequency in D, but we think the local popularity has a larger impact on the system's exposure mechanism and user decision, since the system is usually periodically retrained and the most recent data has the largest impact.
Popularity drift. Intuitively, item popularity is dynamic and changes over time, meaning that the impact of popularity bias could also be dynamic. To quantify the popularity drift, we define a metric named Drift of Popularity (DP) to measure the drift between two stages. First, we represent each stage as a probability distribution over items: 1 , . . . , | I | , where each entry denotes an item's frequency in the stage. Then, we use the Jensen-Shannon Divergence (JSD) [15] to measure the similarity between two stages: where and are the two stages. Similar to JSD, the range of DP is [0, (2)], and a higher value indicates a larger popularity drift. Figure 2(a) shows the DP value of two successive stages, i.e., ( , +1) where iterates from 1 to 9, on three real-world datasets (details in Section 4.1.1). We can see that the popularity drift obviously exists in all three datasets, and different datasets exhibit different levels of popularity drift. Figure 2(b) shows the DP value of the first and present stage, i.e., (1, ), which measures the accumulated popularity drift. We can see a clear increasing trend, indicating that the longer the time interval is, the large popularity drift the data exhibits. These results reveal that popularity bias and its impact also change with time. The popularity bias in the future stage differs from that of past stages. If we set the target of model generalization as pursuing high accuracy on the next stage data D +1 2 , then a viable way is to predict popularity trend and inject it into the recommendations.

METHODOLOGY
We first analyze the impact of item popularity on recommendation from a fundamental view of causality. Then we present our PDA framework that eliminates the bad effect of popularity bias on training and intervenes the inference stage with desired bias. Lastly, we present in-depth analyses of our method. Figure 1(b) shows the causal graph that accounts for item popularity in affecting recommendation. By definition, causal graph [35] is a directed acyclic graph where a node denotes a variable and an edge denotes a causal relation between two nodes [35]. It is widely used to describe the process of data generation, which can guide the design of predictive models. Next, we explain the rationality of this causal graph.

Causal View of Recommendation
• Node represents the user node, e.g., user profile or history feature that is used for representing a user. • Node represents the item node. We assume a user can only interact with (e.g., click) the items that have been exposed to him/her, thus denotes the exposed item. • Node represents the interaction label, indicating whether the user has chosen/consumed the exposed item.
• Node represents the item popularity, which can be seen as a hidden variable since it is usually not explicitly modeled by traditional methods (e.g., [18,32] form predictions with Figure  1(a)). But it has a large impact on the recommendation. • Edges { , , } → denote that an interaction label is determined by the three factors: user , item , and the item's popularity . Traditional methods only consider { , } → which is easy to explain: the matching between user interest and item property determines whether a user consumes an item. Here we intentionally add a cause node for capturing user conformity -many users have the herd mentality and tend to follow the majority to consume popular items [28,48]. Thus, whether there is an interaction is the combined effect of , and . • Edge → denotes that item popularity affects the exposure of items. This phenomenon has been verified on many recommender models, which are shown to favor popular items after training on biased data [1].
From this causal graph, we find that item popularity is a confounder that affects both exposed items and observed interactions . This results in two causal paths starting from that affect the observed interactions: → and → → . The first path is combined with user-item matching to capture the user conformity effect, which is as expected. In contrast, the second path means that item popularity increases the exposure likelihood of popular items, making the observed interactions consist of popular items more. Such effect causes bias amplification, which should be avoided since an authentic recommender model should estimate user preference reliably and is immune to the exposure mechanism.
In the above text, we have explained the causal graph from the view of data generation. In fact, it also makes sense to interpret it from the view of model prediction. Here, we denote and as user embedding and item embedding, respectively, and traditional models apply inner product [18,32] or neural network [19] above them for prediction (i.e., Figure 1(a)). Item popularity is not explicitly considered in most models, however, it indeed affects the learning of item embedding. For example, it increases the vector length of popular items, making inner product models score popular items high for every user [48]. Such effect justifies the edge → , which exerts a negative impact to learn real user interest.
To sum up, regardless of which explanation for the causal graph, → causes the bad effect and should be eliminated in formulating the predictive model.

Deconfounded Training
We now consider how to obtain a model that is immune to the impact of → . Intuitively, if we can intervene the exposure mechanism to make it randomly expose items to users, then the collected interaction data is free from the impact of → . Directly training traditional models on it will do. However, the feasibility and efficacy of such solutions are low: first, only the recommender builder can intervene the exposure mechanism, and anyone else (e.g., academia researcher) has no permission to do it; second, even for recommender builder that can intervene the exposure mechanism, they can only use small random traffic, since random exposure hurts user experience much. Effective usage of small uniform data remains an open problem in recommendation research [8,27].
Fortunately, the progress of causal science provides us a tool to achieve intervention without performing the interventional experiments [35]. The secret is the do-calculus. In our context, performing ( ) forces to remove the impact of 's parent nodes, achieving our target. As such, we formulate the predictive model as ( | ( , )), rather than ( | , ) estimated by traditional methods 3 . Let the causal graph shown in Figure 1(b) be , and the intervened causal graph shown in Figure 1(c) be ′ . Then, performing do-calculus on leads to: where ′ (·) denotes the probability function evaluated on ′ . Below explains this derivation step by step: • (1) is because of backdoor criterion [35] as the only backdoor path ← → in has been blocked by ( , ); • (2) is because of Bayes' theorem; • (3) is because that and are independent with in ′ ; • (4) ( | , , ) = ′ ( | , , ) is because that the causal mechanism { , , } → is not changed when cutting off → , ( ) = ′ ( ) since has the same prior on the two graphs. Next, we consider how to estimate ( | ( , )) from data. Apparently, we need to first estimate ( | , , ), and then estimate ( | , , ) ( ).
Step 1. Estimating ( | , , ). This conditional probability function evaluates that given a user-item pair = , = and the item's present popularity as = , how likely the user will consume the item. Let the parameters of the conditional probability function be Θ, we can follow traditional recommendation training to learn Θ, for example, optimizing the pairwise BPR objective function on historical data D: where denotes the negative sample for , (·) is the sigmoid function. The 2 regularization is used but not shown for brevity. Having established the learning framework, we next consider how to parameterize Θ ( = 1| , , ). Of course, one can design it as any differentiable model, factorization machines, or neural networks. But here our major consideration is to decouple the useritem matching with item popularity. The benefits are twofold: 1) decoupling makes our framework extendable to any collaborative filtering model that concerns user-item matching; and 2) decoupling enables fast adjusting of popularity bias in the inference stage (see Section 3.3), since we do not need to re-evaluate the whole model. To this end, we design it as: where Θ ( , ) denotes any user-item matching model and we choose the simple Matrix Factorization (MF) in this work; hyper-parameter is to smooth the item popularity and can control the strength of conformity effect: setting = 0 means no impact and larger value assigns larger impact. ′ (·) is a variant of the Exponential Linear Unit [14] activation function that ensures the positivity of the matching score: (6) This is to ensure the monotonicity of the probability function since ( ) is always a positive number. Lastly, note that one needs to normalize Θ ( = 1| , , ) to make it a rigorous probability function, but we omit it since it is time-consuming and does not affect the ranking of items.
Step 2. Estimating ( | , , ) ( ). Now we move forward to estimate the interventional probability ( | ( , )). Since the space of is large, it is inappropriate to sum over its space for each prediction evaluation. Fortunately, we can perform the following reduction to get rid of the sum: where ( ) denotes the expectation of . Note that the expectation of one variable is a constant. Since ( | ( , )) is used to rank items for a user, the existence of ( ) does not change the ranking. We can thus use To summarize, we fit the historical interaction data with Θ ( = 1| , , ), and use the user-item matching component ′ ( Θ ( , )) for deconfounded ranking. We name this method as Popularity-bias Deconfounding (PD).

Adjusting Popularity Bias in Inference
Owing to ( | ( , )), we can eliminate the bad effect of popularity bias. We now seek for better usage of popularity bias, e.g., promoting the items that have the potential to be popular. Assume the target popularity bias is˜, and we want to endow the recommendation policy with this bias. To achieve the target, we just need to do the intervention of =˜for model inference: where˜denotes the popularity value of˜. This intervention probability directly equals the conditional probability since there is no backdoor path between and in the causal graph. Since the focus of this work is not on popularity prediction, we employ a simple time series forecasting method to set˜: where is the popularity value of the last stage, and is the hyperparameter to control the strength of popularity drift in predicting the future. We name this method as Popularity-bias Deconfounding and Adjusting (PDA). Figure 3 illustrates the workflow of PDA where the training stage optimizes Equation (4) and the inference stage can adjust the popularity bias as: denotes the popularity smoothing hyper-parameter used for model inference, which can be different from that used in training. This is to consider that the strength of popularity bias can drift in the future. In practice, setting˜= can achieve expected performance (cf. Table 2). Setting˜= 0 degrades the method to PD that uses only interest matching for recommendation. Considering the importance of properly stopping model training, PDA uses a model selection strategy based on the adjusted recommendation, which is slightly different from that of PD (see Algorithm 1).

Comparison with Correlation ( | , )
In the beginning, we argue that traditional methods estimate the correlation ( | , ) and suffer from the bad effect of popularity bias amplification. Here we analyze the difference between ( | , ) and ( | ( , )) to offer more insights on this point.
We first transform ( | , ) with the following steps: (1) is the definition of marginal distribution; (2) is because of the Bayes' theorem; (3) is because is independent to according to the causal graph; (4) is because of the Bayes' theorem. Comparing with ( | ( , )) = ( | , , ) ( ), we can see that ( | , ) has an additional term: ( | ), which fundamentally changes the recommendation scoring. Suppose = is a popular item, ( | , = , = ) is a large value since is large, which means the term has a large contribution to the prediction score. ( = | = ) is also a large value due to the popularity bias in the exposure mechanism. Multiplying the two terms further enlarges the score of , which gives a higher score than it deserves. As a result, the popularity bias is improperly amplified. This comparison further justifies the rationality and necessity of ( | ( , )) for learning user interests reliably.

EXPERIMENTS
In this section, we conduct experiments to answer two main questions: RQ1: Does PD achieve the goal of removing the bad effect of popularity bias? How is its performance compared with existing methods? RQ2: Can PDA effectively inject desired popularity bias?
To what extent leveraging popularity bias enhance the recommendation performance. We conduct experiments on three datasets: 1) Kwai: This dataset was adopted in Kuaishou User Interest Modeling Challenge 4 , which contains click/like/follow records between users and videos. It spans about two weeks. In this paper, we only utilize clicking data. Following previous work [42], we take 10-core filtering to make sure that each user and each item have at least 10 interacted records. After filtering, the experimented data has 7,658,510 interactions between 37,663 users and 128,879 items.
2) Douban Movie: This dataset is collected from a popular review website Douban 5 in China by [39]. It contains user ratings for movies and spans more than ten years. We take all rating records as positive samples and only utilize the data after 2010. The 10core filtering is also adopted. After filtering, there are 7,174,218 interactions between 47,890 users and 26,047 items.
3) Tencent: This dataset is collected from Tencent short-video platform from Dec 27 2020 to Jan 6 2021. In this dataset, user interactions are likes, which are reflective of user satisfaction but far more sparse than clicks. Because of its high sparsity, we adopt the 5-core filtering setting, obtaining 1,816,046 interactions between 80,339 users and 27,070 items.
Following Cañamares and Castells [9], we split the datasets chronologically. In particular, we split the datasets into 10 time stages according to the interaction time, and each stage has the same time interval. The last stage is left for validation and testing, in which 30% of users are regarded as validation set and the other 70% of users are regarded as testing set. Note that we do not consider new users and new items in validation and testing.

Baselines.
We compare PD with the following baselines: -MostPop. This method simply recommends the most popular items for all users without considering personalization.
-xQuAD [3]. This is a Ranking Adjustment method that aims to increase the coverage of long-tail items in the recommendation list. We use the codes released by the authors, and utilize it to re-rank the result of BPRMF. Following its original setting, we tune the bias controlling hyper-parameter in [0, 1] with step 0.1.
-BPR-PC [50]. This is a state-of-the-art Ranking Adjustment method for controlling popularity bias. It has two choices: reranking and regularization. Here we implement the re-ranking method based on the BPRMF, because this method shows better performance in the original paper. Following the paper, we tune -DICE [48]. This is a state-of-the-art method for learning causal embeddings to handle the popularity bias. It designs a framework with causality-oriented data to disentangle user interest and conformity into two sets of embedding. We use the codes provided by the authors, and we take the settings suggested for large datasets instead of the default settings since our datasets are relatively large. Because DICE demonstrates superior performance over IPS-based methods [17,38], we do not include IPS-based methods as baselines.
To evaluate the effect of PDA on leveraging desired popularity bias, we compare it with the following popularity-aware methods: -MostRecent [21]. This is an improved version of MostPop, which recommends the most popular items in the last stage rather than in the entire history. Note that PDA takes the last stage to forecast the popularity of next stage to make adjustment.
-BPRMF(t)-pop [33]. This method models the temporal popularity by training a set of time-specific parameters for each stage. We directly utilize the parameters corresponding to the last training stage for validation and testing.
-BPRMF-A and DICE-A. We enhance BPRMF and DICE to inject desired popularity bias during inference in the same manner as PDA by substituting Θ ( , ) with the prediction of BPRMF/DICE in Equation (9). We tune the smooth hyper-parameter˜.

Hyper-parameters and Metrics.
For a fair comparison, all methods are optimized by BPR loss and tuned on the validation data. We optimize all models with the Adam [24] optimizer with batch size as 2, 048 and default choice of learning rate (i.e., 0.001) for all the experiments. We search 2 regularization coefficients in the range of {0.01, 0.001 . . . , 10 −6 , 0} for all models. We adopt the early stopping strategy that stops training if Recall@20 on the validation data does not increase for 100 epochs. For DICE, we use its provided stopping strategy and tune the threshold for stopping to make it comparable to our strategy.

Deconfounding Performance (RQ1)
In this section, we will first study the recommendation performance of our proposed algorithm PD. Then, we analyze its recommendation lists and showcase its rationality. At last, we study the necessity of computing item popularity at different stages in training (i.e., computing local popularity).

4.2.1
Overall Performance. Table 1 shows the comparison of toprecommendation performance. From the table we can find: • The proposed PD achieves the best performance, and consistently outperforms all the baselines on all datasets. This verifies the effectiveness of PD, which is attributed to the deconfounded training to remove the bad effect of popularity bias. In addition, the superior performance of PD reflects the rationality of our causal analysis and the potential of do-calculus in mitigating the bias issue in recommendation. • PD achieves different degrees of improvement on the three datasets.
In particular, PD outperforms all baselines by at least 119%, 34%, and 24% on Kwai, Douban, and Tencent, respectively. We think the difference in the improvement is due to the different properties of the three datasets. For example, the level of popularity drift in the data differs substantially as shown in Figure 2: the popularity drifts of Kwai are much larger than that of the other two datasets. Higher drifts imply that item popularity has larger impact on the recommendation data. That is why the proposed PD outperforms baseline methods the most on the Kwai  dataset. Hence, we believe that formulating the recommender model as ( | ( , )) has larger advantages over ( | , ) in the scenarios exhibiting higher popularity drift. • For BPR-PC and xQuad, which perform ranking adjustment, only BPR-PC has limited improvements over BPRMF on recall, i.e., ranking adjustment has little effect in our setting. The reason is that: heuristic adjustment of the original model prediction can only guarantee an increase in the proportion of long-tail items but cannot guarantee the promoted items are of real interest. BPR-PC performs better than xQuad since xQuad only considers group-level popularity, while BPR-PC computes popularity in a finer granularity at item level. • DICE tries to disentangle popularity and interest influence for an observed interaction to get causal embedding. It only demonstrates a similar performance to BPRMF in our setting, which indicates the rationality of leveraging popularity bias instead of blindly eliminating the bias. Note that in the original paper of DICE, the evaluation data is manually intervened to ensure an even distribution of testing interactions over items, which removes popularity bias in the testing data. Whereas in our setting, the evaluation data is split by time to reflect real-world evaluation of recommender system, and contains popularity bias. Although DICE boosts the scores of unpopular items over popular items, it may under-estimate users' interest matching for popular items.

Recommendation Analysis.
We claim that PD can alleviate the amplification of popularity bias, i.e., removing the bad effect of popularity bias. We conduct an analysis of the recommendation lists to show that deconfounded recommendation does not favor popular items as much as conventional recommendations. Items are placed into 10 different groups in two steps: (1) we sort items according to their popularity in descending order and (2) we divide the items into 10 groups and ensure that the sum of popularity over items in each group is the same. As such, the number of items will increase from group 1 to group 10 and the average popularity among items in each group decreases from group 1 to group 10. Hence we say group 1 is the most popular group and group 10 is the least popular group.
For each method, we sum the number of times of items recommended from each group. Then we divide this number by the total number of recommendations to get the recommendation rate for each group. Formally, we define recommendation rate (RR) for group as: where ( , ) gives the number of times the algorithm recommends item in top-recommendation lists.
For training, the recommendation rate of different groups is uniform (see the black line in Figure 4). If more popular groups have higher recommendation rates, there is the amplification of popularity bias. We show the recommendation rates of each group by different methods in Figure 4, in which (a), (b), and (c) are the results on Kwai, Douban, and Tencent, respectively. Figure 4 (d) is to show the standard deviation (std. dev.) of recommendation rates over all the groups: a smaller value means the recommendation rate is more uniform and is closer to the recommendation rates from training set. The main findings are as follows.
• It is clear that popularity bias will be amplified by BPRMF. Figures 4 (a) (b) (c) show that as the average item popularity decreases from group 1 to group 10, the recommendation rate decreases almost linearly. The gap between the chances to recommend popular items and unpopular items becomes bigger in the recommendation lists compared with that in the training set. • For DICE, the recommendation rate increases initially and then decreases from group 1 to group 10. This is because DICE strategically increases the scores of unpopular items to suppress the problem of amplified interest for popular items. However, this suppression brings two side effects: (1) the items from group 1 and group 2 are over-suppressed such that they have lower chances to be recommended than they have in the training set on Kwai and Tencent and (2) it over-amplifies the interest for the middle groups that contain sub-popular items. As such, blindly eliminating popularity bias would remove the beneficial patterns in the data. • In Figure 4 (a) (b) (c), the RRs of PD exhibit lines that are flatter than other methods, which are the most similar to the training set. Moreover, as we can see in Figure 4 (d), the RR of PD has the smallest standard deviation across groups, indicating the least difference across groups. These results verify that PD provides relatively fair recommendations across groups, and will not overamplify or over-suppress interest for popular items. Along with the recommendation performance in Table 1, the results demonstrate the rationality and effectiveness of only removing the bad effect of popularity bias by deconfounded training. • For the group 10, which has the least popular items, PD has a little higher recommendation rate than other methods. However, PD also cannot provide enough chances of recommendation because of the sparse interactions of items in this group and the insufficient learning of item embedding.
Note that we omit the RRs of the ranking adjustment methods (i.e., BPR-PC and xQuad) since their recommendation rates for unpopular items are manually increased. Instead of tuning the recommendation rate for groups of different popularity, we concentrate more on whether the learned embedding can precisely reveal the real interests of users.

Global Popularity V.S. Local Popularity.
To investigate the necessity of local popularity, we evaluate a variant of PD that uses global popularity defined on the interaction frequency in the entire training set D. We keep the other settings the same as PD and name this method as PD-Global (PD-G). Figure 5 shows the recommendation performance of PD and PD-G on the three datasets. Due to the limited space, we only show the results on recall and NDCG for top-50 recommendation, other metrics show the similar results. According to the figure, PD-G is far worse than PD, which verifies the importance of calculating item popularity locally. We believe PD-G performs poorly because there is only one instance of ( | , , ) on , making ( | , , ) hard to be learned well.

Performance of Adjusting Popularity (RQ2)
In this section, we verify the performance of our proposed method PDA, which introduces some desired popularity bias into recommendation. Firstly, we compare our method with the baselines that inject some popularity bias as well -MostRecent, BPRMF (t)-pop, BPRMF-A, and DICE-A. Secondly, we study the influence of refined prediction of item popularity for PDA. Lastly, we demonstrate overall improvements compared with the baseline model BPRMF.

Comparisons with Baselines.
We utilize two methods to predict the popularity of the testing stage. Specially, method (a) takes the popularity of items from the last stage D as the predicted popularity, while method (b) computes populairity as Equation (8). We apply both (a) and (b) to PDA, DICE-A, and BPRMF-A. The results are shown in Table 2, which lead to the following observations: • By comparing the results of PDA, DICE-A, BPRMF-A, and MostRecent with the results of PD, DICE, BPRMF, and MostPop in Table 1, we find that introducing desired popularity bias into recommendations can improve the recommendation performance. This validates the rationality of leveraging popularity bias, i.e., promoting the items that have the potential to be popular (desired popularity bias) benefits recommendation performance. • Compared with other methods, PDA can outperform both the method BPRMF(t)-pop, which is specially designed for utilizing temporal popularity, and the modified methods BPRMF-A and DICE-A. This is attributed to PDA introducing the desired popularity bias by an intervention, preventing the learning model to amplify the effect of popularity and injecting desired popularity bias in inference, whereas other models are influenced by popularity bias in training. The results validate the advantage of causal intervention in more accurately estimating true interests. • On Kwai and Tencent, method (b) outperforms method (a), indicating that introducing the linear predicted popularity is more effective than straightforwardly utilizing the popularity from the previous stage; On Douban, these two methods achieve almost the same performance. This is because the Douban dataset spans over a longer period of time than the other two datasets, making it harder to predict the popularity from the trends of popularity in training stages.

More Refined Predictions for Popularity.
We conduct an experiment to show that the performance of PDA can be improved with more refined predicted popularity. To get more refined predictions, we uniformly split the data in the last training stage into sub-stages by time, and achieve a more refined prediction of popularity in the last sub-stage, which is closest to the testing stage. We set = 1, 2, 4, 8, 16 and employ method (a) to predict the desired popularity. The results are shown in Figure 6. The performance of PDA can be improved with better-predicted popularity for testing. On the Kwai dataset, the performance first increases and then slightly decreases as increases. However, on the Douban dataset, with a larger , the performance does not drop evidently. This is mainly because the item space of Kwai is far larger than Douban, but they have a similar number of interactions. When is set to a  Table 3. On the Kwai dataset, we get more than 241% improvements over all metrics. On the Douban and Tencent datasets, for the recall and NDCG, we get at least 97% improvements, and for precision and HR, we get at least 57% improvements. The results clearly indicate the superiority of PDA in recommendation and the huge potential of causal analysis and inference for leveraging bias in recommendation.

RELATED WORKS
This work is closely related to two topics: popularity bias in recommender system and causal recommendation.

Popularity Bias
Popularity bias has long been recognized as an important issue in recommendation systems. One line of research [4,9,20,30,40] studies the phenomenon of popularity bias. [20] studies how popularity bias influences different recommendation models and concludes that popularity has a larger impact on BPR-based models [48] than point-wise models [19]; [4] tries to study the relation between popularity bias and other problems such as fairness and calibration. Another line of research [1-3, 8, 38, 48, 50] attempts to improve recommendation performance by removing popularity bias. These works mainly consider three types of methods: IPSbased methods [17,38], causal embedding-based methods [8,27,48], and the methods based on post-hoc re-ranking or model regularization [2,3,23,34,50]. Similar to our work, a very recent work [48] also tries to compute the influence of popularity via causal approaches. The difference is that we analyze the causal relations from a confounding perspective whearas this important aspect was not considered in their work. Some other works have attempted to remove the impact of other bias problems [11], position bias [5], selection bias [43], and exposure bias [12,26] etc. The most widely considered method for handling aforementioned biases is IPS-based method [6,38,47,49]. However, there is no guaranteed accuracy for estimating propensity scores. Utilizing unbiased data is another option for solving bias problems [8,27], however the unbiased data is difficult to obtain and may hurt user experience [43]. Some other methods recognize the importance of utilizing popularity and consider drifted popularity to improve the model performance [7,21,25,33]. [25] tries to utilize temporal popularity in music recommendation and [22] utilizes local popularity for recommending news. [7,21,33] also try to utilize temporal popularity for general recommendation. The biggest difference between our work and other works is that we precisely differentiate popularity bias to be removed and popularity drift to be taken advantage of.

Causal Recommendation
Some efforts have considered causality in recommendation. The first type of work is on confounding effects [10,13,37,44]. For example, [44] takes the de-confounding technique in linear models to learn real interest influenced by unobserved confounders. They learn substitutes for unobserved confounders by fitting exposure data. [37] tries to estimate the causal effect of the recommending operation. They consider the features of users and items as confounders, and reweight training samples to solve the confounding problem. [10] explores the impact of algorithmic confounding on simulated recommender systems. [13] identifies expose rate as a confounder for user satisfaction estimation and uses IPS to handle the confounding problem. In this work, we introduce a different type of confounder that is brought by item popularity.
The second type is counterfactual learning methods [31,45,46]. [31] utilizes a quasi-experimental Bayesian framework to quantify the effect of treatments on an outcome to generate counterfactual data, where counterfactual data refers to the outcomes of unobserved treatments. [46] utilizes a model that is learned with few unbiased data to generate labels for unobserved data. [45] extends Information Bottleneck [45] to counterfactual learning with the idea that the counterfactual world should be as informative as the factual world to deal with the Missing-Not-At-Random problem [43]. Though these works study the problem of causal recommendation, they do not specifically consider popularity bias as well as popularity drift for boosting recommendation performance.

CONCLUSION
In this work, we study how to model and leverage popularity bias in recommender system. By analyzing the recommendation generation process with the causal graph, we find that item popularity is a confounder that misleads the estimation of ( | , ) as done by traditional recommendation models. Different from existing work that eliminates popularity bias, we point out that some popularity bias should be decoupled for better usage. We propose a Popularity-bias Deconfounding and Adjusting framework to deconfound and leverage popularity bias for better recommendation. We conduct experiments on three real-world datasets, providing insightful analyses on the rationality of PDA.
This work showcased the limitation of pure data-driven models for recommendation, despite their dominant role in recommendation research and industry. We express the prior knowledge of how the data is generated for recommendation training as a causal graph, performing deconfounded training and intervened inference based on the causal graph. We believe this new paradigm is general for addressing the bias issues in recommendation and search systems, and will extend its impact to jointly consider more factors, such as position bias and selection bias. Moreover, we are interested in extending our method to the state-of-the-art graph-based recommendation models and incorporate the content features of users and items.


Interpretable deep-learning models to help achieve the Sustainable Development Goals

We discuss our insights into interpretable artificial-intelligence (AI) models, and how they are essential in the context of developing ethical AI systems, as well as data-driven solutions compliant with the Sustainable Development Goals (SDGs). We highlight the potential of extracting truly-interpretable models from deep-learning methods, for instance via symbolic models obtained through inductive biases, to ensure a sustainable development of AI.

was not approved to be used in practice. Later on, the application got approval when a simple decision-tree model (which did not provide the same high accuracy as the deep-learning model) was used instead, since it provided high interpretaibility of the decision-making process. 1 Recent advances in the context of interpretable AI (see the excellent recent review on the topic by Fan et al. [5]) have brought mathematical techniques to provide interpretability properties for the training/test data set, model parameters, output, etc. This is therefore an excellent way to bring transparency to the black-box AI systems, which is such an important feature in the context of AI ethics. Here we would like to differentiate between methods that provide mere explanations regarding the AI results, and methods that yield a complete interpretability of those results. This is an important difference, and we advocate (aligned with the work by Rudin [11]) for methods that provide interpretability. The ideal scenario is when the AI model is interpretable from its inception [15,9]; however, in many applications, particularly dealing with deep learning, the models are already trained on extensive databases and it is costly (or impossible) to reformulate them in an interpretable framework, maintaining the accuracy. Here we will discuss some explainability methods, mention their limitations, and we will propose the use of an approach for interpretability of already-trained neural networks based on symbolic models obtained through inductive biases, recently proposed by Cranmer et al. [3] in the context of physical systems.
An example of approach providing mere explanations is the family of saliency methods, which basically identify which regions of the images or what features of the input data are more relevant to the predictions of the model. Besides the simplistic approach based on assessing the prediction changes when removing certain certain features, saliency methods typically rely on game-theory concepts such as the Shapley value [1], which quantifies the contribution of a certain feature to the predicted results. The main criticism against this type of methods [11] is the fact that they basically identify the parts of the input data the AI model is focused on, but they do not provide any interpretation for the actual outcome (for instance, the reason to place a certain image in one particular category). A similar criticism can be made against feature-analysis methods, which focus on the neural-network features to obtain improved explanatory power from the model [5]. These rely on inverting-based methods that can produce synthesized images from the feature maps [4], again lacking complete interpretability regarding the final outcome of the AI model.
In our view, the method proposed by Cranmer et al. [3] is preferred, since it provides a greater interpretability power to already-trained deep-learning models. Their method is based on the following four steps: (i) One needs to first develop a deep-learning model with a separable internal structure and an inductive bias which is relevant to the nature of the data. Note that the inductive bias constitutes the set of assumptions made on the structure of the deep-learning model to be able to generalize beyond the data seen during training. (ii) After defining the model in (i), it is trained using the standard procedures corresponding to the chosen architecture and using the selected training database. (iii) Then, the key aspect proposed by Cranmer et al. [3] is to fit symbolic expressions to the functions composing the deep-learning model. This is done by means of a genetic algorithm which stochastically combines algebraic formulas. (iv) Finally, the internal functions are replaced by the fitted symbolic expressions.
The power of this method lies in the possibility of analytical expressions to perform the same predictions initially carried out by the black-box deep-learning model. Here it is important to clarify that the resemblance of the predictions between the new and the original models will of course depend on the quality of the fit, but the work by Cranmer et al. [3] is very encouraging in the sense that their new symbolic-based model exhibited better generalization capabilities than the original black-box model. In their case, they illustrated the use of this approach with simple physical examples and a more complex one based on dark-matter simulation data. Their work was focused on graph neural networks (GNNs). We note that an important aspect of this process is to promote sparse models through regularization terms in the loss, effectively favoring the principle of Occam's Razor.
There are many examples where black-box AI models make decisions with important implications in the individuals, and more transparency (provided through interpretability) would be highly beneficial: facialrecognition applications [10], decisions regarding assignment of loans or recruitment [12], health [14], etc. Here we illustrate the use of the methodology described above with the example of tracking poverty using satellite images and CNNs [8]. This work essentially identified features such as night-light intensity, roofing material, distance to urban areas, etc., and they predicted the average economical consumption per capita and day. The predicted-consumption values are in very good agreement with the reported ones, and their identified features can be related to around 75% of the local economic results. Adding interpretability to this model would help to really understand what is the influence of each parameter on the outcome, yielding a more robust and useful tool to track poverty and coordinate actions. In fact, this type of interpretable system may be able to shed light into the dynamics of poverty, producing a deeper understanding of the current trends, and potentially being able to predict and tackle future negative developments related to SDG 1. A schematic representation of the process, as well as its implications on the SDGs, are shown in Figure 1. Thus, the interpretability method by Cranmer et al. [3] can provide clear understanding of the reasoning from the deep-learning models, a fact that may help both professionals and policy makers in two ways: first, being able to know how to improve the models when needed; and second, being able to design better actions aligned with the SDGs.  [3] for adding interpretability to AI models based on symbolic equations. We use the example of poverty tracking via satellite images by Jean et al. [8]. Here n, r and d denote nigh-light intensity, roofing material and distance to urban areas, respectively, whereas C i and α i are model constants. Note that a very simple symbolic model is provided as an example. This model will help to better understand the impact of the different variables on the poverty prediction, thus enhancing the actions to achieve SDG 1. Schematic representation adapted from Ref. [3], and panels extracted from Ref. [8] with permission from the publisher (The American Association for the Advancement of Science).
To conclude, we hope that, through this Comment piece, we will be able to influence AI researchers and policymakers towards the highest benefit for society and the environment, prioritizing interpretable AI and transparency of the employed models. If such interpretable models are achieved, they would also have chances to serve in real applications, by fitting into the Trustworthy-AI assessment guidelines provided by the European Commission. 2


Multi-Class Multi-Instance Count Conditioned Adversarial Image Generation

Image generation has rapidly evolved in recent years. Modern architectures for adversarial training allow to generate even high resolution images with remarkable quality. At the same time, more and more effort is dedicated towards controlling the content of generated images. In this paper, we take one further step in this direction and propose a conditional generative adversarial network (GAN) that generates images with a defined number of objects from given classes. This entails two fundamental abilities (1) being able to generate high-quality images given a complex constraint and (2) being able to count object instances per class in a given image. Our proposed model modularly extends the successful StyleGAN2 architecture with a count-based conditioning as well as with a regression sub-network to count the number of generated objects per class during training. In experiments on three different datasets, we show that the proposed model learns to generate images according to the given multiple-class count condition even in the presence of complex backgrounds. In particular, we propose a new dataset, CityCount, which is derived from the Cityscapes street scenes dataset, to evaluate our approach in a challenging and practically relevant scenario.

Introduction
Developmental studies show that the human brain is endowed with a natural mechanism for understanding numerical quantities [9,44]. Even young children have an abstract understanding of numeracy and can generalize the concept of counting from one category to another (e.g. from objects to sounds) [44]. While counting object instances is relatively easy for humans, it is challenging for deep learning and computer vision algorithms, especially when objects from multiple classes, e.g. persons and cars, are considered.

CityCount Examples
Generated Images 3 cars 2 persons 2 cars + 1 person In this paper, we take a step towards such elementary visual reasoning by addressing the generation of images conditioned on the number of object instances per object class. We are particularly interested in the complex case where objects from multiple classes are present in the same image (compare Figure 1). This is a fundamental vision task, which can even be solved by small children [9], but remains an unsolved problem in computer vision. Apart from that, many practical applications can benefit from the capability to generate images respecting numerical constraints. Especially, it aids the generation of additional diverse training data for visual question answering and counting approaches. Further, the generation of technical designs based on the number of different components is of particular interest in the field of topology design, where data-based approaches have recently been explored successfully in applications ranging from molecular design [2] for chemical applications to product design [34] for aesthetics or engineering performance.
In this paper, we propose to solve multiple-class count (MC 2 ) conditioned image generation (i.e. the generation of images conditioned on the number of objects of different classes, that are visible in the image) as a modular extension to the state-of-the-art network for adversarial image generation, StyleGAN2 [26]. We further argue that object counting should be considered as a multi-class regression problem. While this approach is simple, it allows the similarity between neighboring numbers to be naturally encoded in the network and to transfer the ability to count from one class to another. This will ideally make our network learn to generalize the concept of counting from one object class to another, meaning that it can for example see images of "two cars and one person" at training time and deduce the appearance of "two persons" at inference time. To the best of our knowledge this is the first attempt to evaluate the potential of GANs to generate images based on the multiple object class count.
We validate the proposed approach in two lines of experiments. First, we evaluate the generative performance of our model on synthetic data generated according to the CLEVR [22] dataset as well as on real data from the SVHN [32] dataset. We further propose a new, challenging real-world dataset, CityCount, which is derived from the well-known street scenes dataset Cityscapes [8]. The City-Count dataset comprises of various crops from Cityscapes images which contain specific numbers of objects from the important classes, car and person. The dataset includes various challenging scenarios such as diverse and complex backgrounds, object occlusions, varying object scales and scene geometry. Samples from the CityCount dataset and generated samples from our model are shown in Figure 1. In the second line of experiments, we show that the images generated by MC 2 -StyleGAN2 can be used to enhance the size and quality of training data for count prediction networks, trained on images from CLEVR and CityCount.

Related Work
Generative adversarial networks (GANs) -GANs [15] have rapidly evolved to being the most promising trend for the generation of diverse photo-realistic images. Deep convolutional GAN (DCGAN) [35] demonstrated the potential of convolutional neural networks in this context for the first time. A considerable amount of research was devoted to improve the training stability of GANs [16,23,30] and to develop more evolved architectures [5,25,36]. Conditioning GANs (CGAN) on explicit information was first introduced by Mirza et al. [29]. Since then, various approaches have been proposed to improve the controllability of GANs. Many of these require extensive additional information such as class labels and/or natural language descriptions, e.g. image captions for text-to-image or text-to-video generation [4,18,29,37]. Other variants of conditioning GANs include auxiliary classifier GAN (ACGAN) [33], twin auxiliary classifier GAN (TACGAN) [14] and projection based conditioning methods [31]. ACGAN extends the loss function of GAN with an auxiliary classifier to generate images. TACGAN further improves the divergence between real and generated data distribution of ACGAN by an additional network that interacts with both generator and discriminator. In projection based methods, the condition is projected to the output of the discriminator by considering the inner product of the conditional variable and the feature vector of images. SpatialGAN [18] propose a method for multiple conditioning with bounding box annotations and class labels of objects, and image captions to control the image layout in terms of object identity, size, position and number. In their method, object bounding boxes are provided at test time so the idea of count does not need to be learned. In [10] the authors propose a variational U-Net architecture to condition the image generation on shape or appearance. Various approaches have also been suggested to control the image generation process of GANs in applications such as imageto-image-translation [21,47] or attribute transfer [17,28]. Our work is related to ACGAN, with focus on the problem of multiple-class counting using regression.
Based on the high-resolution architecture introduced in [23], StyleGAN [25] employs adaptive instance normalization [20] based feature map re-weighting to facilitate the manipulation of images over multiple latent spaces, encoding different style properties. StyleGAN2 [26] improves over StyleGAN and avoids some characteristic generation artifacts. Recently, a new technique was proposed [24] to achieve state of the art results with StyleGAN2 even when the training data is limited. While these approaches allow implicit conditioning of image contents for example on given styles, they do not enable to steer explicit properties of a generated image such as the number of generated object instances per object class. Our proposed model introduces an extension to StyleGAN2, that facilitates such an explicit conditioning.
Counting approaches -One way to count objects in an image is to first localize and classify them using an object detection network and then count all found instances. While this approach is effective, it also requires additional class labeled bounding box or object prototype information [6,12,41]. Adapting these approaches for conditional image generation will require additional information such as pre-defined locations of the objects of interest during training. Other methods rely on recurrent neural network architectures and attention mechanisms [38,39,45]. Thus, they can not easily be applied in our problem setting. Density estimation based counting methods [11] show that  Figure 2: MC 2 -StyleGAN2 architecture: The input to the generator is a multiple-class count vector where each index of the vector corresponds to each object class and the value at each index represents the multiplicity of the corresponding object class. In the given CityCount example, the count vector [2,1] corresponds to 2 cars and 1 person respectively. learning to count can be achieved without prior detection and are more reliable in severe occlusion scenarios. Multiple approaches have been proposed to counting object instances in images, for example in the context of visual question answering [3,27,43]. In [1], Agarwal et al. suggest to generate training data for this task by modifying the number of objects using cropping and inpainting.
In this paper, we attempt to guide the image generation process solely by conditioning on the number of objects of pre-defined classes in the images, while a reasonable spatial layout is to be inferred from the training data distribution. Instead of addressing single object class counting as seen in [40,42], where convolutional or recurrent neural networks are used to count digit occurrences, our approach focuses on counting object instances from multiple classes during generation. We introduce an extension to the Style-GAN2 architecture by integrating an additional regression network to the discriminator to facilitate image generation based on the number of objects per class. Based on the findings in [7], our network employs dense blocks in the generator architecture to ease the propagation of the count constraint as well as the regression loss of the count network.

Multiple Class Count Conditioned Image Generation
In this section, we introduce the proposed extension to StyleGAN2 for multiple-class count based image generation, MC 2 -StyleGAN2.

MC 2 -StyleGAN2
We borrow the architectural specifications of the generator and discriminator from StyleGAN2 and extend the model for our application. The input to the generator is a multiple-class count vector, where each index of the vector corresponds to a different object class and the value at each index represents the number of objects from the corresponding object class. The generative part of our model includes a mapping network to map the combination of latent vector and the count constraint to an intermediate latent vector w and a generator/synthesis network to generate images as shown in Figure 2. To the first layer of the mapping network, we provide a combination of randomly sampled noise and our multiple-class count vector, that specifies which objects and how many of each of them are required in the output image. The count vector is also concatenated to every layer in the mapping network as shown in Figure 2. In the generator network, we introduce dense like skip connections where the output from each block is connected to its succeeding blocks. As shown in Figure 2, the real/generated images are passed through two pathways, (1) an adversarial pathway to classify the input images as real/fake and (2) a count regression pathway, to predict the object class and their multiplicity in the input image. The weight sharing between the two sub-networks regularizes the discriminator and reduces the memory consumption during training.

Adversarial Training with Count Loss
The generator G, uses both the latent noise distribution z ∼ N (0, 1) and a multiple-class count vector c = [c 1 , c 2 , . . . , c n ] that represents n different object classes and their respective multiplicity c i , i =, . . . , n, to generate fake images x fake = G(z, c). The discriminator D aims to distinguish between these fake images and real images x real . We denote the data distribution as x ∼ p data (x). The additional count sub-network C is trained to predict the perclass object count, y fake for fake images and y real for real images. The adversarial objective of the network is expressed as The multiple-class count loss L M C 2 is defined as the euclidean distance between the predicted count y real = C(x real ) and true count c of the real images, and the distance between the predicted count y fake = C(x fake ) and the value of the count condition for the generated images.
The count loss thus enforces the generator to generate images with the desired number of object instances. 3

Dataset
Unconditioned  Table 1: Quantitative analysis across datasets -StyleGAN2 models. * For CityCount we used StyleGAN2 with adaptive discriminator augmentation. [24] Hence, the total loss of the network is a combination of adversarial loss to match the distribution of real images with fake images and a count loss to enforce the network to generate images based on the specified input count. The overall objective function of our method is, where λ steers the importance of the count objective.

Implementation Details
The models are trained with images of size 64 × 64 for SVHN, 128 × 128 for CLEVR images and 256 × 256 for CityCount images. All hyperparameters used are provided in the Appendix.

Experimental Analysis
In the following, we evaluate our model in three different settings. We quantitatively evaluate (1) the ability of the model to predict the multiple-class count in terms of Mean Squared Error (MSE) and (2) the quality of the images generated based on the learned count in terms of the Fréchet Inception Distance (FID). The quantitative results for the three datasets are given in Table 1.

CLEVR
The objective of the following experiment is to analyze the ability of the model to generate complex 3D objects and layouts. The well-known CLEVR dataset comprises images of different 3D shapes, cylinders, cubes and spheres of varying colours. For our experiments, we generate a total of 2000 images for each count combination based on the implementation of CLEVR dataset [22]. We consider two variants of CLEVR images, (1) CLEVR-2 with two shapes, cylinder and sphere, and at most six instances of each shape per image and (2) CLEVR-3 with three shapes, cylinder, sphere and cube, and at most three instances of each shape per image. For our first line of experiments, we consider a simple setting, where we restrict shapes of the same class  to be of the same color (red cylinders, green spheres and blue cubes). The generated images shown in Figure 3a show that the proposed model learns to generate images based on the learned object count. For further evaluation, we extend the experimental setting and consider CLEVR shapes with varying colors. As shown in Figure 3b and 3c, the model captures the correlation of the count information even in a more complex setting, where the shape colors do not provide additional information. It can also be observed that the model learned to place objects spatially in reasonable locations although no object bounding box annotations are provided.
Additionally, for count prediction analysis, we consider the performance of the count sub-network in the model. We observed an average count accuracy of 96% for CLEVR-2 and 92% for CLEVR-3 (a more detailed analysis of the count prediction on CLEVR-2 and CLEVR-3 is provided in the Appendix). For CLEVR-3, the observed count prediction accuracy is comparatively lower than for CLEVR-2, potentially for two reasons, (1) the image distribution is highly complex due to the high number of objects in the image (maximum of nine objects per image) and (2) objects in the images are often overlapping significantly.

Interpolation and Extrapolation
We further examine the ability of the model to interpolate between count combinations and to extrapolate to unseen count combinations from one object class to another. For interpolation experiments, we train our model on a subset of CLEVR-2 images, that does not contain images with four spheres and a subset of CLEVR-3 without images of two cylinders, while at test time we evaluate the regression network on exactly such images. The observed MSE values during testing are shown in Table 2. These results show the potential of the model to transfer the learned count four from cylinders to spheres on CLEVR-2 and the learned count two from spheres and cubes to the cylinder class for CLEVR-3 images. For extrapolation experiments, we train the model without samples from an object class with the maximum defined count in the dataset. Since the maximum count in CLEVR-2 is six and for CLEVR-3 is three, we consider a subset of CLEVR-2 images without     Table 2) are comparable with the considered baseline (column 2) for both interpolation and extrapolation of object count. This further confirms that the network is not merely memorizing the count number.

Street View House Numbers (SVHN)
In this section, we consider real world images from noisy training data on the street view house numbers (SVHN) dataset [32]. The dataset includes house numbers cropped from street view images. For our experiments, we considered the original images resized to 64 × 64 pixels and a total of 1500 samples for each count combination. We restrict ourselves to SVHN images with at most two instances of each digit class (SVHN-2), because images with three or more digits are too scarce for training. The count label is a vector of 10 entries prescribing the multiplicity of each digit in the image. The generated images are shown in Figure We observed an average count prediction accuracy of 93%, with an individual accuracy of 91% for count one and 90% for count two respectively (a more detailed analysis of the count prediction on SVHN is provided in the Appendix). We frequently noticed incorrect labels in the original dataset which might affect the count label and prediction accuracy.  The dataset contains images with at most five instances from each of these classes and roughly 1000 images per object class count combination. To equip our dataset with additional count information, we determine the number of objects per class in each image from the 2D bounding box information of cars and persons from the Cityscapes-3D [13] and the CityPerson dataset [46]. To allow for more diverse appearances of persons in the training set, classes including pedestrian, sitting person and rider in the Cityscapes images are considered as positive samples when counting the number of persons in the images. This further increases the complexity of the CityCount dataset in terms of spatial arrangement, since the network has to infer a reasonable placement of persons, like pedestrians on the sidewalk and riders on the road. Since such additional spatial constraints are not explicitly specified, this makes our dataset more interesting and challenging for evaluating the proposed approach. Most importantly, the bounding boxes, that were used to generate the training data, were not provided to the model during training.

CityCount
Evaluation To account for the limited amount of training images, we used the adaptive discriminator augmentation technique [24] for training our model. Samples of real and generated images with their respective count vector are shown in Figure 3e. Each count vector of size two represents the number of cars and persons. For the ease of visualization, boxes are drawn around objects of interest. The model generates images with diverse background and well defined person and car class placed spatially at reasonable locations. As shown in the generated sample of 1 car and 2 persons combination in Figure 3e, the person placed in the road can be seen along with a bike while the second person is standing on the sidewalk. The model learns to distinguish between the pedestrian and the rider class even without an explicit definition of them in the training set.
We evaluate the predictive performance of the count subnetwork for the car and person classes in Figure 4a and 4b respectively. Here, we compare the predicted count values on the generated samples with the true count provided to the generator network during test time. Since in many samples of the training set persons are only partially visible and often out of focus or of low resolution, we observed a comparatively poor count performance for the person class. For higher counts, 4 or 5, the relatively low performance is presumably due to the lower number of training samples and severe occlusions for the corresponding count. We perform an ablation study on synthetic dataset CLEVR and the real dataset CityCount to verify the importance of the additional count loss, generator design, weight sharing in the discriminator and the conditioning methods in the generator.
Count loss We train our model without the count regression network and condition the generator and discriminator with the count label. The rest of our architecture is unchanged. The observed values (w/o count loss in Table 3 show that removing the count loss substantially degrades the perfor-  mance both in terms of count prediction and image quality. Generator architecture We consider two different generator configurations introduced in StyleGAN2. One that uses output skip connections and a second one that uses residual connections. As shown in Table 3 (residual and output skip generator), our proposed dense like connections achieves overall good performance in terms of both count prediction and image quality.
Weight sharing in the Discriminator Further, we compute the evaluation metrics for our model without weight sharing between the count sub-network and the discriminator.
The observed values in Table 3 (w/o discriminator weight sharing) show that the model failed to generate the object count correctly. This confirms the positive impact of weight sharing to regularize the count information and inform the discriminator.
Count conditioning in Generator Lastly, we consider the setting where the count vector is not concatenated to every layer in the mapping network in the generator. The results in Table 3 (w/o label mapping) show that the predictive performance is degraded in this setting. This confirms the benefit of using a count vector based mapping network to propagate the multiple-class count effectively during training.

Comparison with other Methods
We compare the quantitative performance of other conditional GAN variants, CGAN [29], ACGAN [33] and TAC-GAN [14], for multiple-class counting on CLEVR and SVHN images. In order to have a fair comparison of our method with these conditional GAN variants, we use a less evolved network architecture in our proposed model. We call this simplified version of our approach, MC 2 -SimpleGAN. The MC 2 -SimpleGAN generator gets as input a combination of randomly sampled noise and a multipleclass count vector. The generator architecture is inspired by Densenet architecture [19] and includes two dense blocks (where the output from each layer is connected in a feed forward fashion to its succeeding layers) followed by two fully connected layers. The discriminator includes a convolutional based adversarial network and a count regression network with weight sharing. For more architectural details please refer to the Appendix.
The initial results (row 1 to 3 in Table 4) indicate that the considered conditional GAN models did not perform well both in terms of image quality and FID. We even observed mode collapse for CGAN. Hence, we replaced the generator architecture of these models with the a Densenet based generator to improve the performance (rows 4 to 6 in Table 4). Although we could greatly improve the initial performance of these models (which shows the positive impact of the proposed Densenet based generator), MC 2 -SimpleGAN clearly outperforms other methods in the envisioned setting. Further the quality of the generated images is improved with the proposed MC 2 -StyleGAN2.

Training Count Prediction Network using Synthetic Images
We further demonstrate the usability of the images generated by MC 2 -StyleGAN2 for training a count prediction network. In particular, we use a multiple-class extension of regression-based architecture similar to the discriminator of MC 2 -SimpleGAN . The network aims to predict the number of objects per object class for the corresponding input images. We design two experiments in this setting using CLEVR and CityCount images. Since the quality of person instances in CityCount images is comparatively low, we also consider a subset of CityCount called CityCar, comprising solely of car class. The average count accuracy of the model is considered as the evaluation metric.
In the first experiment, we evaluate whether the generated images can improve the count performance when combined along with real images during training.   comparison, the count prediction network is initially trained with real images alone (first row in Table 5). The network is then trained with a combination of real and augmented real images (second row in Table 5). The observed count accuracy is then compared with the performance of the network when trained with real and the generated images (third row in Table 5). For fair comparison we consider equal number of augmented and synthetic images. As shown in Table 5 for CLEVR and CityCar images the combination of real and synthetic images (Real+Syn) improved the baseline setting (Real only) and the combination of real and augmented images (Real+Aug). For CityCount, similar count performance is observed for both Real+Aug and Real+Syn.
In the second experiment, we investigate the potential of the generated images to replace the real images during training, without compromising the count accuracy performance. We consider the setting where the network is trained with a combination of real and synthetic images at various ratios. Initially, the network is trained with only real images and then with only synthetic images. We gradually replace the real images with synthetic images at various proportions and evaluate the count performance for each setting as shown in Table 6. For the baseline comparison of each setting, we consider the count accuracy of the network when trained with the corresponding ratio of the real im-  ages only (x% Real only in Table 6). As seen in Table 6, 50% of real images could be replaced by the generated images without compromising the overall count performance for both CLEVR and CityCar images. The synthetic images could also improve the overall count performance of the network while replacing 25% of real images for both CLEVR and CityCar images. For CityCount images, 25% of real images could be replaced by the generated images without compromising the overall count performance.

Conclusion
In this paper, we investigate the potential of GANs to guide the image generation process based on the number of objects of different classes in the images. While the task of counting is in general very challenging for deep learning approaches, our proposed method can generate images based on the multiple-class count vector in synthetic and real world datasets. Our experiments indicate that the numerosity of objects in the images provides strong information regarding their distinguishability during feature learning and hence allows control of the image generation process. Our evaluation further shows that the model is able to interpolate and extrapolate to unseen counts for specific classes. Even without providing additional information such as the locations of objects in the image, the network infers a reasonable spatial layout and realization of the objects from the training data distribution solely using the count information.

Appendix
In this document, we provide additional details and results to the main paper. The document is structured as follows:

A.2 Extended comparative analysis
In this section, we extend our baseline evaluations of our approach by considering the performance of one of the state of the art conditional GAN based on projection based discriminator, SNGAN. Technically, state of the art conditional GANs such as SNGAN and BigGAN considers conditioning as a classification problem rather than regression. As mentioned in the main paper, counting should be considered as a regression problem than a classification one to transfer the count property from one class to another.
However to demonstrate this experimentally we adapted SNGAN to address multiple-class multiple-label classification. The observed FID and MSE values are given in Table A.2. SNGAN performs well in terms of FID (when compared to MC 2 -SimpleGAN) but is significantly worse in terms of MSE than the proposed approach. Moreover in SNGAN, the transfer of count property from one class to another is not possible by its definition.

B Extended analysis across dataset B.1 Multi MNIST
We consider Multi-MNIST dataset to evaluate the general capability of our approach to generate images based on learned count information using MC 2 -SimpleGAN. We evaluate on two variants of the Multi-MNIST dataset, one with two digits per image (MNIST-2) and the other with three digits per image (MNIST-3). The datasets were generated by uniformly sampling digits from the MNIST dataset and placing them in non-overlapping positions on black background. We used 1000 images for each digit combination during training. The count information is provided to the model as a vector with ten entries comprising the desired number of instances of each digit in the image. Figure B.1 shows the generated samples by our model for different count combinations. The results show that the proposed model is able to produce images based on the given digit count without any supervision.
We observed an average count accuracy of 96% for MNIST-2 images and 93% for MNIST-3, where the accuracy slightly decreases for higher counts.

Interpolation and Extrapolation
To check for interpolation and extrapolation ability of the model, we trained the network with images containing only certain combinations of input count and during testing we input an unseen count combination of digits (see Figure B.1c). For the MNIST-2 dataset, the model sees the count value of only 1 for digit 6 during training. Similarly for the MNIST-3 dataset, the count 3 for digit 9 is unseen during training.  The model is able to transfer the concept of count from one digit to another and predict the count for these unseen combinations. For count value 0 for all digits (also unseen during training), the model is able to generate images without any digits.

B.2 Extended quantitative analysis across datasets
The multiple count prediction distribution of cylinder and sphere class of CLEVR-2 and that of cylinder, sphere and cube class of CLEVR-3 are shown in Figure B.2a and B.2b respectively. Similarly the multiple count distribution for the ten digit classes in SVHN are visualized in Figure B.2c.

B.3 Extended qualitative analysis across datasets
We provide additional qualitative results for CLEVR, SVHN and CityCount images for various count combinations. The generated images for CLEVR-2 and CLEVR-3, both with same color and multicolor for similar shapes are shown in Figure B We introduce MC 2 -SimpleGAN as a simple network based architecture of our proposed method for fair and easy comparison study with other conditional GAN variants. The generator of the MC 2 -SimpleGAN is shown in Figure C.1. The architecture comprises of a count conditioned generator and a discriminator , that is equipped with an additional count prediction network. Our basic generator network is inspired from the DenseNet architecture. DenseNet introduces dense blocks which consist of several convolutional layers where the output from each layer is connected in a feed forward fashion to its succeeding layers (see Figure C.1a for a visualization). The additional skip connections in the dense blocks strengthen the count conditioning in the generator since the input feature maps are connected to the output layers of the dense block. We use two dense blocks of three layers with a growth rate of 64. The generator (Figure C.1b) gets as input a combination of randomly sampled noise and a multiple class count vector. The concatenated vectors are passed through a fully connected layer (FC) with ReLU activation which is followed by the dense blocks. The two dense blocks are coupled with a 1 × 1 convolution to decrease the number of output feature maps and to improve computational efficiency and an upsampling layer to increase the spatial resolution. The output feature maps from the dense block layers are forwarded to two 3 × 3 convolutional layers (Conv) to generate images. For the discriminator as well as for the count network, we use four convolutional layers with shared weights followed by a fully connected layer to discriminate between real and fake images (discriminator) or to regress the multiple class count vector (count network).

Implementation Details
The models are trained with images of size 64 × 64 for Multi-MNIST and SVHN and 128 × 128 for CLEVR images. All images were scaled at the input with pixel values ranging from −1 to 1. Adam optimizer is used with momentum weights, β 1 = 0.5 and β 2 = 0.999 respectively. For generator and discriminator learning rate is fixed to 1e − 4. The network is trained for 200 epochs with batch size 128 and count loss co-efficient λ as 0.7.

C.2 MC 2 -StyleGAN2
We extended the official StyleGAN2 TensorFlow implementation corresponding to configuration-e for our count based image generation for CLEVR and SVHN images. Since the number of training images for CityCount is low, adaptive discriminator augmentation was applied while training the networks for CityCount images. The mapping network is concatenated with the multiple-class count vector at each layers. We also introduce dense like connections in place of residual connections in the synthesis/generator network for improved results. We calculate the FID values on five samples of 50k generated images and report the average value.

Implementation Details
CLEVR and SVHN The models are trained with images of size 64 × 64 for SVHN and 128 × 128 for CLEVR images. The network is trained with minibatch size 32 and the count loss co-efficient as 0.7. The rest of the hyperparameters is similar to the official implementation.
CityCount The models are trained with images of size 256 × 256 for CityCount images. For generator and discriminator, the learning rate is fixed to 0.0025, and Adam optimizer is used with momentum weights, β 1 = 0.0 and β 2 = 0.99 respectively. The number of mapping layers used in the mapping network is 4. The rest of the hyperparameters is similar to the official implementation.

C.3 Count prediction network
A convolution based network architecture shown in Figure C.2 is used for the prediction of multiple-class count prediction of images. The count regression network is similar to the one used in the count sub-network of the MC 2 -SimpleGAN. The network includes four convolution layers followed by LeakyRelu activation and dropout layers with the final block as a fully connected layer which outputs the multiple-class count vector of the corresponding input image.    (b) MC 2 -SimpleGAN Generator: A noise sample and a multi-class count vector are passed to a fully connected layer (FC). Two dense blocks (details see above) coupled with conv. and upsampling layers are followed by two conv. layers.