False Friends in Shell: Revealing Emoji Semantic Confusion in Large Language ModelsFalse Friends in the Shell: Unveiling the Emoticon Semantic Confusion in Large Language Models
The authors report an average CR of 38.6% across six LLMs on 3,757 tests.
- ASCII emojis overlap with code symbols. The authors point out that users bring emojis into programming assistant conversations, and models may treat tone symbols as executable instructions, leading to actions that deviate from intent in code generation and agent execution.
- The authors use a two-module pipeline to filter real emoticons that overlap with code symbols, then Claude-Sonnet-4.5 generates dialogues with trailing placeholders, GPT-5.1 verifies them, and they are injected by overlap score, yielding 3,757 test cases across 21 meta-scenarios, 4 languages, and 3 context levels.
- The average CR across the six models is 38.6%. In Level 2, High Harm accounts for 52.0%. On GPT-4.1-mini, after migrating 105 already-confused prompts to LangChain and CAMEL, 76.2% and 67.6% still trigger. On the 210-item subset, prompting methods do not consistently reduce CR across the six models.
- The Limitation states the dataset cannot cover all interaction boundaries, and the six-model results may not generalize to all LLMs. The Discussion plans to extend to non-code scenarios, study malicious exploitation, and developer-side confirmation. Experiments cover six models, 3,757 cases, two agent frameworks, and a 210-prompt subset.
- Evaluated models
- Claude-Haiku-4.5Gemini-2.5-FlashGPT-4.1-miniDeepSeek-v3.2Qwen3-CoderGLM-4.6
- Benchmarks
- 自建代码向测试集(3,757条,21个元场景)LangChainCAMEL
- Metrics
- Confusion Ratio (CR)Confusion Impact Ratio (CIR)
The researchers discovered an emoji semantic confusion vulnerability in large language models, where models misread ASCII emojis and execute unintended or even destructive operations. They built a dataset of 3757 code-oriented test cases covering 21 meta-scenarios, four programming languages, and varying context complexity. Tests on six large language models show the problem is widespread, with an average confusion rate exceeding 38%; over 90% of confused responses are silent failures, i.e., syntactically valid but deviating from user intent. The study also found the vulnerability transfers to popular agent frameworks, and existing prompt-based mitigation measures are largely ineffective.
Paper analysis
What problem does this paper attempt to solve?
The authors define emoticon semantic confusion: LLMs treat ASCII emoticons as executable code or commands.
LLMs may interpret ASCII emoticons used by users to convey tone as executable code or commands.
- Occurrence scenario: The authors state that emoticons are used to convey emotion, and users may bring this habit into programming assistants; 14 of 60 participants (23.3%) in Appendix A.1 used them in programming tasks. The authors believe intent deviation may affect interaction efficiency and may relate to system security.
- Existing gaps: The authors state that existing robustness research mainly examines Unicode emoji or meaningless character perturbations for jailbreaking or sentiment manipulation. The authors state that, to their knowledge, no work has systematically studied the syntactic ambiguity of ASCII emoticons in code generation and its security implications.
- Core observation: ASCII emoticons share characters with operators, shell wildcards, and file paths. The authors use "false friend" to describe when the same symbol has different meanings in natural language and programming languages, and models may treat tone markers as operation targets.
- This paper's approach: The authors define emoticon semantic confusion, use an automated pipeline to construct 3,757 code-oriented test cases across 21 meta-scenarios, and measure its prevalence, consequences, and user-side prompt mitigation on six LLMs.
What related research exists?
The authors distinguish this paper from Unicode emoji jailbreak research and state that no prior work has systematically studied ASCII emoticon confusion in code scenarios.
In the introduction and Related Work, the paper groups related work into three categories, and only for Unicode emoji red-teaming work does it state the difference from this paper.
Nonverbal cues
- Emotion and popularity: Evans (2017), Boutet et al. (2021) discuss emoji and emoticons conveying emotion, tone, and irony; Tauch and Kanjo (2016), Ai et al. (2017) discuss their role in notifications and popularity. The paper does not make methodological comparisons with these works.
- Technical communities: Kwon et al. (2019), Kralj Novak et al. (2015) study emoticon or kaomoji representation; Lu et al. (2018), Rong et al. (2022) report emoji use in GitHub and software development communication. The paper treats these as usage background.
LLM robustness testing
- Adversarial and red-teaming: The authors classify Jiang et al. (2025), Xiao et al. (2025), He et al. (2025), Ge et al. (2024)'s MART, and Zou et al. (2023) as studies finding that dialogue systems produce harmful content under adversarial instructions. The paper does not point out shortcomings of these methods one by one.
Nonverbal cues for red-teaming
- Unicode emoji perturbation: Wei et al. (2025), Zheng et al. (2025), Ma et al. (2024) use emoji as perturbations to bypass safety filters or manipulate sentiment classification. The authors state these works mainly use Unicode emoji for malicious jailbreaks or adversarial attacks, whereas this paper studies ASCII emoticons being treated as functional code or commands in benign use.
Baseline methods and benchmarks
- Comparison settings: Direct questioning (Base), Zero-shot CoT (Kojima et al., 2022), ReAct (Yao et al., 2022), and the authors' designed System Instruction. Evaluation uses the self-built 3,757 test cases; prompt comparisons use a 210-case subset (Table 1). Appendix A.4.5 also lists Self-refine (Madaan et al., 2023), whose results are not reported in Table 1.
The authors position this paper as a study of semantic misalignment of ASCII emoticons in code scenarios and state this is the first large-scale empirical study of this phenomenon.
How does the paper address this problem?
A two-module pipeline filters real emoticons that overlap with code, generates and injects prompts, and builds 3,757 test cases.
The authors use a data generation pipeline to automatically construct code-oriented dialogues, then determine confusion by whether the output is functionally equivalent to the reference answer. The pipeline includes two modules: emoticon collection and prompt generation (Figure 2).
Problem formulation
- What confusion means: The model interprets ASCII emoticons as executable instructions, producing operations inconsistent with user intent. The authors contrast Unicode emoji: the latter has independent encodings, while the former consists of standard characters and punctuation.
- Why start from code: The authors give two reasons: code symbols overlap heavily with emoticons; programming LLMs and agents can often execute commands and modify file systems, so misreading may cause data loss or system failure.
- Sample form: Instances are D=(H, xn, y). H is prior dialogue, xn is the last-turn query, y is the expected reference response. The injected query is denoted x′n = xn[ϕ → e], replacing only the trailing placeholder, with y unchanged.
Emoticon collection
- Two criteria: Prevalence requires candidates from real usage, not artificial patterns; Overlap requires sharing symbols or structures with programming languages.
- Filtering: Initialized with Ekohrt (2022)'s approximately 62,000 public emoticons, filtered by symbol constraints for Bash/Shell, Python, SQL, and JavaScript, then overlap score computed via structural pattern matching. This module retains 20,522 candidates.
- Spot check: Two experts with AI and software engineering backgrounds spot-check 1,000 candidates, with guidelines being real emoticons verifiable in online communities and morphologically indistinguishable from valid code syntax in at least one target language. The authors state both experts considered all spot-checked samples to meet the guidelines.
Prompt generation
- Stage 1: 21 meta-scenarios are manually designed, covering file and directory operations, database modifications, system administration, and code editing, instantiated across four languages (Table 2). Claude-Sonnet-4.5 generates dialogues with placeholders at the end of queries, also outputting symbol constraints Rsym. The appendix also writes Claude-4.5-Sonnet.
- Three context levels: Single Turn is n=1 with no history; Multi Turn Without Prior has history semantically unrelated to the symbols denoted by Rsym; Multi Turn With Prior has history objects or states semantically coupled with these symbols.
- Verification and injection: GPT-5.1 checks whether history, query, and expected output are logically consistent. The appendix states 315 templates are generated first (21×5×3), retaining 263. Stage 2 samples by overlap score weighting, with at most K=10 emoticons per instance. The appendix gives generation and verification prompts.
Confusion determination
- Whether confused: Commands or code are extracted via regex, then functional equivalence is judged against the reference answer G. Only functional non-equivalence counts as confusion. Syntax checking, refusal detection, and exact matching implementations are in Appendix A.3.2.
- Severity: Level 1 is non-executable failure detectable by syntax checking; Level 2 is what the authors call silent failure, i.e., syntactically valid but semantically wrong. Consequence analysis further divides Level 2 into High Harm and Low Harm, judged by Gemini-3-Flash.
What experiments did the paper conduct?
The average CR across all six models is 38.6%; the authors state that prompting methods cannot consistently reduce CR across all models.
Experimental Setup
- Models tested: Claude-Haiku-4.5, Gemini-2.5-Flash, GPT-4.1-mini, DeepSeek-v3.2, Qwen3-Coder, GLM-4.6. Appendix A.3.1 states that official or SiliconFlow APIs were used with default parameters; Qwen3-Coder corresponds to Qwen3-Coder-480B-A35B-Instruct in the appendix.
- Data and repetition: 3,757 test cases, 21 meta-scenarios, Bash/Shell, Python, SQL, JavaScript, three context levels. Each prompt was queried 5 times per model, 18,785 per model, totaling 112,710.
- Metrics: CR is the proportion of responses functionally non-equivalent to the reference answer. CIR splits confusion into Level 1 and Level 2. The authors state that they resampled with replacement to 1,000 and used t-tests etc.; no p-values are given in the main text.
- Evaluation: Gemini-3-Flash judged functional equivalence and whether Level 2 was High Harm or Low Harm relative to the reference answer. Appendix A.3.3 manually verified 100 cases, with Cohen's Kappa of 0.94.
- Agents: LangChain used default system instructions, CAMEL used its code task template, both with GPT-4.1-mini as the backbone. 5 cases per scenario, 105 total, and these prompts are known to trigger confusion on that backbone.
- Mitigation subset: 10 cases per scenario, 210 total, comparing Base, Zero-shot CoT, ReAct, System Instruction (Table 1).
Main Results
The abstract states the average confusion proportion exceeds 38%, the introduction states over 38.6%, and §4.2 states the average CR is 38.6%. The main text only names full CR for three models. Figure 3 also marks 40.2%, 38.7%, 38.1%, but the converted text cannot be matched to models, so it is written as not reported. Figure 3's caption says Confusion Rate, while the main text metric is Confusion Ratio.
Model Full CR Source Claude-Haiku-4.5 34.2% §4.2, Figure 3 Qwen3-Coder 36.5% §4.2 GLM-4.6 43.8% §4.2, Figure 3 GPT-4.1-mini Not reported Not given per model in main text Gemini-2.5-Flash Not reported Not given per model in main text DeepSeek-v3.2 Not reported Not given per model in main text - Authors' interpretation: The authors state that all six models exhibit confusion. They observe that Claude-Haiku-4.5 and Qwen3-Coder more often confirm with the user first, and claim this relates to their lower CR; GLM-4.6 has a CR of 43.8%.
- Refusals: 486 refusals in total, accounting for 0.4%. The appendix states that Claude-Haiku-4.5 accounts for 389 (80.0%), and the other five models together account for less than 20%.
- Annotation composition: Appendix Figure 6 states 68,750 (61.0%) are correct; executable misinterpretations account for 35.0% of all responses, of which High Harm 20,552 (18.2%), Low Harm 18,984 (16.8%); illegal syntax 3,938 (3.5%).
Scenarios, Context, and Transfer
- Scenario proportions: Figure 8 shows the proportion of confusion cases across 21 scenarios, not scenario-level CR. The authors state that file deletion and cleanup are highest across all six models, ranging from GLM's 14.8% to Claude's 18.6%; the appendix states the average for this scenario is 16.9%. Multi-line command blocks are 13.2%–16.4%. The authors believe high-risk, syntactically complex scenarios are more prone to confusion.
- Context: The authors give ranges: single-turn 43.2%–49.1%, multi-turn without prior 27.1%–31.6%, multi-turn with prior 22.4%–26.2% (Figure 4, §4.2). The authors believe richer context reduces confusion; in single-turn, lacking task context, models rely more on pretraining priors to treat symbols as syntax.
- Agents: After transferring these 105 prompts to LangChain, 76.2% (80/105) still trigger errors or unsafe behavior, and 67.6% (71/105) after CAMEL. The authors state that reasoning, planning, and tool use in the frameworks do not correct the underlying misinterpretation.
Consequences and Prompt Mitigation
- Level 2: The abstract states that over 90% of confused responses are silent failures. §4.3 states that five of the six models have Level 2 above 91.0%, with Claude above 95.0%. Figure 5 labels Level 2 as 90.7%, 95.5%, 92.4%, 86.8%, 88.1%, 92.2%, and Level 1 as 9.3%, 4.5%, 7.6%, 13.2%, 11.9%, 7.8%; the converted text does not map to models, and three Level 2 values are below 91.0%, not fully consistent with the §4.3 summary.
- High Harm: The authors state that 52.0% of Level 2 are High Harm (appendix: 20,552/39,536), meaning they introduce additional risk relative to user intent; the rest are Low Harm. The authors state that High Harm outputs are syntactically valid and executable, and conventional static analysis struggles to detect them.
- Prompt methods: Table 1 comes from a 210-case subset and cannot be directly compared with full CR. The authors state that System Instruction shows the largest reduction on GPT, Gemini, DeepSeek, and Qwen, with CRs of 38.6%, 35.2%, 39.8%, 40.7% respectively. The same method on GLM is 52.6%, higher than the subset's Base of 49.0%. On Claude, Base is 40.1%, and CoT, ReAct, System are 43.2%, 42.4%, 42.5% respectively, all higher. The authors state that no prompt strategy consistently reduces CR across all six models, and believe confusion may stem from representation and symbol grounding, with surface prompts having only weak influence.
Other Ablations and Analyses
- Appendix A.4.1: S12 dynamic code execution confusion cases account for 0.3%–0.8%; S16 configuration comments 0.6%–1.8%; S18 container lifecycle is 0.0% on DeepSeek, 0.1% on Qwen3-Coder, and 3.3% on Gemini-2.5-Flash.
- Appendix A.4.4 uses single-turn, multi-turn with prior, and multi-turn without prior cases to illustrate that emoji strings are written into command arguments; the appendix provides examples.
- The paper does not report t-test p-values, nor the number of queries for each prompt method; Appendix A.3.4 states the total API cost for all experiments is about $500.
- Appendix A.4.5 lists Self-refine, but Table 1 does not report its CR.
What are some points that can be further explored?
The authors state that the dataset cannot cover all interactions, the six-model results may not generalize, and list future directions.
Limitations and future directions noted by the authors
- Dataset: The Limitation states that despite 21 meta-scenarios and three complexity levels, the variability of real interactions means the dataset cannot cover every edge case of emoji usage or interaction context. The authors state they have open-sourced the pipeline for others to extend scenarios and emojis.
- Models: The Limitation states that six LLMs from major providers were evaluated, but models change quickly, and results may not generalize to all available models. The authors state they have open-sourced the dataset and encourage using it to evaluate more LLMs and agents.
- Evaluation framework: The Discussion states that this dataset mainly focuses on programming scenarios, and risks may extend beyond code. Future work could build broader benchmarks and automated testing frameworks, for example based on metamorphic testing, covering more agents, low-resource programming languages, and multiple natural languages.
- Attacks and red teaming: The Discussion lists malicious exploitation as future work, including combining with existing prompt injection or red teaming methods, and how to better defend. The paper does not give specific attack methods in that section.
- Developer-side mitigation: The Discussion states that user-side prompts only give marginal improvements. Future work could study decoupled technique embeddings and sentiment embeddings, or implement proactive confirmation; the authors believe detecting potential ambiguity and requesting user confirmation could be a mitigation mechanism in production environments.
Experimental coverage
- The tested models are Claude-Haiku-4.5, Gemini-2.5-Flash, GPT-4.1-mini, DeepSeek-v3.2, Qwen3-Coder, and GLM-4.6, totaling 6; each prompt is queried 5 times per model (§4.1).
- The test set is 3,757 items, 21 meta-scenarios, 4 programming languages, and 3 context levels (§3).
- Agent experiments use LangChain and CAMEL, with GPT-4.1-mini as the backbone, 105 prompts, and these prompts are known to trigger confusion on that backbone (§4.2).
- Prompt comparisons are on a 210-item subset comparing Base, Zero-shot CoT, ReAct, and System Instruction (Table 1). Functional equivalence and harm classification use Gemini-3-Flash; there is also 100-item human agreement with Cohen's Kappa of 0.94 (Appendix A.3.3).
- The paper states bootstrap to 1,000 and gives a t-test example, but does not report p-values; it also does not report the number of queries for each prompting method (§4.1, Appendix A.4.5).
Summarize the main content of the paper
The authors report that six LLMs may mistake ASCII emoticons for code, with an average CR of 38.6%, and prompt mitigation is inconsistent.
The authors measure emoji semantic confusion across six LLMs: when ASCII emojis overlap with code symbols, models may treat tone markers as executable objects.
- Problem: In programming assistant conversations, users use emojis to soften tone, but the model may interpret the same character as a path, wildcard, or operand. The authors state this creates safety risks in autonomous execution, usability degradation from repeated corrections, and an attack surface for hiding malicious payloads in emotional cues.
- Method: From about 62,000 real emojis, candidates overlapping with four languages are filtered, Claude-Sonnet-4.5 generates conversations ending with placeholders, GPT-5.1 verifies, and injection is done by overlap score, yielding 3,757 tests. Confusion is defined as output functionally non-equivalent to the reference answer.
- Key numbers: The average CR across the six models is 38.6%. Among the full-response CRs named in the main text, Claude-Haiku-4.5 is 34.2%, Qwen3-Coder is 36.5%, and GLM-4.6 is 43.8%. The authors give context intervals of 43.2%–49.1% for single-turn and 22.4%–26.2% for multi-turn with prior. In Level 2, High Harm accounts for 52.0%. With GPT-4.1-mini as the backbone, 105 known-confusion prompts still trigger at 76.2% and 67.6% on LangChain and CAMEL.
- Mitigation and conclusion: On the 210-item subset, no prompting method consistently reduces CR across the six models; on GLM, System Instruction is 52.6%, higher than the subset's Base of 49.0%. The abstract states that over 90% of confused responses are silent failures, §4.3 states that Level 2 exceeds 91.0% for five models and exceeds 95.0% for Claude, but Figure 5 has three Level 2 numbers below 91.0% that do not reliably correspond to models. The authors call on the community to take the problem seriously and develop effective mitigations.