Elamur Research

Curriculum Design for Code-switching: Experiments with Language Identification and Language Modeling with Deep Neural Networks

Paper · 2017 · Monojit Choudhury, Kalika Bali, Sunayana Sitaram et al.

Summary

A sentence can start in one language and continue in another. For a system processing that sentence, identifying the language of each word and estimating which words are likely to follow become problems that cross the switch. Yet most of the available training material may come from texts written in a single language. The authors ask how to make use of that material when there are few examples of people using both languages within the same sentence. They study English and Spanish tweets and vary when the training process encounters examples from each language and when it encounters examples that contain a switch.

The paper tests this idea on word-level language identification and language modeling. In the first task, a system uses a word and its surroundings to decide whether that word is English or Spanish. A version of the system also examines character sequences within the word. In the second task, a recurrent network estimates the probabilities of word sequences. Both tasks favor the same schedule, called C6. The system first learns from single-language examples drawn from both languages during the same training phase. It then continues training on code-switched examples. This schedule gives the bilingual system experience with each language before it has to learn from the relatively scarce examples in which they occur together.

On the mixed English–Spanish language identification test set, C6 reaches 89.1% accuracy with word context and 93.7% when character information is added. The corresponding scores for training with all data sources throughout, C7, are 87.7% and 89.6%. For language modeling, C6 gives a held-out perplexity of 6533 in the initial recurrent experiments, where lower values indicate better predictions. A validation-based recipe brings that result to 4544. Combining its predictions with those of a 5-gram system, which uses bounded word sequences to estimate probabilities, brings perplexity to 298.

There is also a result for settings with no mixed-language training examples. Interleaving English and Spanish single-language examples gives the word-context classifier 87.0% accuracy on the mixed test set and gives the recurrent system a perplexity of 9749 on the held-out mixed tweets. That schedule outperforms the corresponding baselines trained on code-switched data alone, although the monolingual collections are much larger. The comparisons show that both the composition of a training phase and the timing of the final exposure matter in these experiments. They leave open how the schedules would compare with abundant code-switched material or with other kinds of text.

Deep dive: Curriculum Design for Code-switching: Experiments with Language Identification and Language Modeling with Deep Neural Networks

A study of how training order affects word-level language identification and language modeling in English–Spanish code-switched tweets. · about 34 minutes to read

The problem and its context

A switch can happen inside the context a system needs

Code-switching is a change of language during a conversation or even during a single utterance. The distinction that matters for this study is where the change happens. Someone can use one language for an entire sentence and another for the next. If a system already knows where each sentence begins and ends and which language each uses, it can send each sentence to the corresponding processor. The other case is a switch within a sentence or clause. A word and the words that explain its role can then come from different languages. The paper focuses on this second case, also called code-mixing.

A change within a sentence creates different problems depending on what the system is trying to predict. For word-level language identification, the language of the surrounding words is evidence about the target word, but the evidence on one side may point towards English and the evidence on the other side toward Spanish. For language modeling, the surrounding sequence is what the system assigns probabilities to. A system that chiefly expects continuations in the language it has just seen can assign very little probability to a plausible continuation in the other language. In both tasks, the system needs to process the words on either side of the change as parts of the same input.

The paper cites a study that estimates code-switching in 2-12% of tweets from cities around the world, with 3.5% on average. Those figures motivate support for mixed input in social media. They do not give the prevalence of the specific kind of local English–Spanish switch used in the paper’s test sets. The authors’ examples of affected applications include machine translation, speech recognition, and part-of-speech tagging. Each can depend on context spanning more than the words assigned to a single language.

The collection problem is different from the processing problem. The authors point out that a corpus for one language pair supplies examples of how those languages are used together. It cannot cover all the combinations that other multilingual communities might use. Collecting and labeling mixed text is also demanding because the work calls for annotators who know the languages involved. Single-language material offers a way to increase the amount of training data without requiring a comparably large labeled corpus for every combination.

In the paper’s terminology, a corpus collected as monolingual can contain borrowings or occasional material in another language. The term describes how the corpus was collected and intended to be used. The authors reserve code-switched data, in their discussion of the training problem, for examples with a switch inside a sentence. They note that some existing corpora released for research on code-switching also contain single-language material or changes across sentence boundaries. This distinction matters because a corpus name alone does not determine what sort of evidence a given training example offers.

How earlier systems made use of single-language data

The authors organize earlier approaches by how they use monolingual material and how much code-switched training data they require. At one end is supervised training on a pool containing monolingual and code-switched examples. A system in this category can use features designed for mixed input while keeping a conventional training procedure. The authors place many submissions to language identification shared tasks in this group. The shared-task reports describe the setting from which part of the current study’s data and comparisons come. First shared task on language identification in code-switched data and Second shared task on language identification in code-switched data

Another approach starts with a trained system for each language. Both systems see the input, and a further component learns to combine their predictions, potentially using the output of a language identifier as additional evidence. The paper describes this strategy in earlier work on tagging English–Spanish text and also points to a related application in speech recognition. The separate systems bring training from their respective languages. The component that combines them can be trained on a smaller mixed corpus because it starts with their predictions as inputs. Part-of-speech tagging for English–Spanish code-switched text

A third approach identifies languages first and divides the input accordingly. A monolingual processor then handles each resulting part, and the outputs are assembled afterward. The paper cites applications to tagging, translation, and speech recognition. It also notes the difficulty with internal switches. Dividing a sentence where the language changes can remove evidence at precisely the point where a processor needs to understand how the parts fit together. An earlier English–Hindi tagging study is among the examples the authors discuss. POS tagging of English–Hindi code-mixed social media content

