Prompt Optimization Strategies for Large Language Models: Insights from Random Prompting with Gemini API
Keywords:
Prompt Engineering, LLM Optimization, Computational Efficiency, Large Language ModelsAbstract
The increasing use of large language models (LLMs) has raised concerns about efficiency regarding token usage, as excessive token consumption burdens computational resources. This study addresses the need for systematic techniques to optimize prompts, evaluating three specific strategies within the Gemini API framework aimed at reducing token usage. The research examined 480 prompts across 16 models in the Gemini family to quantify potential token savings. The three strategies assessed are structured concise formatting, which utilizes bullet lists, headings, and concise language to streamline content; verbose removal, which eliminates redundant and irrelevant information to enhance clarity and focus; and code formatting, which promotes consistent syntax while minimizing inline commentary. Token counts were tracked before and after optimization using the Gemini count Tokens API endpoint. Findings revealed an average token saving of 37.15% across most Gemini-family models, with Gemma 3 models achieving a higher average reduction of 43.55%. Among the strategies, verbose removal yielded the greatest efficiency at an average reduction of 51.98%, followed by structured concise formatting at 33.36% and code formatting at 29.71%. The maximum individual saving recorded was 126 tokens. Multimodal testing with a shared fixed prompt set demonstrated consistent tokenization behaviour within the Gemini ecosystem across Gemini 2.0, 2.5, 3 preview, latest Gemini, and Gemma 4 model groups. Gemma 3 models consistently demonstrated higher efficiency, indicating variations in tokenization behaviour influenced by model architecture. These results suggest that prompt optimization can significantly enhance token efficiency within the Gemini model family, achieving reductions of approximately 30% to over 50% depending on strategy and model type; cross-ecosystem generalizability remains to be established. This research offers valuable insights for practitioners aiming to reduce computational costs and improve inference efficiency in LLM-based systems.
References
[1] T. B. Brown et al., “Language models are few-shot learners,” arXiv preprint arXiv:2005.14165, May 2020. [Online]. Available: https://arxiv.org/abs/2005.14165
[2] T. Kudo, “Subword regularization: Improving neural network translation models with multiple subword candidates,” in Proc. 56th Annu. Meeting Assoc. Comput. Linguistics, Melbourne, Australia, 2018, pp. 66–75.
[3] J. Kaplan et al., “Scaling laws for neural language models,” arXiv preprint arXiv:2001.08361, Jan. 2020. [Online]. Available: https://arxiv.org/abs/2001.08361
[4] J. Wei et al., “Chain-of-thought prompting elicits reasoning in large language models,” Adv. Neural Inf. Process. Syst., vol. 35, pp. 24824–24837, 2022.
[5] P. Liang et al., “Holistic evaluation of language models,” Trans. Assoc. Comput. Linguistics, vol. 10, pp. 100–123, 2022.
[6] H. Puerto, M. Tutek, S. Aditya, X. Zhu, and I. Gurevych, “Code Prompting Elicits Conditional Reasoning Abilities in Text+Code LLMs,” arXiv preprint arXiv:2401.10065, Jan. 2024. [Online]. Available: https://arxiv.org/abs/2401.10065
[7] S. Min et al., “Rethinking the role of demonstrations: What makes in-context learning work?” arXiv preprint arXiv:2202.12837, Feb. 2022. [Online]. Available: https://arxiv.org/abs/2202.12837
[8] R. M. G. Alarcia, “Optimizing Token Usage on Large Language Model Conversations Using the Design Structure Matrix,” arXiv preprint arXiv:2410.00749, Oct. 2024. [Online]. Available: https://arxiv.org/abs/2410.00749
[9] Google, “Prompt design strategies: Gemini API,” Google AI for Developers, 2024. [Online]. Available: https://ai.google.dev/
[10] M. Aubakirova, A. Atallah, C. Clark, J. Summerville, and A. Midha, “State of AI: An empirical 100 trillion token study with OpenRouter,” arXiv preprint arXiv:2601.10088, Jan. 2026. [Online]. Available: https://arxiv.org/abs/2601.10088
[11] T. Han, Z. Wang, C. Fang, S. Zhao, S. Ma, and Z. Chen, “Token-Budget-Aware LLM Reasoning,” arXiv preprint arXiv:2412.18547, 2025. [Online]. Available: https://arxiv.org/abs/2412.18547
[12] T. Kojima, S. S. Gu, M. Reid, Y. Matsuo, and Y. Iwasawa, “Large language models are zero-shot reasoners,” Adv. Neural Inf. Process. Syst., vol. 35, pp. 22199–22213, 2022.
[13] J. Hu, W. Zheng, Y. Liu, and Y. Liu, “Optimizing Token Consumption in LLMs: A Nano Surge Approach for Code Reasoning Efficiency,” arXiv preprint arXiv:2504.15989, 2025. [Online]. Available: https://arxiv.org/abs/2504.15989
[14] A. S. Luccioni, S. Viguier, and A.-L. Ligozat, “Estimating the carbon footprint of BLOOM, a 176B parameter language model,” J. Mach. Learn. Res., vol. 24, no. 253, pp. 1–15, 2023. [Online]. Available: https://jmlr.org/papers/v24/23-0069.html
Additional Files
Published
How to Cite
Issue
Section
License
Copyright (c) 2026 OAM Jayawardana

This work is licensed under a Creative Commons Attribution 4.0 International License.