LLM Security and Safety: Insights from Homotopy-Inspired Prompt Obfuscation
Abstract
1. Introduction
1.1. Related Work on Jailbreaking LLMs and Code Generation
1.2. Code Generation Methods Using LLM
1.2.1. Frameworks for Code Generation
1.2.2. Homotopy Theory as a Jailbreak Technique
1.2.3. Homotopy Deformation in LLMs
1.3. Research Motivation
1.4. Research Challenges
- RQ1: Can homotopy theory be used as a heuristic framework to apply linguistic deformations for obfuscating malicious prompts in order to jailbreak LLMs?
- RQ2: How effective is this approach for generating malware using LLMs?
- RQ3: What are the implications of homotopy-inspired jailbreak techniques for improving LLM security, safety alignment, and the design of robust defensive measures?
1.5. Research Contributions
- 1.
- We propose a novel framework leveraging the topological structure of language, employing homotopy-inspired deformations as a heuristic to obfuscate malicious prompts. This approach enables controlled jailbreak of LLMs to generate malware code for cybersecurity research.
- 2.
- We release a comprehensive malware dataset comprising 7374 specimens, validated for C++ and Python environments, designed for benchmarking and evaluation purposes. The repository link is provided below and will become publicly accessible on 23 December 2025: https://github.com/Eduardolasso/Cybersecurity.
- 3.
- We introduce a robust and reproducible methodology for LLM jailbreak and malware elicitation, ensuring methodological rigor while adhering to ethical and regulatory safeguards.
- 4.
- We delineate future research directions and practical applications of the generated dataset, alongside a critical evaluation of the efficacy, limitations, and security implications of the proposed homotopy-inspired jailbreak technique.
2. Research Methodology
2.1. LLM Configuration
2.2. Step 1—Data and Source Prompts
2.3. Step 2 Jailbreak/Prompts
2.3.1. Homotopy-Inspired Prompt
2.3.2. Homeomorphic Prompt Deformation
2.4. Step 3: LLM Code Generation
2.5. Step 4: Verification
2.5.1. LLM-Based Verification Procedure and Dataset Integrity
2.5.2. Verification Criteria and Artifact Categorization
2.6. Step 5: Reporting
3. Settings and Setups
4. Results
Evaluation Metrics
5. Future Work and Limitations
Mitigation Strategies and Defensive Implications
6. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Guo, J.; Fan, Y.; Pang, L.; Yang, L.; Ai, Q.; Zamani, H.; Wu, C.; Croft, W.B.; Cheng, X. A Deep Look into neural ranking models for information retrieval. Inf. Process. Manag. 2020, 57, 102067. [Google Scholar] [CrossRef]
- Nelson, E.S. Language, Nature, and the Self: The Feeling of Life in Kant and Dilthey. In The Linguistic Dimension of Kant’s Thought: Historical and Critical Essays; Schalow, F., Velkley, R.L., Eds.; Northwestern University Press: Evanston, IL, USA, 2014; pp. 263–287. [Google Scholar]
- Chowdhary, K.R. Natural language processing. In Fundamentals of Artificial Intelligence; Springer: New Delhi, India, 2020; pp. 603–649. [Google Scholar]
- McShane, M.; Nirenburg, S. Linguistics for the Age of AI; MIT Press: Cambridge, MA, USA, 2021. [Google Scholar]
- Kamath, U.; Keenan, K.; Somers, G.; Sorenson, S. Large Language Models: A Deep Dive; Springer: Cham, Switzerland, 2024. [Google Scholar]
- López García, A. Introduction to Topological Linguistics; Annexa: Washington, DC, USA, 1990. [Google Scholar]
- López-García, A. Topological linguistics and the study of linguistic variation. In Current Issues in Mathematical Linguistics; Martín-Vide, C., Ed.; North-Holland Linguistic Series: Linguistic Variations; Elsevier: Amsterdam, The Netherlands, 1994; Volume 56, pp. 69–77. [Google Scholar]
- Guénard, F.; Lelièvre, G.; Bidón-Chanal, C. Thinking Mathematics: Seminar on Philosophy and Mathematics at the École Normale Supérieure in Paris; Tusquets: Barcelona, Spain, 1999. [Google Scholar]
- Van Han, N.; Vinh, P.C. Towards Linguistic Fuzzy Topological Spaces Based on Hedge Algebra. EAI Endorsed Trans. Context Aware Syst. Appl. 2022, 8, e12. [Google Scholar] [CrossRef]
- Seifert, H.; Threlfall, W. Lessons in Topology; Modern Mathematics Text Collection; Jorge Juan Institute of Mathematics: Madrid, Spain, 1951. [Google Scholar]
- Milnor, J.W.; Wallace, A. Differential Topology; American Mathematical Society: Providence, RI, USA, 2007. [Google Scholar]
- Hurst, A.; Lerer, A.; Goucher, A.P.; Perelman, A.; Ramesh, A.; Clark, A.; Ostrow, A.; Welihinda, A.; Hayes, A.; Radford, A.; et al. Gpt-4o system card. arXiv 2024, arXiv:2410.21276. [Google Scholar] [CrossRef]
- Sun, H.; Zhang, Z.; Deng, J.; Cheng, J.; Huang, M. Safety Assessment of Chinese Large Language Models. arXiv 2023, arXiv:2304.10436. [Google Scholar] [CrossRef]
- Shen, X.; Chen, Z.; Backes, M.; Shen, Y.; Zhang, Y. “do anything now”: Characterizing and evaluating in-the-wild jailbreak prompts on large language models. In Proceedings of the 2024 on ACM SIGSAC Conference on Computer and Communications Security, Salt Lake City, UT, USA, 14–18 October 2024; pp. 1671–1685. [Google Scholar]
- Yu, Z.; Liu, X.; Liang, S.; Cameron, Z.; Xiao, C.; Zhang, N. Don’t listen to me: Understanding and exploring jailbreak prompts of large language models. In Proceedings of the 33rd USENIX Security Symposium (USENIX Security 24), Philadelphia, PA, USA, 14–16 August 2024; pp. 4675–4692. [Google Scholar]
- Bandi, D. Jailbreak ChatGPT: Prompt Engineering Masterclass: Unlock ChatGPT Superpowers. Available online: https://www.amazon.ca/Jailbreak-ChatGPT-Engineering-Masterclass-Superpowers/dp/B0D12XNF3G (accessed on 1 February 2026).
- Liu, Y.; Deng, G.; Xu, Z.; Li, Y.; Zheng, Y.; Zhang, Y.; Zhao, L.; Zhang, T.; Wang, K. A hitchhiker’s guide to jailbreaking chatgpt via prompt engineering. In Proceedings of the 4th International Workshop on Software Engineering and AI for Data Quality in Cyber-Physical Systems/Internet of Things, Porto de Galinhas, Brazil, 15 July 2024; pp. 12–21. [Google Scholar]
- Wahréus, J.; Hussain, A.M.; Papadimitratos, P. CySecBench: Generative AI-based CyberSecurity-focused Prompt Dataset for Benchmarking Large Language Models. arXiv 2025, arXiv:2501.01335. [Google Scholar]
- Wang, Z.; Anshumaan, D.; Hooda, A.; Chen, Y.; Jha, S. Functional Homotopy: Smoothing Discrete Optimization via Continuous Parameters for LLM Jailbreak Attacks. arXiv 2024, arXiv:2410.04234. [Google Scholar] [CrossRef]
- Kroening, D.; David, C. Program synthesis: Challenges and opportunities. Philos. Trans. A Math. Phys. Eng. Sci. 2017, 375, 20150403. [Google Scholar]
- Wang, J.; Chen, Y. A review on code generation with llms: Application and evaluation. In Proceedings of the 2023 IEEE International Conference on Medical Artificial Intelligence (MedAI); IEEE: New York, NY, USA, 2023; pp. 284–289. [Google Scholar]
- Zhang, Y.; Li, Y.; Cui, L.; Cai, D.; Liu, L.; Fu, T.; Huang, X.; Zhao, E.; Zhang, Y.; Chen, Y.; et al. Siren’s song in the AI ocean: A survey on hallucination in large language models. arXiv 2023, arXiv:2309.01219. [Google Scholar] [CrossRef]
- Li, Y.; Choi, D.; Chung, J.; Kushman, N.; Schrittwieser, J.; Leblond, R.; Eccles, T.; Keeling, J.; Gimeno, F.; Dal Lago, A.; et al. Competition-level code generation with alphacode. Science 2022, 378, 1092–1097. [Google Scholar] [CrossRef] [PubMed]
- Dong, Y.; Ding, J.; Jiang, X.; Li, G.; Li, Z.; Jin, Z. Codescore: Evaluating code generation by learning code execution. ACM Trans. Softw. Eng. Methodol. 2025, 34, 1–22. [Google Scholar] [CrossRef]
- Huang, D.; Zhang, J.M.; Bu, Q.; Xie, X.; Chen, J.; Cui, H. Bias testing and mitigation in llm-based code generation. ACM Trans. Softw. Eng. Methodol. 2025, 35, 1–31. [Google Scholar] [CrossRef]
- Tokieda, T. Topology in Four Days. In An Introduction to the Geometry and Topology of Fluid Flows; Springer: Dordrecht, The Netherlands, 2001; pp. 35–55. [Google Scholar]
- Dunlavy, D.M.; O’Leary, D.P. Homotopy Optimization Methods for Global Optimization; Technical report; Sandia National Laboratories (SNL): Albuquerque, NM, USA; Livermore, CA, USA, 2005. [Google Scholar]
- Gavrilovich, M. The unreasonable power of the lifting property in elementary mathematics. arXiv 2017, arXiv:1707.06615. [Google Scholar] [CrossRef]
- Team, K.; Du, A.; Gao, B.; Xing, B.; Jiang, C.; Chen, C.; Li, C.; Xiao, C.; Du, C.; Liao, C.; et al. Kimi k1. 5: Scaling reinforcement learning with llms. arXiv 2025, arXiv:2501.12599. [Google Scholar]
- Jelodar, H.; Bai, S.; Hamedi, P.; Mohammadian, H.; Razavi-Far, R.; Ghorbani, A. Large Language Model (LLM) for Software Security: Code Analysis, Malware Analysis, Reverse Engineering. arXiv 2025, arXiv:2504.07137. [Google Scholar] [CrossRef]