The final approach in the taxonomy uses a single system trained on material from both languages, then applies it to mixed input. In the strict version of this setup, the system receives no code-switched training examples. The authors call this zero-shot learning for code-switching. They discuss an earlier language identifier whose initialization used monolingual material and whose subsequent unsupervised training used unlabeled material that could contain switches. They also describe a multilingual translation system trained on language pairs that shared a language. That work addressed translation in a pairing absent from its training directions and found limited ability to handle mixed input. These precedents gave the authors reason to investigate what a single shared system could learn, with and without a separate mixed-language training phase. Google’s multilingual neural machine translation system

Why the order of presentation became an experimental question

Once a shared system is allowed to see both single-language and mixed examples, there are several ways to arrange them. Pooling all available examples lets the system improve on each source throughout training, subject to how frequently that source is sampled. A staged approach can give the system a period of learning from the abundant material before exposing it to the target setting. Another staged approach can begin with the mixed material and then use the larger single-language collections. Even a phase devoted entirely to monolingual examples can alternate languages or finish one language before beginning the other.

The broader idea of curriculum learning is that training can give different examples greater influence at different times. The paper situates it in earlier work on presenting simpler examples before more complex ones, with applications including parsing and language modeling. It also discusses a study of domain adaptation that placed general text before text from the target domain. Here, language composition supplies the grouping. The curricula do not rank individual tweets by how hard a reader or a network would find them. A monolingual example belongs to a different training source from a code-switched example even if the monolingual example is difficult in other ways.

The paper describes earlier work on assigning probabilities to code-switched text in terms of several sources of evidence. A bilingual approach pools text from both languages. A factored approach uses signals such as a word’s language or part of speech, or the estimated probability of a switch. Work based on linguistic constraints uses a theory about where switches can occur to inform prediction or decoding. The present study is closest to the pooled-data approach in its choice of inputs. Its extra decision is how to distribute the different inputs over training. This makes the experiment about when particular evidence shapes a shared system, as well as which sources that system sees.

The design also lets the authors ask a narrower question before they consider the best use of mixed data. If a shared system has trained on both languages, can it already do something useful with a sequence that uses them together? A positive answer would establish a role for single-language data even when mixed training material is missing. A further improvement after a mixed phase would establish the value of those examples under the tested schedule. The paper examines both questions on the same pair of tasks.

The method, step by step

From the taxonomy to a shared system

The paper formalizes its earlier-work taxonomy so that the difference between combining training data and combining predictions is explicit. In each expression, the input is a sequence of tokens, typically a sentence. The output is a task-dependent sequence, such as a set of tags or the output tokens of a translation. The notation distinguishes the first language, the second language, and input with a switch between them.

y = g₁∪₂∪₁₂(x)

Here x is the input token sequence, y is the system’s output sequence, and g denotes a trained predictor. In its subscript, 1 and 2 identify the two monolingual sources, 12 identifies the source with switches between them, and ∪ indicates that their examples are pooled. The parentheses show the input supplied to the predictor, and = gives the resulting output. This is the supervised pooled-data case. The expression specifies which sources are available to training. A curriculum can further specify the order in which the sources are used.

y = f₁₂(g₁(x), g₂(x), lid(x))

Again, x is the input, y is the output, and = equates it with the result on the right. The predictors g₁ and g₂ are trained for languages 1 and 2 respectively. The function lid produces a language label for each word in x. The commas separate the inputs to f₁₂, the component trained on code-switched examples to combine the signals. The parentheses show which input each function receives. Here the knowledge obtained from monolingual training enters the final decision through predictions from separate systems.

y = g₁(lid₁(x)) ⊕ g₂(lid₂(x))

Here x and y again denote the input and output sequences, and = assigns the combined result to y. The subscripts 1 and 2 identify the respective languages. The function lid₁ retains the tokens identified as belonging to language 1, and lid₂ retains those identified as belonging to language 2. The predictors g₁ and g₂ process those respective projections, as indicated by the nested parentheses. The operator ⊕ assembles their outputs. This expression follows the paper’s prose definition of the divide-and-conquer method. There is an extra occurrence of x in the printed second branch, where the prose gives the language projection as the predictor’s input.

y = g₁∪₂(x)

In this case x is the input, y is the output, and g₁∪₂ is a single predictor trained on the pooled monolingual sources 1 and 2, with ∪ denoting the pool. The parentheses apply it to x, and = gives the returned output. The entire input can contain switches at test time. As with the pooled supervised expression, the notation gives the training sources and leaves their presentation order to the curriculum.

The experiments investigate the cases with a single shared system. The same system sees both monolingual collections. When a curriculum adds a mixed phase, training continues from the learned state of the earlier phase. For the recurrent sequence predictor, the paper also tests a separate combination of probability estimates at evaluation time. That combination is distinct from the question of when the recurrent network itself sees each training source.

Turning language sources into curricula

Let T₁ contain examples from the first monolingual source and T₂ examples from the second. In the experiments these are English and Spanish respectively. Let T₁₂ contain examples with an internal switch between them. The generic notation uses the subscripts i and j for any of the sources under discussion. A semicolon places the inputs on either side in separate phases. Braces and commas put their enclosed sources in the same phase. For the language identifier, simultaneous presentation means that a mini-batch, a group of examples used for one training update, draws from those sources. The recurrent experiments implement the shared phase through the order of tweets in the training stream.

