Negation Across the Switch Point in Code-Mixed Text

People who speak two languages often switch between them inside a single sentence, as in the Hindi-English tweet "movie achhi nahi thi, total waste." When the word that negates ("nahi," "not," "no") comes from one language and the word it negates comes from the other, the sentence's meaning depends on a cross-language dependency. Multilingual models are poorly equipped for this, because their subword tokenizers break romanized Hindi into fragments and because English training teaches them that the negator comes before the predicate. Hindi often puts it after. We propose to measure this failure directly, then fix it with synthetic training data. The data consists of minimal pairs: two sentences that differ only in a negation cue and have opposite labels. We control which language supplies the cue, which language supplies the negated word, and where the switch falls.

The core bet is that the benefit of negation-focused data augmentation comes from forcing the model to attend to the switch-crossing dependency, not from adding more negated examples. We therefore build a native-speaker-validated contrast test set that isolates cross-switch negation. We also build a generator that uses rules where Hinglish or Spanglish grammar is regular and a large language model (LLM) where it is not, such as idiomatic negation ("kuch khaas nahi"), negative quantifiers, and double negation. The comparison that matters is against volume-matched augmentation that lacks the pairing and the switch control.

Core Claim

In code-mixed sentiment classification, errors on negated sentences are concentrated in configurations where the negation cue and its scope come from different languages. They are worst when the two languages order negation differently. In Hinglish, "nahi" commonly follows the adjective. In Spanglish, "no" precedes it just as English "not" does. Training on label-flipping minimal pairs that cover these switch configurations should repair this failure more effectively than any of three alternatives: volume-matched unpaired negated data, noun-level synthetic code-mixing, or stronger encoders alone. The claim would be falsified in either of two cases. If cross-switch and same-language negation errors turn out to be equally common, the diagnostic premise fails. If unpaired data of the same content matches the paired data, the contrast mechanism fails.

Where This Sits

Three lines of prior work motivate the gap.

The first shows that negation handling is shallow even in English. Classifiers flip to "contradiction" when "not" or "false" appears in a tautology that changes nothing (Stress Test Evaluation for Natural Language Inference). On open models, mid-layer circuits build the right negated meaning, but late-layer attention heads override it by latching onto word co-occurrence (How Language Models Process Negation). That study uses only templated English "X that is not Y" prompts.

The second shows that code-mixing is costly for models. LLMs lose up to about 15 points on code-mixed MMLU for low-resource pairs (Evaluating Code-Mixing in LLMs Across 18 Languages). The SentiMix overview names mixed-language negation markers as a source of sentiment inversion errors but does not isolate them (SemEval-2020 Task 9: Overview).

The third shows that lexicon-based code-mixed systems cannot represent scope at all (TueMix).

Two papers supply the method.

TINA generates contrapositive training pairs with rules and adds an unlikelihood loss, which penalizes the model for predicting labels the logic rules out. This lifts BERT on SNLI-Neg from 49.10% to 69.19%. TINA works on formal English NLI with deterministic negation tools. We borrow its pairing-plus-unlikelihood idea but move it to informal, transliterated, two-language text, where the position and language of the negator become the variables of interest.

CodeMixBench supplies a filtering recipe for LLM-synthesized code-mixed text: a mixing-intensity check, a semantic-similarity check with LaBSE (a multilingual sentence-embedding model), and a naturalness rating. Its generation uses positive substitution instructions only and never targets negation. We reuse the filters but constrain generation to a minimal edit.

Two papers constrain the design.

The first is the pink-elephant effect, where naming a forbidden token in a prompt makes the model more likely to produce it (Controlled Text Generation via Language Model Arithmetic). The second is the finding that negative demonstrations hurt instruction following (Cross-Task Generalization via Natural Language Crowdsourcing Instructions). Together they tell us not to rely on "do not change anything else" prompts to keep edits minimal. Minimality is instead enforced by a deterministic check after generation.

Language Agnostic Code-Mixing Data Augmentation is the closest augmentation competitor. It replaces mostly nouns, or masks them with a placeholder token, so its data never touches negation operators.

Research Program

Diagnostic set. We first build a diagnostic test set from the SentiMix Hinglish and Spanglish test tweets. Native speakers select tweets containing negation and tag each negation instance with three properties: the cue language, the scope-target language, and whether the cue precedes or follows its target. They then write the minimally edited opposite-polarity counterpart. We annotate the original tweets ourselves because SentiMix inter-annotator agreement is only 55%. Natural-test-set gains on the negation subset would be too noisy to detect on those labels. Paired, re-annotated items give a cleaner signal.

Metrics. The primary metric is pair consistency, the fraction of pairs where both members are classified correctly. It is reported separately for same-language and cross-switch configurations, and within cross-switch by order agreement. We include Spanglish as a natural control. Its negation order matches English, so if our hypothesis is right, its cross-switch penalty should be small.

Generator. The generator takes unlabeled code-mixed tweets and produces negation-edited counterparts in a specified cell of the grid (cue language × target language × position).

A rule component handles regular cases, such as inserting or removing "nahi" before the copula and dropping "hai" where colloquial usage allows it.

