Persona-aware Generative Model for Code-mixed Language

Ayan Sengupta, Md Shad Akhtar, Tanmoy Chakraborty

Abstract

Code-mixing and script-mixing are prevalent across online social networks and multilingual societies. However, a user's preference toward code-mixing depends on the socioeconomic status, demographics of the user, and the local context, which existing generative models tend to ignore while generating code-mixed texts. In this work, we make a pioneering attempt to develop a persona-aware generative model to generate texts resembling real-life code-mixed texts of individuals. We propose PARADOX, a persona-aware generative model for code-mixed text generation, which is a novel Transformer-based encoder-decoder model that encodes an utterance conditioned on a user's persona and generates code-mixed texts without monolingual reference data. We propose an alignment module that re-calibrates the generated sequence to resemble real-life code-mixed texts. PARADOX generates code-mixed texts that are semantically more meaningful and linguistically more valid. To evaluate the personification capabilities of PARADOX, we propose four new metrics — CM BLEU, CM Rouge-1, CM Rouge-L and CM KS. On average, PARADOX achieves 1.6% better CM BLEU, 57% better perplexity and 32% better semantic coherence than the non-persona-based counterparts.

Introduction: The Challenge of Personalized Code-Mixing

Code-mixing—the practice of alternating between two or more languages in a single conversation—is a global phenomenon, especially prevalent in multilingual societies like India (e.g., "Hinglish"). However, code-mixing is not a monolith; how much a person mixes languages depends heavily on their demographics, socioeconomic status, and the specific context of the conversation.

Existing generative models typically treat code-mixing as a generic translation task or rely on parallel corpora, often ignoring the "persona" of the speaker. This leads to generated text that feels robotic or fails to match the specific linguistic habits of a real user. The challenge lies in capturing a user's "contextual persona"—the fact that a user might use more English when discussing politics but more Hindi when chatting about movies.

Methodology: The PARADOX Framework

The authors introduce PARADOX, a Transformer-based encoder-decoder architecture designed to mimic individual linguistic styles through two key innovations:

The PARADOX architecture featuring the Contextual Persona Encoder and Alignment Module.
  1. Contextual Persona Encoder: Instead of assigning a static ID to a user, PARADOX projects a user’s historical behavior into a probabilistic latent space. This allows the model to capture "contextual perturbations"—the subtle shifts in how a user mixes languages based on the current topic.
  2. Alignment Module: This lightweight module (comprising only 0.025% of the total parameters) learns global semantic similarities between tokens. It re-calibrates the decoder's output to ensure that the generated sequence is semantically coherent and linguistically valid, resembling real-life usage.
  3. FAME (Fused Attention): The model utilizes Multi-Headed Fused Attention to better capture the complex syntax and morphology inherent in code-mixed data.

Datasets

The study utilizes two newly collected, large-scale longitudinal datasets that track individual users over time:

  • Twitter: 18,126 tweets from 2,241 users, filtered for specific topics like politics and Bollywood.
  • YouTube: 8,957 comments from 1,349 users across popular Indian channels.

Key Results and Insights

PARADOX demonstrated superior performance across both automated and human metrics, proving that modeling persona as a distribution rather than a fixed vector allows for better adaptation to conversational contexts.

Examples of code-mixed (CM) text generated by PARADOX for a specific user, alongside English (Eng) translations and Code-Mixing Index (CMI) scores.
  • Intrinsic Quality: The model achieved 57% better perplexity and 32% better semantic coherence than non-persona-based Transformers.
  • Personification: PARADOX outperformed large language models (LLMs) like Llama 2 and GPT-4 on "CM BLEU" (a new metric proposed to measure switching pattern similarity) by an average of 4.2% to 11%.
  • Human Evaluation: In blind tests, human evaluators rated PARADOX-generated text significantly higher in both Linguistic Quality (3.00 vs 2.32) and Semantic Coherence (3.08 vs 2.34) compared to vanilla Transformers.

Limitations and Future Work

Despite its success, several hurdles remain. PARADOX currently faces a "cold-start problem," as it relies on a user's history to generate personalized text. It also does not explicitly account for how a person’s language might evolve over long periods or incorporate explicit socio-demographic data like age or location. Future work will explore "co-association" among users and methods to handle users with zero historical data.

Summary updated

BibTeX
@article{sengupta2024persona,
  author = {Ayan Sengupta and Md Shad Akhtar and Tanmoy Chakraborty},
  title = {{Persona-aware Generative Model for Code-mixed Language}},
  journal = {Accepted by TMLR},
  year = {2024},
  url = {https://openreview.net/forum?id=fzP4qIiVIh},
}
Figure