Tᵢ ; Tⱼ

Here Tᵢ and Tⱼ stand for the sets indexed by i and j. The semicolon means that the learning procedure uses the block from Tᵢ first, then continues with the block from Tⱼ. The two indexes specify source identity. The expression gives the schedule independently of the size of either set.

{Tᵢ, Tⱼ}

The braces enclose sources used during the same phase, and the comma separates the sets Tᵢ and Tⱼ. Here the indexes i and j again specify the data sources. When samples are drawn in proportion to corpus size, the relative sizes describe the expected sampling balance, although the paper allows other balances.

|Tᵢ| : |Tⱼ|

The vertical bars give the number of examples in each set, and the colon expresses their ratio. The symbols Tᵢ and Tⱼ still denote the two sources. This balance concerns how often training sees examples from the sources. It does not specify the balance of languages inside an individual code-switched example.

The schedule labels combine these operations. C0 uses only T₁₂, providing a baseline for what the mixed corpus can teach on its own. C1 starts with English and then continues with Spanish, ending there. C2 adds the mixed block before those same successive monolingual phases. C3 places the mixed block after them. C1 and C3 therefore differ in whether the sequential monolingual preparation is followed by mixed examples. C2 and C3 keep the same sources and move the mixed phase from one end to the other.

C4 puts English and Spanish examples together during training and uses no mixed examples. C5 begins with a mixed block, then moves to English and Spanish together. C6 starts with English and Spanish together, then ends with the mixed block. C5 and C6 reverse the two phases while retaining the same source groupings. C7 brings all sources into a shared training schedule. It is the second baseline and, because natural sampling from the pooled material would give the small mixed source little weight, the authors repeat mixed examples when they implement it. The repetition differs between the two tasks.

Training with the C6 curriculum

The steps in order.

Training with the C6 curriculumStep 1: Separate examples into monolingual and code-switched sources1. Separate examples into monolingual and code-switched sourcesStep 2: Present both monolingual languages in the first phase2. Present both monolingual languages in the first phaseStep 3: Continue training from the resulting shared network3. Continue training from the resulting shared networkStep 4: Use code-switched examples in the final phase4. Use code-switched examples in the final phaseStep 5: Evaluate on held-out examples5. Evaluate on held-out examples

The schedule makes no change to the text of an example. Interleaving an English example with a Spanish example does not produce a code-switched example. It changes what the learner sees across updates or across the training stream. In a separate mixed phase, in contrast, the learner sees actual contexts in which English and Spanish appear together. This distinction gives C4 and C6 different meanings even though both begin with the same kind of bilingual preparation.

How the language identifier processes a word

For language identification, the training instance is a target word and its local window. The paper identifies an instance as mixed when the context contains a switch point. An individual tweet can therefore supply different kinds of instances depending on where the window is centered. A word near a change of language can be seen with context from both languages. Words whose windows stay within a single-language stretch can supply monolingual examples. The dataset sizes for this task count words, and the design assesses individual language decisions within a sequence.

The task definition includes English, Spanish, and a label X for material such as numbers, punctuation, URLs, and hashtags. In the implementation, regular expressions identify the X cases during preprocessing. These cases are excluded as targets for the network during training and testing. The network itself has two output nodes, one for English and one for Spanish. Thus the reported language-label accuracy concerns the English and Spanish decisions made by the learned component.

2k + 1

This is the width of the full input window. The symbol k denotes the number of context words on each side, 2k accounts for the two sides, and + 1 includes the central target. The paper specifies k as 3, with a footnote marker by the setting that refers to the authors’ parameter trials. It refers boundary handling, including the treatment of positions near the beginning and end of a sentence, to supplementary material.

The word-context architecture represents each input word using a learned vector. Such word embeddings give the next computation a numerical representation for each word. The system averages the vectors on the left separately from those on the right. Consequently, the learned classifier can distinguish which side supplied the evidence. Within either side, averaging discards the relative order of the words contributing to that average. The target word’s own vector is kept separately from both summaries.

3dᵥ

In this expression dᵥ denotes the word embedding dimension, written d_w in the paper, and 3 counts the target vector and the two context averages. The dimensions are combined by concatenation, which places the entries of the vectors end to end. The paper sets the word embedding dimension to 100. The combined vector passes through a dense layer of dimension 140 with a rectified linear activation, which sets negative inputs to zero and leaves positive ones. Batch normalization is included to speed convergence, and dropout is applied with probability 0.3 to limit overfitting. A softmax layer turns the final pair of scores into probabilities for English and Spanish.

The character-informed version, Char-LID, keeps that entire word-context path. It adds a representation made from consecutive character trigrams inside the target word. Each trigram has a learned vector of dimension 40. The system averages the vectors of all trigrams in the word and keeps the first and last trigram vectors as separate pieces of information. The average summarizes which short character sequences occur, while the two separate vectors preserve evidence about the beginning and end of the word.

3d꜀

Here d꜀ denotes the character trigram embedding dimension, written d_c in the paper, and 3 counts the trigram average and the first and last trigram vectors. This representation is concatenated with the word-context representation before the dense layer. The authors expect it to help with words outside the word vocabulary. A spelling the system has never seen as a whole can still contain familiar character sequences. The reported architecture comparison measures the effect of adding this character path to the existing one.

