Last updated:

Efficient Prompting Methods for Large Language Models: A Survey

Kaiyan Chang et al.

In collections: Edge AI Prompting

Strategies from the report:

  • Automatic Prompt Engineering (APE): Instead of writing and testing prompts by hand, this approach uses LLMs themselves to automatically generate and optimize instructions for different tasks. This makes it possible to achieve better results with less effort.

    Practical example:

  • Prompt Compression: Techniques that drastically shorten long prompts by removing unnecessary words, which reduces computational cost (token usage) and speeds up response time while preserving the key information needed to solve the task.

    Practical example



  • Knowledge Distillation methods: Using the largest and most powerful models (so-called teachers) to create optimized sets of rules or patterns, which are then used to steer smaller, much cheaper models (so-called students).

    Practical example:

Best practices:

  • Minimizing unnecessary context (Context Filtering): Keeping the prompt length to the absolute minimum. Instead of pasting an entire long document, filter it and give the model only the fragments relevant to the given query, which makes the model work faster and cheaper.

    Practical example:

  • Separation of Instruction and Context: Good, efficient prompts have a clear structure that separates what the model is supposed to do (the instruction) from the working data it is supposed to operate on. This reduces the risk that the model treats the data as a command.

    Practical example:

  • Evolution-based tuning: Iteratively improving a prompt based on the faulty outputs you receive. Instead of building the perfect prompt from scratch, start with a simple instruction and modify it, adding specific constraints wherever the AI made a mistake.

    Practical example:

What to avoid

  • Prompt Inflation/Bloat: Avoid creating overly long and complicated prompts (so-called megaprompts) full of unnecessary detail for simple tasks. This drastically increases the cost of using the model API, and the extra words often just confuse it.

    Practical example:

  • Ambiguous instructions in long context: Avoid placing your main question or command in the middle of a huge block of text. LLMs suffer from the "lost in the middle" phenomenon, so they may ignore the instruction if it is not at the very beginning or end of the query.

    Practical example:



  • Ignoring token costs through excessive 'Few-Shot Prompting': Avoid manually pasting dozens of examples of the task before you have made sure the model cannot do it with a short, well-worded instruction. Every additional example makes the query longer and costs valuable computational resources.

    Practical example :

Support this project by buying me a coffee ;)