StringLLM: Understanding the String Processing Capability of Large Language Models
Xilong Wang, Hao Fu, Jindong Wang, Neil Zhenqiang Gong
TL;DR
StringLLM introduces a comprehensive benchmark construction framework to evaluate LLMs on string processing via StringBench, spanning multilingual, hash, and random strings. The study finds that current LLMs exhibit limited character-level understanding due to tokenization and embedding limitations, performing far below human capabilities. Prompt engineering, especially Program of Thought (PoT), yields notable performance gains, yet gaps remain. The authors demonstrate that supervised fine-tuning with PoT-oriented data and LoRA can boost string-processing accuracy by at least $38.80\%$ while largely preserving foundational and coding abilities, suggesting dataset-guided fine-tuning as a practical path to improve string processing in LLMs.
Abstract
String processing, which mainly involves the analysis and manipulation of strings, is a fundamental component of modern computing. Despite the significant advancements of large language models (LLMs) in various natural language processing (NLP) tasks, their capability in string processing remains underexplored and underdeveloped. To bridge this gap, we present a comprehensive study of LLMs' string processing capability. In particular, we first propose StringLLM, a method to construct datasets for benchmarking string processing capability of LLMs. We use StringLLM to build a series of datasets, referred to as StringBench. It encompasses a wide range of string processing tasks, allowing us to systematically evaluate LLMs' performance in this area. Our evaluations indicate that LLMs struggle with accurately processing strings compared to humans. To uncover the underlying reasons for this limitation, we conduct an in-depth analysis and subsequently propose an effective approach that significantly enhances LLMs' string processing capability via fine-tuning. This work provides a foundation for future research to understand LLMs' string processing capability. Our code and data are available at https://github.com/wxl-lxw/StringLLM.