The authors implement the classifiers in Microsoft’s Cognitive Toolkit, CNTK. They initialize the word and character vectors uniformly at random, train with mean square error as the loss, and use Adadelta stochastic gradient descent under the toolkit’s default parameter settings. The loss is the quantity the learning procedure tries to reduce during training. Accuracy on the development set serves a different purpose. It determines which trained state is selected for evaluation or for continuation into another phase.

The language identification training uses 20 epochs, or passes over the examples, for the schedules or stages described. In the blockwise schedules, the authors use development accuracy to select a state from one phase and continue training from it in the next, again for 20 epochs. For mixed-source phases they describe randomized presentation, with expected proportions linked to the source sizes. Their schedule definition also says C7 uses a fixed source ratio in mini-batches. The account makes the oversampling decision clear even though it does not spell out the construction of each batch. For C7 they replicate the mixed training data 10 times so that the mixed examples have more influence than they would in a pool with their original frequency.

How the sequence predictor sees the same curricula

The language modeling experiments treat a whole tweet as an example. A tweet in the mixed training collection supplies a sequence containing code-switching. The annotations used for language identification are stripped off. The task is to assign probabilities to word sequences, so the recurrent system receives the text without a language label attached to each word. The unit of training thus changes from a target-centered window to a tweet.

A recurrent network carries a learned state through the processing of a sequence. Its predictions can depend on how that state represents preceding words. Training the network in a different order changes the sequence of updates that produces its parameters. The paper compares this with a 5-gram predictor, which estimates probabilities from occurrences of short word sequences in the corpus. Reordering the same collection of tweets leaves the collection of within-tweet sequences unchanged. Repeating mixed tweets changes their frequency counts, so the 5-gram comparison does distinguish between corpora with and without that repetition.

The authors train and test their recurrent systems with the RNNLM toolkit. It invokes SRILM to build the 5-gram predictors. For the first comparison of curricula, they use the toolkit recipe they call single iteration. That label does not mean they stop after a single pass through the corpus. According to the authors, this recipe uses no validation data, and they manually configured the learning rate to drop after four epochs. The learning rate governs how large the parameter updates can be.

The output vocabulary is large because it contains words from both languages and many spelling variants in the tweets. The toolkit configuration groups words into classes and uses 700 classes in these experiments. The authors choose this setting with a rule of thumb based on the square root of the vocabulary size. They describe the choice as a tradeoff that speeds training at the expense of accuracy. The architecture settings are reported as 150 hidden layers for the initial recipe and 100 hidden layers for the final validation-based recipe. Other hyper-parameters follow the respective toolkit recipes except where the authors describe an adjustment.

There are more English than Spanish tweets in the monolingual collections. For C4 and the opening phase of C6, the authors alternate tweets from English and Spanish as long as both sources have examples available, then append the remaining English tweets. This is a shared phase with both languages, including an English-only remainder. It differs from strict alternation over the full phase and from the two long single-language blocks in C1 and C3. C6 then appends the mixed phase, which gives the recurrent system its last training exposure on the source most similar to the held-out tweets.

For C7, the authors insert the entire mixed tweet collection after every 10k examples from the interleaved monolingual stream. They report using 30 replicas of the mixed data in that curriculum. Its implementation distributes mixed examples across training at intervals, while C6 reserves them for the end. The language modeling comparison omits C5 because the authors took the early results from C2 and C3 as a reason to prioritize other orders.

From the 5-gram predictor’s perspective, the tested schedules yield different corpora only when the included examples or their multiplicities change. The paper builds a monolingual pool corresponding to C1 and C4, and a pool that also includes the mixed tweets at their original frequency corresponding to C2, C3, and C6. A third pool repeats the mixed tweets as in C7, and the C0 corpus contains only mixed tweets. This is why several recurrent schedules can be compared with the same 5-gram result.

The authors also evaluate predictions that combine the recurrent and 5-gram probabilities. They use interpolation, meaning a weighted average of the probability estimates for each continuation. The paper fixes the coefficient at 0.5, giving the two estimates equal weight. The resulting probabilities are then evaluated as a single predictor. The recurrent curriculum can still affect the score of this combination, even when the 5-gram part is identical across schedules.

Experiments and results

Language identification on monolingual and mixed test sets

The language identification data are tweets. The monolingual training collections primarily come from the work of Rijhwani and colleagues. The code-switched training data and the development and test sets all come from work associated with the first shared task on identifying languages in code-switched data. The paper gives the sizes below as word counts. In particular, the mixed training set of 17.5k words is much smaller than either monolingual training set, each reported as 1240k words.

SplitEnglish wordsSpanish wordsEnglish–Spanish words
Training1240k1240k17.5k
Development10061119750
Test13,54248748678

The authors report 1328 switch points in the mixed test data. That count describes changes in language, while 8678 is the reported word count for the mixed split. Evaluation uses the percentage of English and Spanish targets assigned the correct language. The paper reports accuracy on the English, Spanish, and mixed splits and also gives a combined accuracy across test instances. The mixed split is the direct test of the target setting. The combined score additionally reflects performance on the monolingual sets.

With the word-context classifier, C0 reaches 89.1% combined accuracy and 86.6% accuracy on the mixed test set. When all training sources are present throughout under C7, the corresponding results are 94.4% and 87.7%. C6 raises them to 95.1% and 89.1%. The value 89.1% therefore appears in the results in two different roles. It is the combined score of C0 and the mixed-set score of C6.