| LLM | Representative Configuration Policy |
|---|---|
| CodeLlama-7b-hf | standardized sampling, fixed response length limits |
| Deepseek-r1:7b | standardized sampling, fixed response length limits |
| KIMI-k2-0711 | standardized sampling, expanded context allowance under audit |
| claude-sonnet-4-20250514 | standardized sampling, expanded context allowance under audit |
| Component | LLaMA (Ollama) | DeepSeek (Ollama) |
|---|---|---|
| Access method | Local Ollama server | Local Ollama server |
| Authentication | None required | None required |
| Execution environment | Google Colab VM | Google Colab VM |
| Communication | Local HTTP endpoint | Local HTTP endpoint |
| Python libraries | Langchain_ollama | langchain_ollama, requests |
| Model endpoint | CodeLlama-7b-hf | deepseek-r1:7b |
| Hardware | Colab CPU/GPU | Colab CPU/GPU |
| Component | KIMI | Claude |
|---|---|---|
| Access method | Official API (HTTPS) | Official API (HTTPS) |
| Authentication | MOONSHOT_API_KEY | Anthropic API_KEY |
| Execution environment | Provider cloud | Provider cloud |
| Python libraries | OpenAI | anthropic, requests |
| Model endpoint | kimi-k2-0711-preview | claude-sonnet-4-20250514 |
| Hardware | Cloud-hosted | Cloud-hosted |
| LLM | Malware (TP) | No Malware (FP) | Success Rate | Precision | Error Rate |
|---|---|---|---|---|---|
| Llama | 320 | 180 | 64% | 0.64 | 36% |
| Deepseek | 411 | 89 | 82.2% | 0.822 | 17.8% |
| KIMI | 6643 | 2082 | 76.13% | 0.761 | 23.87% |
| TOTAL | 7374 | 2351 | 75.82% | 0.758 | 24.18% |
| LLM | Malware (TP) | No Malware (FP) | Success Rate | Precision | Error Rate |
|---|---|---|---|---|---|
| Llama | 311 | 189 | 62.2% | 0.622 | 37.8% |
| Deepseek | 403 | 97 | 80.60% | 0.860 | 19.4% |
| KIMI | 6756 | 1969 | 77.43% | 0.7743 | 22.57% |
| TOTAL | 7470 | 2255 | 76.81% | 0.7681 | 23.19% |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Lazo Vera, L.E.; Jelodar, H.; Razavi-Far, R. LLM Security and Safety: Insights from Homotopy-Inspired Prompt Obfuscation. AI 2026, 7, 83. https://doi.org/10.3390/ai7030083
Lazo Vera LE, Jelodar H, Razavi-Far R. LLM Security and Safety: Insights from Homotopy-Inspired Prompt Obfuscation. AI. 2026; 7(3):83. https://doi.org/10.3390/ai7030083
Chicago/Turabian StyleLazo Vera, Luis Eduardo, Hamed Jelodar, and Roozbeh Razavi-Far. 2026. "LLM Security and Safety: Insights from Homotopy-Inspired Prompt Obfuscation" AI 7, no. 3: 83. https://doi.org/10.3390/ai7030083
APA StyleLazo Vera, L. E., Jelodar, H., & Razavi-Far, R. (2026). LLM Security and Safety: Insights from Homotopy-Inspired Prompt Obfuscation. AI, 7(3), 83. https://doi.org/10.3390/ai7030083

