CSWBench: Evaluating Context-Sensitive Code-Switching in Creative Writing
Organizations: School of Artificial Intelligence, Jilin University, China · College of Software, Jilin University, China · Xingchen AGI Lab, China Telecom Artificial Intelligence Technology (Beijing) Co., Ltd., China · Bilibili Inc., China ·
Abstract
Large language models (LLMs) have demonstrated multilingual capabilities across diverse language generation and understanding tasks. Yet effective code-switching requires more than multilingual proficiency: models must decide when, where, and why to switch languages in ways that fit the surrounding context. This context-sensitive ability remains insufficiently evaluated. We introduce CSWBench, a benchmark for evaluating context-sensitive code-switching in creative writing through two complementary settings: Focused Narrative and Extended Narrative. We further propose CSWEval, a theory-informed framework with two complementary levels: event-level evaluation of Licensing, Contextual Appropriateness, and Functional Gain, and whole-text evaluation of task-specific quality---overall literary and narrative quality in Focused Narrative and quality emphasizing multilingual organization in Extended Narrative. Evaluating twelve LLMs, we find that models exhibit meaningful but uneven code-switching competence across narrative contexts. Model differences are particularly pronounced in multilingual literary integration, while multilingual-focused dimensions show stronger difficulty effects overall than the general narrative dimensions; narratively salient switches are associated with stronger contextual and functional realization; and event-level CS quality is moderately associated with whole-text performance.
Figures & tables
| Benchmark | Task | Granularity | Generation | CS Choice | CS Orch. | Salience |
| LinCE Aguilar et al. (2020) | CS NLP | Token / Utterance | ||||
| CodeMixBench Yang and Chai (2025) | CS Understanding | Token / Text | ||||
| ChiEngMixBench Yang et al. (2026) | CS Generation | Sentence Pair / Text | ||||
| LitBench Fein et al. (2026) | Creative Writing | Story Pair | ||||
| WritingBench Wu et al. (2025b) | Writing | Whole Text | ||||
| CSWBench | Creative Writing | Event + Whole Text |
| Models | Focused Narrative | Extended Narrative | ||||||||
| D1 | D2 | D3 | Whole | D1 | D2 | D3 | Whole | |||
| Proprietary Models | ||||||||||
| GPT-5.6-Sol | 4.998 | 3.349 | 3.348 | 3.806 | 15.501 | 4.881 | 4.102 | 4.032 | 4.752 | 17.767 |
| GPT-5.6-Terra | 4.997 | 3.333 | 3.340 | 3.740 | 15.410 | 4.769 | 4.069 | 4.020 | 4.494 | 17.352 |
| GPT-5.5 | 4.999 | 3.357 | 3.362 | 3.819 | 15.537 | 4.781 | 4.007 | 3.946 | 4.614 | 17.348 |
| Gemini-3.5-Flash | 4.995 | 3.323 | 3.299 | 3.276 | 14.893 | 4.894 | 3.871 | 3.674 | 4.032 | 16.471 |
| Group | Original CS stronger | Tie | Monolingual counterfactual stronger | Directional score |
| HIGH | 56.9% | 20.8% | 22.2% | +0.347 |
| LOW | 29.9% | 48.6% | 21.5% | +0.083 |
Appendix figures & tables31 assets
Supplementary material from the paper’s appendix.
Appendix
| Stage | Total | ASCEND | SwitchLingua |
| Source records sampled | 3,500 | 382 | 3,118 |
| Retained source records | 3,009 | 287 | 2,722 |
| Validated Seeds retained for benchmark construction | 596 | 109 | 487 |
| Final evaluation prompts | 807 | 146 | 661 |
| Focused | 407 | 76 | 331 |
| Extended | 400 | 70 | 330 |
| Coverage item | Focused ( ) | Extended ( ) | Cross-task |
| Scene domains | 13/14 | 14/14 | Largest gap 5.0 pp |
| Participant relations | 6/9 | 8/9 | Largest gap 4.8 pp |
| Interaction patterns | 11/11 | 11/11 | All retained |
| Preferred styles | 5/5 | 5/5 | All baseline styles retained |
| Unique source groups | 350 | 340 | 88 / 93 prompts repeat a group |
| Stable scene/relation/style | 12 / 5 / 5 | 14 / 8 / 5 | two source groups |
| Candidate concept families | Preliminary construct | Count | Final role |
| Repertoire, access, represented resources | Participant–world resource grounding | 9 | D1 Licensing |
| Voice, recipient, sequence, situation and local fit | Situated interactional coherence | 22 | D2 Contextual Appropriateness |
| Contrastive meaning, stance, relationship, style and experience | Functional multilingual contribution | 19 | D3 Functional Gain |
| Recurrence, contrast, development and literary integration | Whole-text multilingual orchestration | 4 | Extended Whole-text; Focused uses general literary/narrative quality |
| Textual warrant, mediation and inferential boundaries | Evidentially constrained literary mediation | 9 | Cross-cutting evidence constraint, not a fifth quality score |
| Eventfulness, consequence and narrative importance | Narrative event importance | 7 | Salience S1–S3 for D2/D3 weighting, not quality |
| Item | 1 | 3 | 4 | 5 |
| D2.1 Voice attribution | Wrong or indeterminate voice | Dialogue, thought, or narration clearly attributed | Distinguishes potentially confusable layered voices or quotation responsibility | Attribution remains precise across layered voices or quotation boundaries |
| D2.2 Carrier fit | Expression incompatible with its carrier | Natural fit to speech, thought, narration, message, or reuse | Carrier and expression are specifically matched in form and use | Wording and form are precisely matched to the carrier and its constraints |
| D2.3 Addressee trigger | Known addressee conditions conflict with the choice | Recipient’s ability, identity, or response motivates it | Precisely responds to recipient’s resources, wording, identity, or immediate uptake | The realization precisely fits the recipient’s resources, wording, identity, and immediate interactional state |
| D2.4 Topic trigger | Unrelated to current concept, object, or material | Topic directly supports English | Conceptual boundaries, source wording, or reference shape the local interpretation | Wording and placement are tightly grounded in the current concept, source wording, referent, or topic structure |
| D2.5 Emotion trigger | Applicable emotional mechanism cannot be located | Switch accompanies emotional change | Occurs at a specific emotional threshold, defensive move, or intimacy shift | Wording and placement precisely align with the established emotional state or transition |
| D2.6 Power, stance, identity | Applicable negotiation mechanism cannot be located | Clearly marks stance or identity | Changes the interaction at an assertion, concession, boundary-setting, alliance, or repositioning move | Wording and form precisely fit the current stance, power, or identity configuration |
| Item | 1 | 3 | 4 | 5 |
| D3.1 Semantic precision | No added distinction, source reference, ambiguity control, or precision | Recognizable terminological/conceptual precision | Specific meaning, original wording, ambiguity, or wordplay affects understanding | The semantic contribution is exceptionally precise and tightly integrated into the event’s local meaning |
| D3.2 Relationship/stance gain | Language choice adds no relational or attitudinal signal | Clear relational or attitudinal signal carried by the language choice | Substantially strengthens a relational act or subtext | Carries a highly specific and strongly realized relational or attitudinal function within the interaction |
| D3.3 Identity/cultural specificity | Merely labels an identity | Adds a plausible, specific identity connection | Closely connects experience and current self-positioning | Makes an exceptionally specific and well-supported contribution to identity or cultural positioning |
| D3.4 Stylistic tension | Only typographic novelty or display | Clear local voice, rhythm, double-voicing, or restraint | Works with syntax, rhythm, imagery, or subtext to organize the passage | Is tightly integrated with local form to produce a highly realized stylistic effect |
| D3.5 Experiential texture | Merely labels a background | Connects to lived experience and adds texture | Interacts closely with action, medium, institution, body, or memory | Makes the represented experience exceptionally specific, credible, and texturally realized within the event |
| Dimension | 1 | 3 | 4 | 5 |
| L1 Completeness/coherence | Main line, causality, or ending not intelligible | Complete story with adequate causality and ending | Opening pressure, change, decisions, and ending form a sustained causal chain | Several indispensable nodes form a causal system |
| L2 Voice, relationships, characterization | Indistinct characters, unsupported motives, or announced change | Distinct stances, credible motives, relationship advanced through interaction | Voice, action, and subtext differentiate characters over stages | Layered motives, avoidance, behavior, and decisions form a complex coherent system |
| L3 Style, rhythm, imagery | Reading obstructed or basic unity absent | Fluent narration with local rhythmic/imagistic organization | A formal mechanism persists across locations | Voice, rhythm, imagery, and perspective form a distinctive system |
| L4 Emotional/thematic depth | Implausible emotion or abstract conclusions replace narration | Plot, action, and dialogue support emotion/theme | Two mutually constraining values develop persistently | Layered conflicts revise each other and sustain interpretive tension |
| L5 Originality/nonformulaic realization | Predominantly generic template | Some effective choices within a familiar whole | Mutually supporting non-obvious choices on at least two levels | Distinctive unified narrative principle constrained by earlier development |
| ID | Dimension | Evidence |
| M-F1 | Multilingual narrative-system stability | Voice ownership; speech/thought/quotation boundaries; carriers; focalization; preservation/translation policy; language facts and rules maintained or coherently developed across scenes. |
| M-F2A | Character A bilingual profile and language arc | Repertoire, function/relationship/affect mappings, scene responsiveness, motivated transitions and non-switching; the same multilingual person developing on textual evidence. |
| M-F2B | Character B bilingual profile and language arc | The same checks independently for B, without requiring symmetry or rewarding event count alone. |
| M-F3.1 | Structure, causality, pacing, and closure | Scene progression, causal continuity, escalation, turning points, proportional pacing, and an ending reflecting actions and consequences. |
| M-F3.2 | Character and relationship development | Goals, knowledge, emotions, actions, and transitions supporting character development; relationship change earned through prior interaction. |
| M-F3.3 | Scene, dialogue, prose, and emotional execution | Scene realization, distinct dialogue, clarity/control, sensory and atmospheric specificity, credible emotion, and engagement without ornament as a proxy. |
| Model | M-F1 | M-F2A | M-F2B | M-F3.1 | M-F3.2 | M-F3.3 | M-F3.4 |
| GPT-5.6-Sol | 4.737 | 4.902 | 4.679 | 4.819 | 4.886 | 4.391 | 4.851 |
| GPT-5.6-Terra | 4.330 | 4.584 | 4.514 | 4.544 | 4.684 | 4.348 | 4.455 |
| GPT-5.5 | 4.510 | 4.777 | 4.621 | 4.595 | 4.786 | 4.315 | 4.691 |
| Gemini-3.5-Flash | 3.953 | 4.201 | 4.058 | 4.055 | 4.110 | 3.954 | 3.893 |
| Qwen3.7-Plus | 3.751 | 4.074 | 3.915 | 3.809 | 3.876 | 3.595 | 3.636 |
| Qwen3.7-Max | 3.896 | 4.091 | 4.018 | 3.834 | 3.894 | 3.697 | 3.808 |
| Task / comparison | Mean | Max | |
| Focused: GPT vs. Dual | 1.000 | 0.000 | 0 |
| Focused: DeepSeek vs. Dual | 0.993 | 0.167 | 1 |
| Focused: GPT vs. DeepSeek | 0.993 | 0.167 | 1 |
| Extended: GPT vs. Dual | 0.986 | 0.333 | 1 |
| Extended: DeepSeek vs. Dual | 1.000 | 0.000 | 0 |
| Extended: GPT vs. DeepSeek | 0.986 | 0.333 | 1 |
| Prompt constructor | GPT annotator | Qwen annotator |
| GPT | F .951 E .965 | F .888 E .979 |
| Qwen | F .958 E .916 | F .937 E .972 |
| D2 | D3 | ||||
| Quantity | Sol DS | DS Sol | Quantity | Sol DS | DS Sol |
| Whole | 0.269 | 0.239 | Whole | 0.274 | 0.237 |
| M-F1 | 0.221 | 0.214 | M-F1 | 0.212 | 0.199 |
| M-F2A | 0.222 | 0.155 | M-F2A | 0.235 | 0.157 |
| M-F2B | 0.185 | 0.184 | M-F2B | 0.183 | 0.184 |
| M-F3.1 | 0.195 | 0.151 | M-F3.1 | 0.193 | 0.147 |
| Setting | Ref. | Grouping F1 [95% CI] | Boundary F1 | Exact |
| Focused | A1 | .919 [.820, 1.000] | .980 | .875 |
| Focused | A2 | .968 [.917, 1.000] | .990 | .917 |
| Extended | A1 | .998 [.994, 1.000] | .988 | .958 |
| Extended | A2 | .999 [.997, 1.000] | .990 | .917 |
| Annotation class | Factual acc. | Temporal acc. |
| Character profile | 98.93% | 96.98% |
| Character state | 97.77% | 99.44% |
| Narrative arc | 99.50% | 99.61% |
| Relationship state | 96.59% | 99.24% |
| World state | 99.19% | 99.18% |
| Setting | Evaluator | Self | Non-self | Self residual | Non-self residual | Self non-self [95% CI] |
| Focused | GPT-5.6-Sol | 15 | 165 | 0.548 | 0.193 | 0.355 [0.100, 0.595] |
| Focused | DeepSeek-V4-Flash | 15 | 165 | 0.351 | 0.238 | 0.112 [ 0.409, 0.248] |
| Extended | GPT-5.6-Sol | 12 | 132 | 1.236 | 1.337 | 0.101 [ 1.370, 1.482] |
| Extended | DeepSeek-V4-Flash | 12 | 132 | 0.632 | 1.096 | 0.463 [ 1.333, 0.524] |
| Contrast | Estimate | 95% CI |
| Exact self other family | 0.450 | [0.170, 0.682] |
| Same family other family | 0.522 | [0.378, 0.667] |
| Exact self same family | 0.072 | [ 0.345, 0.161] |
| Setting | Aggregation | Max | Top model | |
| Focused | Drop D1 | 1.000 | 0 | GPT-5.5 |
| Focused | D1 half weight | 1.000 | 0 | GPT-5.5 |
| Focused | Rank average | 1.000 | 0.5 | GPT-5.5 |
| Extended | Drop D1 | 1.000 | 0 | GPT-5.6-Sol |
| Extended | D1 half weight | 1.000 | 0 | GPT-5.6-Sol |
| Extended | Rank average | .977 | 1.5 | GPT-5.6-Sol |
| Setting | D1 | D2 | D3 | Whole |
| Focused | .061 | .282 | .380 | 1.190 |
| Extended | .487 | .942 | 1.120 | 1.775 |
| § | Quantity | Estimate | Original 95% CI | Seed-clustered 95% CI |
| 5.3 | Focused salience–D2 | 0.642 | 0.625, 0.658 | 0.635, 0.650 |
| 5.3 | Focused salience–D3 | 0.496 | 0.475, 0.517 | 0.484, 0.508 |
| 5.3 | Extended salience–D2 | 0.768 | 0.756, 0.779 | 0.763, 0.773 |
| 5.3 | Extended salience–D3 | 0.789 | 0.778, 0.799 | 0.785, 0.793 |
| 5.4 | D2–M-F1 | 0.217 | 0.190, 0.244 | 0.186, 0.255 |
| 5.4 | D2–M-F2A | 0.188 | 0.161, 0.215 | 0.120, 0.255 |
| Model | Focused /20 | Extended /20 |
| GPT-5.6-Sol | 15.501 [15.476, 15.527] | 17.767 [17.710, 17.823] |
| GPT-5.6-Terra | 15.410 [15.382, 15.438] | 17.352 [17.271, 17.433] |
| GPT-5.5 | 15.537 [15.513, 15.561] | 17.348 [17.283, 17.410] |
| Gemini-3.5-Flash | 14.893 [14.862, 14.925] | 16.471 [16.385, 16.552] |
| Qwen3.7-Plus | 14.376 [14.339, 14.413] | 16.065 [15.969, 16.160] |
| Qwen3.7-Max | 14.540 [14.504, 14.576] | 16.220 [16.139, 16.298] |
| Model | Events/article | Median | CS density /1k | CS span (%) | (/20) |
| Extended Narrative | |||||
| GPT-5.6-Sol | 20.36 | 20 | 4.78 | 9.1 | 17.767 |
| GPT-5.6-Terra | 11.39 | 11 | 2.94 | 5.5 | 17.352 |
| GPT-5.5 | 20.52 | 20 | 4.51 | 6.6 | 17.348 |
| DeepSeek-V4-Flash | 17.32 | 17 | 4.54 | 11.2 | 16.962 |
| DeepSeek-V4-Pro | 20.25 | 21 | 4.16 | 9.0 | 16.567 |
| Dimension / split | Hard | Easy | Easy hard | Standardized gap | 95% CI |
| M-F1 | 3.645 | 3.943 | 0.2983 | 1.182 | 0.229, 0.368 |
| M-F2A | 4.159 | 4.268 | 0.1092 | 0.601 | 0.057, 0.162 |
| M-F2B | 3.812 | 4.245 | 0.4333 | 1.216 | 0.330, 0.536 |
| M-F3.1 | 3.937 | 4.039 | 0.1025 | 0.546 | 0.051, 0.154 |
| M-F3.2 | 4.112 | 4.178 | 0.0667 | 0.427 | 0.022, 0.112 |
| M-F3.3 | 3.753 | 3.848 | 0.0942 | 0.591 | 0.050, 0.139 |
| Measure | Basis | D2 | D3 | Whole | |
| Extended Narrative | |||||
| Events | pooled | -.026 | +.014 | +.163 | +.032 |
| Events | within | -.105 | -.123 | +.030 | -.076 |
| Density | pooled | -.149 | -.145 | -.063 | -.123 |
| Density | within | -.049 | -.077 | +.026 | -.027 |
| Focused Narrative | |||||
| Setting | Model pair | 95% CI | Holm | |
| Focused | GPT-5.6-Sol – GPT-5.5 | .0536 | ||
| Focused | Qwen3.7-Plus – Qwen3.5-397B-A17B | .4648 | ||
| Focused | MiniMax-M2.5 – MiniMax-M2.7 | .0504 | ||
| Extended | GPT-5.6-Terra – GPT-5.5 | .9064 | ||
| Extended | Gemini-3.5-Flash – DeepSeek-V4-Pro | .2368 |
| Setting | Comparison | Articles A / B | 95% CI | Max | |
| Focused | ASCEND vs. SwitchLingua | 912 / 3,972 | .993 | [.979, 1.000] | 1 |
| Focused | Shared vs. task-specific Seeds | 3,132 / 1,752 | .993 | [.979, 1.000] | 1 |
| Extended | ASCEND vs. SwitchLingua | 840 / 3,960 | .986 | [.944, 1.000] | 1 |
| Extended | Shared vs. task-specific Seeds | 3,132 / 1,668 | .986 | [.979, 1.000] | 1 |
| Setting | Clusters | Widest rank | ||
| (Seed/group) | interval | |||
| Focused | 407 / 350 | 1 / 1 | .986 / .987 | 1.000 / 1.000 |
| Extended | 400 / 340 | 1 / 1 | 1.000 / 1.000 | 1.000 / 1.000 |
Code-Switching
Code-switching studies how people combine languages in speech and text and how AI systems can recognize, understand, and generate these mixtures.
See all 22 papers