Char-LID records the highest mixed-set accuracy in the study, 93.7% under C6. Its combined accuracy under the same curriculum is 97.1%. For C7, Char-LID reaches 89.6% on the mixed set and 96.2% across the test instances. The paper gives the Char-LID C0 baseline as 94.5% combined accuracy in the separate data-volume experiment. The main curriculum comparison does not give a mixed-set C0 value for this architecture.

Char-LID curriculum comparison on the English–Spanish mixed test set

Ending with code-switched training gives the character-informed classifier its highest word-level accuracy.

Char-LID curriculum comparison on the English–Spanish mixed test setInterleave monolingual examples, C4: 87.6Interleave monolingual examples, C487.6Code-switched then interleaved monolingual examples, C5: 87.3Code-switched then interleavedmonolingual examples, C587.3Interleaved monolingual then code-switched examples, C6 (this paper): 93.7Interleaved monolingual thencode-switched examples, C6 (this paper)93.7Present all sources throughout, C7: 89.6Present all sources throughout, C789.6
The numbers
System or settingAccuracy %
Interleave monolingual examples, C487.6
Code-switched then interleaved monolingual examples, C587.3
Interleaved monolingual then code-switched examples, C6 (this paper)93.7
Present all sources throughout, C789.6

Performance on the two monolingual test sets shows where the preference for C6 comes from. For the word-context classifier, C6 gives 98.8% on English and 95.8% on Spanish. C4, which uses interleaved monolingual training alone, gives 99.6% on English and 96.3% on Spanish. C7 records 97.5% on English and 97.4% on Spanish. C6 leads on the mixed split and on combined accuracy, while preferences on the individual monolingual splits depend on which language is being evaluated.

The Char-LID numbers show a similar distinction. C6 gives 98.7% on the English test set and 98.3% on the Spanish test set. C7 gives 99.7% on English and 98.2% on Spanish. The mixed-set accuracy is where the move from C7 to C6 is most visible. The paper reports significant gains for C6 using a paired t-test at p < 0.001. It reports error reductions for the word-context classifier of 11% relative to C7 and 55% relative to C0. The reported reductions for Char-LID are 23% relative to C7 and 47% relative to C0.

The poorest word-context results come from schedules that train on the languages in separate blocks and end with the Spanish block. C1 gives 37.0% combined accuracy and 48.3% on the mixed split. C2, which first sees mixed examples and then uses the same monolingual blocks, gives 35.4% combined and 54.2% on the mixed split. C3 adds the mixed phase after the sequential monolingual blocks and improves to 84.1% combined and 78.0% on the mixed split. That result still falls below C0 on both measures. Because C1, C2, and C3 worked poorly with word context, the authors did not run them with Char-LID.

The same word-context classifier can do considerably better with no annotated code-switching during training if both languages occur in the same phase. C4 gives 94.7% combined accuracy and 87.0% on the mixed split. C5, which adds mixed training before the shared monolingual phase, gives 94.8% combined and 86.7% on the mixed split. These results explain why the authors emphasize the placement of the mixed phase. Exposure to the mixed examples at some point in training is a weaker predictor of success than whether that exposure comes after joint practice with both languages.

Probability estimates on held-out mixed tweets

The sequence prediction experiment uses 212k English tweets, 92k Spanish tweets, and 798 code-switched English–Spanish tweets for training. The authors report the size of the code-switched source as 0.2% of the size of the monolingual data. Their separate test set consists of 2200 English–Spanish tweets selected as code-switched by the language identifier from their earlier experiments. These evaluation instances are whole tweets. Their inclusion in the test set depends on automatic language identification.

The metric is perplexity, abbreviated PPL. A predictor earns lower perplexity when it assigns higher probability to the observed test words in their contexts. A very unlikely observed continuation counts against it, even if its most likely prediction was otherwise reasonable. The absolute values reflect the difficulty of assigning probabilities to this collection of tweets under the specified training conditions. All the recurrent schedules in the initial comparison are evaluated on the same held-out set and use the same initial training recipe.

Recurrent perplexity by curriculum on held-out English–Spanish tweets

The lowest perplexity in the initial training recipe comes from interleaving monolingual tweets before the code-switched phase.

Recurrent perplexity by curriculum on held-out English–Spanish tweetsCode-switched only, C0: 27,443Code-switched only, C027,443Separate monolingual blocks, C1: 46,628Separate monolingual blocks, C146,628Code-switched then separate monolingual blocks, C2: 44,516Code-switched then separate monolingualblocks, C244,516Separate monolingual blocks then code-switched, C3: 7987Separate monolingual blocks thencode-switched, C37987Interleaved monolingual only, C4: 9749Interleaved monolingual only, C49749Interleaved monolingual then code-switched, C6 (this paper): 6533Interleaved monolingual thencode-switched, C6 (this paper)6533Code-switched data distributed throughout, C7: 23,384Code-switched data distributedthroughout, C723,384
The numbers
System or settingPerplexity
Code-switched only, C027,443
Separate monolingual blocks, C146,628
Code-switched then separate monolingual blocks, C244,516
Separate monolingual blocks then code-switched, C37987
Interleaved monolingual only, C49749
Interleaved monolingual then code-switched, C6 (this paper)6533
Code-switched data distributed throughout, C723,384

C3 and C6 are the leading recurrent schedules in this comparison. Both end with the code-switched source, and the one with interleaved monolingual preparation, C6, has lower perplexity. The comparison with C0 shows that training on code-switched data alone leaves substantial room for improvement under the conditions tested. C4 has no mixed training tweets and achieves lower perplexity than both C0 and C7. This is a case where arranging the abundant single-language data well gives a stronger recurrent predictor on the target set than distributing repeated mixed examples throughout the training stream.

