W ea NF ”:" Weak Supervision with Normalizing Flows (2022)

Abstract: A popular approach to decrease the need for costly manual annotation of large data sets is weak supervision, which introduces problems of noisy labels, coverage and bias. Methods for overcoming these problems have either relied on discriminative models, trained with cost functions specific to weak supervision, and more recently, generative models, trying to model the output of the automatic annotation process. In this work, we explore a novel direction of generative modeling for weak supervision”:” Instead of modeling the output of the annotation process (the labeling function matches), we generatively model the input-side data distributions (the feature space) covered by labeling functions. Specifically, we estimate a density for each weak labeling source, or labeling function, by using normalizing flows. An integral part of our method is the flow-based modeling of multiple simultaneously matching labeling functions, and therefore phenomena such as labeling function overlap and correlations are captured. We analyze the effectiveness and modeling capabilities on various commonly used weak supervision data sets, and show that weakly supervised normalizing flows compare favorably to standard weak supervision baselines.

## introduction currently an important portion of research in natural language processing is devoted to the goal of reducing or getting rid of large labeled datasets. recent examples include language model fine-tuning @xcite , transfer learning @xcite or few-shot learning @xcite . another common approach is weakly supervised learning. the idea is to make use of human intuitions or already acquired human knowledge to create weak labels. examples of such sources are keyword lists, regular expressions, heuristics or independently existing curated data sources, e.g. a movie database if the task is concerned with tv shows. while the resulting labels are noisy, they provide a quick and easy way to create large labeled datasets. in the following, we use the term labeling functions, introduced in @xcite , to describe functions which create weak labels based on the notions above. throughout the weak supervision literature generative modeling ideas are found @xcite @xcite . probably the most popular example of a system using generative modeling in weak supervision is the data programming paradigm of snorkel @xcite . it uses correlations within labeling functions to learn a graph capturing dependencies between labeling functions and true labels. however, such an approach does not directly model biases of weak supervision reflected in the feature space. in order to directly model the relevant aspects in the feature space of a weakly supervised dataset, we investigate the use of density estimation using normalizing flows. more specifically, in this work, we model probability distributions over the input space induced by labeling functions, and combine those distributions for better weakly supervised prediction. we propose and examine four novel models for weakly supervised learning based on normalizing flows (weanf-*): firstly, we introduce a standard model weanf-s, where each labeling function is represented by a multivariate normal distribution, and its iterative variant weanf-i. furthermore weanf-n additionally learns the negative space, i.e. a density for the space where the labeling function does not match, and a mixed model, weanf-m, where correlations of sets of labeling functions are represented by the normalizing flow. as a consequence, the classification task is a two step procedure. the first step estimates the densities, and the second step aggregates them to model label prediction. multiple alternatives are discussed and analyzed. we benchmark our approach on several commonly used weak supervision datasets. the results highlight that our proposed generative approach is competitive with standard weak supervision methods. additionally the results show that smart aggregation schemes prove beneficial. in summary, our contributions are i) the development of multiple models based on normalizing flows for weak supervision combined with density aggregation schemes, ii) a quantitative and qualitative analysis highlighting opportunities and problems and iii) an implementation of the method 1 . to the best of our knowledge we are the first to use normalizing flows to generatively model labeling functions. ## background and related work we split this analysis into a weak supervision and a normalizing flow section as we build upon these two areas. ## model description in this section the models are introduced. the following example motivates the idea. consider the sentence s, "the movie was fascinating, even though the graphics were poor, maybe due to a low budget.", the task sentiment analysis and labeling functions given by the keywords "fascinating" and "poor". furthermore, "fascinating" is associated with the class pos, and "poor" with the class neg. we aim to learn a neural network, which translates the complex object, text and a possible labeling function match, to a density, in the current example p (s|fascinating) and p (s|poor). we combine this information using basic probability calculus to make a classification prediction. multiple models are introduced. the standard model weanf-s naively learns to represent each labeling function as a multivariate normal distribution. in order to make use of unlabeled data, i.e. data where no labeling function matches, we iteratively apply the standard model (weanf-i). based on the observation that labeling functions overlap, we derive weanf-n modeling the negative space, i.e. the space where the labeling function does not match and the mixed model, weanf-m, using a common space for single labeling functions and the intersection of these. furthermore, multiple aggregation schemes are used to combine the learned labeling function densities. see before we dive into details, we introduce some notation. from the set of all possible inputs x , e.g. texts, we denote an input sample by x and its corresponding vector representation by x. the set of t labeling functions is @xmath0, . . . , λ t } and the classes are @xmath1, . . . , y c }. each labeling function λ : @xmath2. in some of our models, we also associate an embedding with each labeling function, which we denote by λ ∈ r h . the set of labeling functions corresponding to label y is t y . weanf-s/i. the goal of the standard model is to learn a distribution p (x|λ) for each labeling function λ. similarly to @xcite in semi-supervised learning, we use a randomly initialized embedding λ ∈ r h to create a representation for each labeling function in the input space. we concatenate input and labeling function vector and provide it as input to the normalizing flow, thus the learning process is similar to p (x|λ), so a second embedding λ is introduced to represent ¬λ. we optimize p ([x; λ] and p x; λ simultaneously. in each batch i, the positive sample pairs (x i , λ i ) @xmath3, λ j ), sampled such that (x i , λ j ) / ∈ {(x i , λ i )} @xmath4, are used to train the network. the number of negative samples per positive sample is an additional hyperparameter. now bayes' formula can be used as in equation 3 to obtain the access to the posterior probability p (λ|x) provides additional opportunities to model p (y|x). after initial experimentation we settled on two options. a simple addition of probabilities neglecting intersection probability, equation 5, which we call union, and the noisyor formula, equation 7, which has previously shown to be effective in weakly supervised learning @xcite : mixed model. it was already mentioned that it is common that two or multiple labeling functions hit simultaneously. while weanf-n provides access to a posterior distribution which allows to model these interactions, the goal of the mixed model weanf-m is to model these intersections explicitly already in the density of the normalizing flow. more specifically, we aim to learn p (x|{λ i } @xmath5. once again, the embeddings space is used to achieve this afterwards we concatenate the weighted sum of the labeling function embeddings λ i with the input x and learn p ([x; λ i ]). now that the density is able to access the intersections of labeling functions, we derive a new direct aggregation scheme. by σ y we denote the simplex generated by the set of boundary points {λ} λ∈ty . it is important to think about this simplex, as it theoretically describes the input space where the model learns the density related to class y. we use the naive but efficient variant which just computes the center of the simplex: implementation. in practice, sampling of data points has to be handled on multiple occasions. empirically and during the inspection of related implementations, e.g. the github repository accompanying @xcite , we found that it is beneficial if every labeling function is seen equally often during training. it supports preventing a biased density towards specific labeling functions. when training weanf-n, the negative space is much larger than the actual space, so an additional hyperparameter controlling the amount of negative samples is needed. weanf-m aims to model intersecting probabilities directly. most intersections occur too rarely to model a reasonable density. thus we decided to only take co-occures into account which occur more often than a certain threshold. see appendix a.3 to get a feeling for the correlations in the used datasets. ## experiments in order to analyze the proposed models experiments on multiple standard weakly supervised clas-sification problems are performed. in the following, we introduce datasets, baselines and training details. ## analysis the analysis is divided into three parts. firstly, a general discussion of the results is given. secondly, an analysis of the densities predicted by weanf-n is shown and lastly, a qualitative analysis is performed. ## conclusion this work explores the novel use of normalizing flows for weak supervision. the approach is divided into two logical steps. in the first step, normalizing flows are employed to learn a probability distribution over the input space related to a labeling function. secondly, principles from basic probability calculus are used to aggregate the learned densities and make them usable for classification tasks. motivated by aspects of weakly supervised learning, such as labeling function overlap or coverage, multiple models are derived each of which uses the information present in the latent space differently. we show competitive results on five weakly supervised classification tasks. our analysis shows that the flow-based representations of labeling functions successfully generalize to samples otherwise not covered by labeling functions.