An LLM component handles the remainder. It receives the source sentence and the target cell as a positive instruction ("rewrite so that the Hindi word nahi negates good") and never an exclusion list. Each output must then pass four checks:

  • Minimality: a token-level diff confined to the negation cue and adjacent function words.
  • Faithfulness: LaBSE similarity to the source above a threshold.
  • Mixing: a language-ID mixing check.
  • Label: a label-flip vote from a separate classifier ensemble.

A native-speaker audit of a random 500-pair sample estimates how noisy the filtered output still is.

Training. Encoders are trained on the original data plus the pairs, using cross-entropy together with TINA-style unlikelihood on the label each pair rules out.

Mechanistic check. A secondary analysis on Llama-3.1-8B asks whether cross-switch negation weakens the mid-layer concept-construction signal described in How Language Models Process Negation, or instead strengthens the late-layer shortcut. We use the same logit-lens reading of intermediate layers on our diagnostic pairs. This analysis supports interpretation and is not required for the main claim.

Extension. Tamil-English (DravidianCodeMix) is the natural next language. Tamil negation is often a verb suffix, which extends the question to lexical and morphological negation. That area is explicitly unaddressed mechanistically.

Baselines

Floor. The naive reference is fine-tuned mBERT with no augmentation. The SentiMix overview reports weighted F1 of 65.4% on Hinglish and 65.6% on Spanglish for it (SemEval-2020 Task 9: Overview). We also run the TueMix logistic regression with bilingual lexicons (weighted F1 0.685 on Hinglish, TueMix) as the non-neural floor. It should score near chance on pair consistency, since it cannot see word order.

Strongest existing system. This is XLM-R fine-tuned on SentiMix, which is the base of the top Hinglish system (Team KK2018, F1 75.0% with adversarial training). The top Spanglish system reaches 80.6% using machine-translation augmentation with cross-lingual models (SemEval-2020 Task 9: Overview). We found no reported result on Lacuna for any system on the negation-containing subset of SentiMix, or on cross-switch negation specifically, so the diagnostic numbers will be new for all systems. Beating XLM-R means two things. First, a pair-consistency gain on cross-switch items that is larger than the bootstrap confidence interval. Second, natural SentiMix F1 that is no worse than the unaugmented XLM-R we train ourselves.

Augmentation competitors. Each is added to the same XLM-R at matched example counts, with the same epochs and the same hyperparameter search budget.

  • Synthetic code-mixing: lexical and placeholder-token replacement from Language Agnostic Code-Mixing Data Augmentation. Its reported low-resource jump is from 0.3062 to 0.4743 F1.
  • Unconstrained LLM generation: negated code-mixed tweets produced with the CodeMixBench filtering recipe, but without minimal-pair pairing.
  • Rules only: our rule component alone.

Zero-shot LLMs. We evaluate these on the diagnostic set only, as a reference for how much of the problem LLMs already solve.

Ablations. Two ablations isolate the key ingredients.

The pair-breaking ablation uses the identical generated sentences but places the members of each pair in different training batches, with the unlikelihood term removed. This tests whether the contrast itself matters.

The same-language-only ablation restricts generation to cells where cue and target share a language. This tests whether covering the switch configurations matters.

Why not just…?

Why not just use a bigger or better multilingual encoder? Larger encoders do score higher overall. RemBERT reaches 86.4% F1 on Tamil-English sentiment (Advancing Sentiment Analysis in Tamil-English Code-Mixed Texts). Yet complex syntax and sarcasm still account for 63% of its errors in that study. On English, BERT scores 49.10% on SNLI-Neg until trained with targeted negation data (TINA). Our diagnostic set tests this directly. If XLM-R-large or RemBERT shows no cross-switch penalty without augmentation, the problem is capacity-limited rather than data-limited, and we would report that.

Why not just insert negation words with rules? This is a real threat. Hinglish copular negation is regular enough that rules may cover most natural cases. We therefore run rules-only as its own arm. If it matches the hybrid generator, the finding becomes "switch-controlled contrast pairs matter, and the generator does not." That still answers the core claim, and the LLM component would be dropped as unnecessary. The LLM component should only help on the idiomatic and quantifier items, which we report separately.

Why not just ablate the negation shortcut heads at inference? On Llama-3.1-8B, ablating those heads lifts templated English negative-prompt accuracy from 50.5% to 67.8% (How Language Models Process Negation). That result has never been tested on transliterated or mixed-order text. We apply the same ablation to our diagnostic pairs. If it closes the cross-switch gap without training, that is a cheaper fix and we will say so. Our expectation is that tokenizer fragmentation of romanized words weakens the mid-layer signal the ablation relies on.

Why not just generate more negated code-mixed data with an LLM? The unconstrained-generation baseline and the pair-breaking ablation answer this directly. If volume matches pairing, the contrast hypothesis is wrong.

Decisive Checks

The first result to establish is the diagnostic. On the SentiMix-derived pairs, cross-switch pair consistency should fall clearly below same-language consistency for Hinglish and much less for Spanglish. If that asymmetry is absent, the order-disagreement account is wrong and the augmentation design must be reconsidered.

The second is the pair-breaking ablation. Paired training should beat the identical unpaired data on cross-switch pair consistency while leaving overall SentiMix F1 unchanged.

The third is transfer to natural text. Gains on the re-annotated natural negation subset, not just on synthetic-style items, show that the model learned negation scope rather than the generator's editing habits. The 500-pair native-speaker audit bounds how much any of these results could come from label noise in the generated pairs.