The authors train C6 again using the toolkit’s validation-based, multiple-iteration recipe and use code-switched data for validation. With that recipe the recurrent perplexity is 4544. The value 6533 remains the appropriate C6 score for the chart’s comparison across curricula because it comes from the same initial recipe as the other entries. The validation-based result shows what the authors obtained when revisiting the chosen curriculum with a different training configuration.

The 5-gram results give a separate point of comparison. The pool containing only monolingual tweets, corresponding to C1 and C4, gives perplexity 915. The pool with the original mixed data added, corresponding to C2, C3, and C6, gives 778. The version with the repeated mixed tweets corresponding to C7 gives 574. The paper describes all standalone 5-gram predictors as having lower perplexity than their recurrent counterparts and gives these corpus-specific scores for the pooled settings. Its numerical discussion does not give the standalone 5-gram value for the mixed-only C0 corpus.

Interpolated perplexity by curriculum on held-out English–Spanish tweets

C6 also leads when the initial recurrent probabilities are combined with 5-gram estimates.

Interpolated perplexity by curriculum on held-out English–Spanish tweetsCode-switched only, C0: 477Code-switched only, C0477Separate monolingual blocks, C1: 1120Separate monolingual blocks, C11120Code-switched then separate monolingual blocks, C2: 609Code-switched then separate monolingualblocks, C2609Separate monolingual blocks then code-switched, C3: 358Separate monolingual blocks thencode-switched, C3358Interleaved monolingual only, C4: 771Interleaved monolingual only, C4771Interleaved monolingual then code-switched, C6 (this paper): 320Interleaved monolingual thencode-switched, C6 (this paper)320Code-switched data distributed throughout, C7: 673Code-switched data distributedthroughout, C7673
The numbers
System or settingPerplexity
Code-switched only, C0477
Separate monolingual blocks, C11120
Code-switched then separate monolingual blocks, C2609
Separate monolingual blocks then code-switched, C3358
Interleaved monolingual only, C4771
Interleaved monolingual then code-switched, C6 (this paper)320
Code-switched data distributed throughout, C7673

With the multiple-iteration C6 recurrent predictor in the interpolation, the best reported perplexity is 298. Interpolation improves the reported perplexity of every constituent recurrent predictor when compared with that recurrent predictor alone. The comparison with the standalone 5-gram scores is more varied. For C7 the standalone 5-gram result is 574, while the interpolated result is 673. For C1, the standalone value is 915 and the interpolated value is 1120. Those entries qualify the paper’s broad statement that interpolation gives the best performance in every case. The strongest setting across the reported language modeling experiments is still the interpolated C6 configuration.

What the ablations show

Joint monolingual training changes the starting point

The curricula themselves provide the main controlled comparisons. C1 and C4 both train with English and Spanish monolingual data and stop without a mixed phase. C1 uses successive language blocks. C4 gives both languages training time in the shared phase. With the word-context classifier, C1 scores 17.8% on the English test set and 70.3% on Spanish, while C4 scores 99.6% and 96.3% respectively. The mixed test accuracies are 48.3% for C1 and 87.0% for C4. The same sources support very different behavior depending on whether the learner sees the languages together during training.

C2 gives a particularly clear picture of the language imbalance that can result from the sequential procedure. It begins with mixed data but ends with Spanish. It scores 0.1% on the monolingual English test set and 100% on the monolingual Spanish test set. The high Spanish accuracy gives little information by itself about whether the resulting classifier is suitable for English–Spanish input. The mixed score of 54.2% and the combined score of 35.4% put that Spanish result in context. The authors interpret this family of results as adaptation towards the language seen last. The experiment measures the endpoint of training. It does not trace the individual features that were retained or lost along the way.

C3 and C6 test how the prior monolingual arrangement matters when both schedules finish on code-switched examples. C3 ends with the same type of data as C6, after seeing the monolingual languages in separate blocks. It gives the word-context classifier 78.0% on the mixed test set, compared with 89.1% for C6. In recurrent language modeling, the corresponding held-out perplexities are 7987 and 6533. The final mixed phase is common to both schedules. The comparison shows that the state carried into that phase has consequences for the end result.

The two tasks also show why the size and direction of a comparison depend on the evaluation. C3 improves substantially over the mixed-only recurrent baseline, whose perplexity is 27,443. In the word-context classification experiment, C3 stays below the mixed-only accuracy of 86.6% on the mixed set. The shared finding concerns C6, which gives a good starting point for the final phase in both tasks. The performance of a mixed phase after separate language blocks is task dependent.

Moving the same mixed phase changes the result

C5 and C6 offer the clearest comparison of whether mixed exposure comes early or late in language identification. Both use a mixed-only phase and a phase that draws on the two monolingual sources together. C5 uses the mixed phase first. C6 uses it last. For the word-context classifier, C5 reaches 86.7% on the mixed test set and C6 reaches 89.1%. For Char-LID, the corresponding results are 87.3% and 93.7%. This comparison keeps the source groupings intact and changes which phase supplies the final updates.

