On the Capability and Limitation of Hard Prompt
Not on the map. Why?
Abstract (arXiv)
Prompt engineering has become an indispensable tool for using large language models (LLMs), turning LLMs into task-specific experts without changing their weights. Despite notable theoretical advances in prompt engineering, the theory for the more practical hard or discrete prompts is largely open. In this paper, we try to fill this gap either by providing a complete solution or by making substantial progress on the three core theoretical questions regarding hard prompts. First, we show that determining the existence of a hard prompt for a transformer to solve a downstream task is NP-complete and that finding an optimal hard prompt is NP-hard, which is the first computational complexity result for hard prompting, as far as we know. Second, we show that, unlike soft or continuous prompts, hard prompts have essential limitations: hard prompts are not complete; short hard prompts do not significantly enhance the ability of transformers; and long hard prompts exhibit the "prompt dominating answer phenomenon," meaning that, with high probability, the same answer is given for all queries of the same length. On the other hand, linear hard prompts do not have the limitations of short or long prompts. Third, we provide a tight bound on the size of the task in terms of the prompt length for the performance of prompts on the finite task to generalize to the entire data distribution, leading to a necessary and sufficient condition for generalizability. This is the first result on generalization for prompting, as far as we know. Our findings not only offer the first theoretical insights into hard prompts but also provide provably reliable practical guidance for real-world LLM usage.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 37 of its 48 references that are in the map. First posted on arXiv 26 Sep 2026.
Builds on
37 of 48 references.
References · 37
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,459
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,297
- 2020Scaling Laws for Neural Language Modelscited by 6,586
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,703
- 2021Prefix-Tuning: Optimizing Continuous Prompts for Generationcited by 3,915
- 2021The Power of Scale for Parameter-Efficient Prompt Tuningcited by 3,795
- 2023Tree of Thoughts: Deliberate Problem Solving with Large Language Modelscited by 3,211
- 2022Training Compute-Optimal Large Language Modelscited by 3,019
- 2020Making Pre-trained Language Models Better Few-shot Learnerscited by 1,256
- 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 938
- 2023Graph of Thoughts: Solving Elaborate Problems with Large Language Modelscited by 886
25 more
- 2021GPT Understands, Toocited by 716
- 2020It's Not Just Size That Matters: Small Language Models Are Also Few-Shot Learnerscited by 669
- 2023Automatic Prompt Optimization with "Gradient Descent" and Beam Searchcited by 653
- 2023Llemma: An Open Language Model For Mathematicscited by 388
- 2021Learning How to Ask: Querying LMs with Mixtures of Soft Promptscited by 377
- 2023Hard Prompts Made Easy: Gradient-Based Discrete Optimization for Prompt Tuning and Discoverycited by 336
- 2023In-Context Learning Creates Task Vectorscited by 312
- 2022Black-Box Tuning for Language-Model-as-a-Servicecited by 256
- 2017Controlling Linguistic Style Aspects in Neural Language Generationcited by 149
- 2025Goedel-Prover: A Frontier Model for Open-Source Automated Theorem Provingcited by 133
- 2022GrIPS: Gradient-free, Edit-based Instruction Search for Prompting Large Language Modelscited by 127
- 2024Prompt Compression for Large Language Models: A Surveycited by 67
- 2022TEMPERA: Test-Time Prompting via Reinforcement Learningcited by 50
- 2023What's the Magic Word? A Control Theory of LLM Promptingcited by 41
- 2023Memorization Capacity of Multi-Head Attention in Transformerscited by 40
- 2024An Information-Theoretic Analysis of In-Context Learningcited by 40
- 2024In-Context Learning with Representations: Contextual Generalization of Trained Transformerscited by 38
- 2023Universality and Limitations of Prompt Tuningcited by 30
- 2024Prompting a Pretrained Transformer Can Be a Universal Approximatorcited by 25
- 2024Fundamental Limits of Prompt Tuning Transformers: Universality, Capacity and Efficiencycited by 22
- 2024On the Training Convergence of Transformers for In-Context Classification of Gaussian Mixturescited by 15
- 2025A Survey on Prompt Tuningcited by 7
- 2025A Theoretical Framework for Prompt Engineering: Approximating Smooth Functions with Transformer Promptscited by 6
- 2025Memory Limitations of Prompt Tuning in Transformerscited by 4
- 2025Analyzing the Power of Chain of Thought through Memorization Capabilitiescited by 1
Built on by
Not cited yet.