# NumeroLogic: Number Encoding for Enhanced LLMs' Numerical Reasoning Authors: Eli Schwartz, Leshem Choshen, Joseph Shtok, Sivan Doveh, Leonid Karlinsky, Assaf Arbelle Venue: Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing (2024) ## Abstract Language models struggle with handling numerical data and performing arithmetic operations. We hypothesize that this limitation can be partially attributed to non-intuitive textual numbers representation. When a digit is read or generated by a causal language model it does not know its place value (e.g. thousands vs. hundreds) until the entire number is processed. To address this issue, we propose a simple adjustment to how numbers are represented by including the count of digits before each number. For instance, instead of ``42'', we suggest using ``2:42'' as the new format. This approach, which we term NumeroLogic, offers an added advantage in number generation by serving as a Chain of Thought (CoT). By requiring the model to consider the number of digits first, it enhances the reasoning process before generating the actual number. We use arithmetic tasks to demonstrate the effectiveness of the NumeroLogic formatting. We further demonstrate NumeroLogic applicability to general natural language modeling, improving language understanding performance in the MMLU benchmark. ## Links - arXiv: https://arxiv.org/abs/2404.00459 - PDF: https://arxiv.org/pdf/2404.00459 - HTML: https://arxiv.org/html/2404.00459 - Hugging Face: https://huggingface.co/papers/2404.00459 - alphaXiv: https://www.alphaxiv.org/abs/2404.00459 - DOI: https://doi.org/10.18653/v1/2024.emnlp-main.12 - ACL Anthology: https://aclanthology.org/2024.emnlp-main.12/ - Semantic Scholar: https://www.semanticscholar.org/paper/268819308 ## How to cite @inproceedings{schwartz2024numerologic, title = "{N}umero{L}ogic: Number Encoding for Enhanced {LLM}s' Numerical Reasoning", author = "Schwartz, Eli and Choshen, Leshem and Shtok, Joseph and Doveh, Sivan and Karlinsky, Leonid and Arbelle, Assaf", editor = "Al-Onaizan, Yaser and Bansal, Mohit and Chen, Yun-Nung", booktitle = "Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing", month = nov, year = "2024", address = "Miami, Florida, USA", publisher = "Association for Computational Linguistics", url = "https://aclanthology.org/2024.emnlp-main.12/", doi = "10.18653/v1/2024.emnlp-main.12", pages = "206--212", abstract = "Language models struggle with handling numerical data and performing arithmetic operations. We hypothesize that this limitation can be partially attributed to non-intuitive textual numbers representation. When a digit is read or generated by a causal language model it does not know its place value (e.g. thousands vs. hundreds) until the entire number is processed. To address this issue, we propose a simple adjustment to how numbers are represented by including the count of digits before each number. For instance, instead of ``42'', we suggest using ``2:42'' as the new format. This approach, which we term NumeroLogic, offers an added advantage in number generation by serving as a Chain of Thought (CoT). By requiring the model to consider the number of digits first, it enhances the reasoning process before generating the actual number. We use arithmetic tasks to demonstrate the effectiveness of the NumeroLogic formatting. We further demonstrate NumeroLogic applicability to general natural language modeling, improving language understanding performance in the MMLU benchmark." }