C4 provides a useful anchor for that comparison. It has only the interleaved monolingual phase. With Char-LID, it reaches 87.6% on the mixed test set, while adding a mixed phase at the beginning under C5 gives 87.3%. In this setting, the presence of mixed supervision somewhere in the schedule does not guarantee a better endpoint. C6 shows a clear gain from using that source at the end. The recurrent experiments lack C5, so they cannot make this exact reversal comparison. They do compare C2 and C3, which move the mixed phase around separate language blocks. As a pair, those schedules favor the late phase in recurrent perplexity.

C7 asks a related question about distributing mixed examples throughout training. Its mixed source is repeated, which means that the comparison with C6 changes both placement and repeated exposure. C6 still leads on the main metrics in both tasks. The experiment compares practical schedules under data scarcity. It supplies less direct evidence about how much of the C6 advantage over C7 comes specifically from the placement of a fixed number of updates on mixed examples.

What the character information contributes

Comparing the classifiers within the same curriculum shows what changes when the target word’s character sequences are available. Under C4, mixed-set accuracy is 87.0% with word context and 87.6% with character information. Under C7, the respective mixed-set values are 87.7% and 89.6%. Under C6 they are 89.1% and 93.7%. The character version keeps the word pathway and adds the trigram pathway, so these comparisons measure the effect of adding that representation in the tested configurations.

The authors expect the added representation to help with unfamiliar words, but the main architecture table aggregates all eligible targets. The improvement could include gains on words represented in the existing word vocabulary as well as gains on unfamiliar spellings. The comparisons show where the character-informed system does better as a whole. A result broken out by vocabulary status would be needed to establish how much each group accounts for.

Reducing each source reveals where data scarcity matters

The first data-volume analysis keeps the word-context architecture and uses C4. The authors vary how much of each monolingual collection is available. The horizontal axis of their figure gives pairs of percentages, with the English share increasing in one direction and the Spanish share in the other. The reported pattern is that accuracy is relatively insensitive to moderate changes in the ratio of the two sources. It suffers when either source falls below 1% of its training set in these trials.

These changes involve both proportions and absolute numbers of examples. The authors take the pronounced decline at the extremes as evidence that the amount of material available in the scarcer language matters more here than keeping the two collections closely balanced. The comparison applies to the reported data and the shared monolingual phase of C4. A stronger conclusion about sampling ratios at a fixed amount of data would require holding the total size constant while varying the contributions of the two languages.

The second data-volume analysis uses Char-LID and C7, varying the monolingual and code-switched fractions independently. With code-switched training fixed at 20% of its source, overall test accuracy is 89.5% with no monolingual data, 93.3% with 0.1% of each monolingual source, 94.4% with 1%, and 95.8% with 10%. The same broad pattern holds at the other mixed-data levels in the table, although the row with 100% of the mixed source dips from 94.5% with no monolingual examples to 93.3% at 0.1% before reaching 95.1% at 1% and 96.1% at 10%.

Increasing the fraction of mixed data at a fixed monolingual fraction gives less uniform returns. At 1% of both monolingual training sets, the reported overall test accuracies are 94.4%, 95.4%, and 95.1% at mixed-data fractions of 20%, 50%, and 100% respectively. At 10% of the monolingual sets, those same mixed-data fractions correspond to 95.8%, 95.9%, and 96.1%. The authors describe diminishing returns across the data-volume experiments and emphasize the more pronounced role of the monolingual amounts. They also point out that the monolingual collections are much larger, so moving through percentage levels does not add comparable numbers of training examples across sources.

Where the best identifier still makes mistakes

The authors manually examine around 100 words whose predicted labels disagree with the reference labels for their best C6 system. They find errors around an X tag at roughly 15% and a similar share, approximately 15%, at or near interjections such as haha, jaja, and lmao. About 25% occur near a code-switch point or a sentence boundary. The last category combines two kinds of boundary, so the inspection does not establish a separate share for the immediate neighborhood of a switch.

The inspected cases make the score easier to interpret. Even though X items are handled by regular expressions and excluded as targets for the network, adjacent words can still be difficult to classify. Interjections introduce another source of uncertainty because their spelling or usage may provide weak evidence of a language in isolation. At a switch, the target can be surrounded by words that suggest different labels, and at a sentence boundary the system has less ordinary context on one side. The authors also find that roughly 5% of the apparent errors in their inspection are cases in which they judge the system’s label correct and the reference label wrong. The inspection is a description of a sample of disagreements and leaves the reported test scores as measured against the original reference labels.

Limitations

Limits identified by the authors

The authors restrict the curriculum to one property of the examples, the language or languages they contain. They suggest that the number of switch points and the syntactic structure of an instance could supply other dimensions of difficulty. A schedule could, for instance, distinguish between different mixed examples rather than using membership in the mixed source as the sole criterion for when they are seen. The paper does not run such schedules. It also discusses self-paced learning as future work, leaving open whether a system could select suitable examples for itself as training progresses.

The authors describe the scarcity of mixed training tweets as relevant to the high recurrent perplexities. The held-out tweets are selected for being mixed, while the available mixed training material is very small beside the monolingual source. The experiments establish which schedules do better in that setting. The paper conjectures that C6 and C7 could perform similarly if the three training sources had comparable sizes. That is a prediction about a different data regime. The data-volume analysis varies fractions within the available collections and does not provide a test with equally large sources.

Some decisions were made to keep the experiments tractable. The paper explicitly presents the number of vocabulary classes as a choice favoring training speed, and it fixes the interpolation coefficient instead of searching for it. The authors suggest that adjusting the coefficient could improve results. They also use a different toolkit recipe when rerunning C6 with validation. The final perplexity therefore describes the chosen configuration. The paper makes no matched comparison of all curricula under that recipe.

