SpanDrop: Simple and Effective Counterfactual Learning for Long Sequences

1 INTRODUCTION . Building effective machine learning systems for long sequences is a challenging and important task , which helps us better understand underlying patterns in naturally occurring sequential data like long texts ( Radford et al. , 2019 ) , protein sequences ( Jumper et al. , 2021 ) , financial time series ( Bao et al. , 2017 ) , etc . Recently , there is growing interest in studying neural network models that can capture long-range correlations in sequential data with high computational , memory , and statistical efficiency , especially widely adopted Transformer models ( Vaswani et al. , 2017 ) . Previous work approach long-sequence learning in Transformers largely by introducing computational approaches to replace the attention mechanism with more efficient counterparts . These approaches include limiting the input range over which the attention mechanism is applied ( Kitaev et al. , 2019 ) to limiting sequence-level attention to only a handful of positions ( Beltagy et al. , 2020 ; Zaheer et al. , 2020 ) . Other researchers make use of techniques akin to the kernel trick to eliminate the need to compute or instantiate the costly attention matrix ( Peng et al. , 2020 ; Katharopoulos et al. , 2020 ; Choromanski et al. , 2020 ) . Essentially , these approaches aim to approximate the original pairwise interaction with lower cost , and are often interested in still capturing the interactions between every pair of input elements ( e.g. , the long sequence benchmark proposed by Tay et al. , 2020 ) . In this paper , we instead investigate learning problems for long sequences where not all input elements contribute equally to the desired output . Natural examples that take this form include sentiment classification for long customer review documents ( where a few salient sentiment words contribute the most ) , question answering from a large document ( where each question typically requires a small number of supporting sentences to answer ) , key phrase detection in audio processing ( where a small number of recorded frames actually determine the prediction ) , as well as detecting a specific object from a complex scene ( where , similarly , a small amount of pixels determine the outcome ) , to name a few . In these problems , it is usually counterproductive to try and make direct use of the entire input if the contributing portion is small or sparse , which results in a problem of underspecification ( i.e. , the data does not sufficiently define the goal for statistical models ) . One approach to address this problem is annotating the segments or neighborhoods that directly contribute to the outcome in the entire input . This could take the form of a subset of sentences that answer a question or describe the relation between entities in a paragraph ( Yang et al. , 2018 ; Yao et al. , 2019 ) , which function as explainable evidence that supplements the answer . When such annotation is not feasible , researchers and practitioners often need to resort to either collecting more input-output pairs or designing problem-specific data augmentation techniques to make up for the data gap . For real-valued data , this often translates to random transformations ( e.g. , shifting or flipping an image ) ; for symbolic data like natural language , techniques like masking or substitution are more commonly used ( e.g. , randomly swapping words with a special mask token or other words ) . While these approaches have proven effective in some tasks , each has limitations that prevents it from being well-suited for the underspecification scenario . For instance , while global feature transformations enhance groupinvariance in learned representations , they do not directly help with better locating the underlying true stimulus . On the other hand , while replacement techniques like masking and substitution help ablate parts of the input , they are susceptible to the position bias of where the true stimulus might occur in the input . Furthermore , while substitution techniques can help create challenging contrastive examples , it is significantly more difficult to design them for complex symbolic sequences ( e.g. , replacing a phrase naturally in a sentence ) . To address these challenges , we propose SPANDROP , a simple and effective technique that helps models distill sparse supervision signal from long sequences when the problem is underspecified . Similar to replacement-based techniques such as masking and substitution , SPANDROP directly ablates parts of the input at random to construct counterfactual examples that preserve the original supervision signal with high probability . Instead of preserving the original sequence positions , however , SPANDROP directly removes ablated elements from the input to mitigate any bias that is related to the absolute positions of elements ( rather than the relative positions between them ) in the input . Upon closer examination of its theoretical and empirical properties , we further propose a more effective variant of SPANDROP based on the Beta-Bernoulli distribution that enhances the consistency of the augmented objective function with the original one . We demonstrate via carefully designed toy experiments that SPANDROP not only helps models achieve up to 20⇥ sample-efficiency in low-data settings , but also further reduces overfitting even when training data is abundant . We find that it is very effective at mitigating position bias compared to replacement-based counterfactual approaches , and enhances out-of-distribution generalization effectively . We further experiments on four natural language processing tasks that require models to answer question or extract entity relations from long texts , and demonstrate that SPANDROP can improve the performance of already competitive neural models without any change in model architecture . 2 METHOD . In this section , we first formulate the problem of sequence inference , where the model takes sequential data as input to make predictions . Then , we introduce SPANDROP , a simple and effective data augmentation technique for long sequence inference , and analyze its theoretical properties . 2.1 PROBLEM DEFINITION . Sequence Inference . We consider a task where a model takes a sequence S as input and predicts the output y . We assume that S consists of n disjoint but contiguous spans , each representing a part of the sequence in order S = ( s1 , . . . , sn ) . One example of sequence inference is sentiment classification from a paragraph of text , where S is the paragraph and y the desired sentiment label . Spans could be words , phrases , sentences , or a mixture of these in the paragraph . Another example is time series prediction , where S is historical data , y is the value at the next time step . Supporting facts . Given an input-output pair ( S , y ) for sequence prediction , we assume that y is truly determined by only a subset of spans in S. More formally , we assume that there is a subset of spans Ssup ⇢ { s1 , s2 , . . . , sn } such that y is independent of si , if si /2 Ssup . In sentiment classification , Ssup could consist of important sentiment words or conjunctions ( like “ good ” , “ bad ” , “ but ” ) ; in time series prediction , it could reflect the most recent time steps as well as those a few cycles away if the series is periodic . For simplicity , we will denote the size of this set m = |Ssup| , and restrict our attention to tasks where m ⌧ n , such as those described in the previous section . 2.2 SPANDROP . In a long sequence inference task with sparse support facts ( m ⌧ n ) , most of the spans in the input sequence will not contribute to the prediction of y , but they will introduce spurious correlation in a low-data scenario . SPANDROP generates new data instances ( S̃ , y ) by ablating these spans at random , while preserving the supporting facts with high probability so that the model is still trained to make the correct prediction y . This is akin to counterfactually determining whether each span truly determines the outcome y by asking what the prediction would have been without it . Definition 1 ( SPANDROP ) . Formally , given a sequence S that consists of spans ( s1 , s2 , · · · sn ) , SPANDROP generates a new sequence S̃ as follows : i i.i.d.⇠ Bernoulli ( 1 p ) , S̃ = ( si ) ni=1 , i=1 , ( 1 ) where p is the hyperparameter that determines the probability to drop a span . Note that SPANDROP does not require introducing substitute spans or artificial symbols when ablating spans from the input sequence . It makes the most of the natural sequence as it occurs in the original training data , and preserves the relative order between spans that are not dropped , which is often helpful in understanding sequential data ( e.g. , time series or text ) . It is also not difficult to establish that the resulting sequence S̃ can preserve all of the m supporting facts with high probability regardless of how large n is . Remark 1 . The new sequence length n0 = |S̃| and the number of preserved supporting facts m0 = |S̃ \ Ssup| follow binomial distributions with parameters ( n , 1 p ) and ( m , 1 p ) , respectively : P ( n0|n , p ) = ✓ n n0 ◆ ( 1 p ) n 0 pn n 0 , P ( m0|m , p ) = ✓ m m0 ◆ ( 1 p ) m 0 pm m 0 . ( 2 ) Therefore , the proportion of sequences where all supporting facts are retained ( i.e. , m0 = m ) is ( 1 p ) m , which is independent of n. This means that as long as the total number of supporting facts in the sequence is bounded , then regardless of the sequence length , we can always choose p carefully such that we end up with many valid new examples with bounded noise introduced to supporting facts . Note that our analysis so far relies only on the assumption that m is known or can be estimated , and thus it can be applied to tasks where the precise set of supporting facts Ssup is unknown . More formally , the amount of new examples can be characterized by the size of the typical set of S̃ , i.e.the set of sequences that the randomly ablated sequence will fall into with high probability . The size of the typical set for SPANDROP is approximately 2nH ( p ) , where H ( p ) is the binary entropy of a Bernoulli random variable with probability p. Intuitively , these results indicate that the amount of total counterfactual examples generated by SPANDROP scales exponentially in n , but the level of supporting fact noise can be bounded as long as m is small . However , this formulation of SPANDROP does have a notable drawback that could potentially hinder its efficacy . Because the new sequence length n0 follows a binomial distribution , its mean is n ( 1 p ) and its variance is np ( 1 p ) . For sufficiently large n , most of the resulting S̃ will have lengths that concentrate around the mean with a width of O ( p n ) , which creates an artificial and permanent distribution drift from the original length ( see Figure 1 ( a ) ) . Furthermore , if we know the identity of Ssup and keep these spans during training , this length reduction will bias the training set towards easier examples to locate spans in Ssup . In the next subsection , we will introduce a variant of SPANDROP based on the beta-Bernoulli distribution that alleviates this issue .

Summary: The paper focuses on distilling supervision signal from long sequences. They focus on cases where the input is a long sequence of length n, but the target prediction is determined by a small subset of size m of sequence fragments, where m << n. The authors propose augmenting data by randomly dropping spans from the input sequence. They first propose SpanDrop which removes each span with a probability p. This process might result in shorter sequences, resulting in shift of training data distributions. As a fix, they also propose Beta-SpanDrop where the spans are dropped using probabilities sampled from beta bernoulli distribution. Beta SpanDrop preserves the length of the original utterance with higher probability, while generating similar variety of augmented utterances.