The authors flag the mismatch between their language labeling task and earlier shared-task systems. The shared-task data included 6 labels, with categories such as named entities and mixed-language words, while this paper’s learned classifier makes only the English versus Spanish decision. The related-work discussion reports that an earlier system reached 96.3% accuracy on the same English–Spanish test set, another obtained 94.6 average F1 for English–Spanish, and an approach with unlabeled data obtained 97.8% average F-1 for the English and Spanish labels. Accuracy counts correct assignments, while F1 combines precision and recall. The earlier values provide context for the task, with different label coverage, metrics, and in some cases training data. The authors identify incorporating unlabeled data as a possible next step for their own classifier.

Limits visible in the experimental setup

Most of the detailed evidence comes from English and Spanish on Twitter. The paper notes that some experiments with English and French show similar trends and directs readers to supplementary material for details. The reported tables establish the comparison primarily for the English–Spanish setting. The motivation extends to speech recognition, translation, and tagging, but the experimental outcomes are language identification accuracy and sequence perplexity. The study does not measure recognition errors, translation quality, or tagging accuracy downstream.

The definition of a training example also changes between the two tasks. A mixed instance for language identification is tied to a target-centered window. For language modeling the input is a tweet, and the recurrent system consumes a sequence. Interleaving means randomized batches of examples in the first task and an ordered stream of tweets with an English remainder in the second. The consistent success of C6 across these implementations supports the broad ordering principle in the tested settings. It leaves questions about the best local sampling rule, batch balance, and treatment of extra examples in a larger language collection.

The mixed tweet set for language modeling is selected by the paper’s best language identifier. This creates a link between the two experiments at evaluation time. The tweets represent the kind of input that the automatic selection process recognizes as English–Spanish code-switching. Tweets with ambiguous interjections, difficult spellings, or hard-to-recognize boundaries may have a different chance of being selected. The paper does not report a human check of the selection for that test set. The perplexity values apply to the automatically assembled set, and the paper offers no direct comparison with a manually verified sample.

In addition, perplexity is aggregated over the sequences in the held-out tweets. A predictor can improve that score by assigning higher probabilities to ordinary within-language continuations, to continuations across switches, or to both. The study does not give a separate perplexity for positions immediately after a switch. Word-level language identification has a related issue. A mixed test split contains switch points, but the main result is accuracy across its targets. The manual inspection indicates that switch neighborhoods can be hard. It does not give accuracy for every tested position near a switch.

The curricula also differ in how they present or repeat data. C7 increases the frequency of mixed examples and presents them throughout training. C6 concentrates that source at the end. In the classifier, staged schedules permit development-based selection at phase boundaries and use the selected state for subsequent training. These are parts of the tested procedures. The results answer which of those procedures performed better. They leave open what the ranking would be under a design that matched the total number of updates, equalized the number of presentations of each example, and changed only their positions.

Finally, the authors suggest that the initial monolingual phase could teach features shared across the task and that the mixed phase could teach features specific to switching. This is an interpretation of the results. The study does not inspect representations by layer, freeze particular layers, or measure which features change after the final phase. Similarly, the manual error analysis and the accuracy and perplexity tables do not test how bilingual people learn to switch. The paper offers the comparison with bilingual experience as a metaphor. Its experimental evidence concerns learned systems exposed to differently ordered datasets.

What came after

Language Modeling for Code-Mixing: The Role of Linguistic Theory based Synthetic Data (2018) cites the curriculum study and addresses the same broad training problem from the side of data construction. The title identifies the later paper’s focus as synthetic examples informed by linguistic theory. In the curriculum experiments, the source of code-switched tweets is fixed before training. The main intervention determines when those existing tweets influence the learner. The later paper’s stated focus moves the question upstream, to the mixed examples that can be supplied for training.

The connection is most direct in the language modeling experiment. C6 places a small collection of observed mixed tweets after a much larger phase of single-language training. A study of linguistically informed synthetic data asks about another source of the mixed-language evidence that is scarce in that setup. These are complementary questions. Data construction determines which patterns of switching are available as examples. Curriculum design determines when examples from each source are encountered and how their influence is distributed over training.

The citation and the later paper’s stated topic establish that connection. They do not establish that the later work adopted C6, used the same tweets, or obtained a particular result from the curriculum. The distinction matters for the original finding. The benefit shown here depends on the way the available English–Spanish examples were presented. Whether a different source of mixed examples would preserve that ranking is a further empirical question.

Cite

Cite as Monojit Choudhury, Kalika Bali, Sunayana Sitaram and Ashutosh Baheti. 2017. Curriculum Design for Code-switching: Experiments with Language Identification and Language Modeling with Deep Neural Networks. Proceedings of the 14th International Conference on Natural Language Processing (ICON-2017).

The paper itself, not this page. BibTeX from the library's record of the work.

@inproceedings{choudhury2017curriculum,
  title = {{Curriculum Design for Code-switching: Experiments with Language Identification and Language Modeling with Deep Neural Networks}},
  author = {Monojit Choudhury, Kalika Bali, Sunayana Sitaram and Ashutosh Baheti},
  booktitle = {Proceedings of the 14th International Conference on Natural Language Processing (ICON-2017)},
  year = {2017},
  url = {https://aclanthology.org/W17-7509/}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/choudhury-2017-curriculum-design-code-switching-experiments/