Last updated:

A Systematic Survey of Prompt Engineering in Large Language Models: Techniques and Applications

Pranab Sahoo et al.

In collections: Prompting

Strategies from the report

  • Zero-Shot Prompting: A technique that relies solely on the built-in knowledge of a pre-trained model, without giving it any ready-made examples of a solution. It works great for simple, common tasks, where the AI can naturally generalize concepts from its training data.

  • Few-Shot Prompting: A strategy of giving the model a few example "input-output" pairs in the prompt itself before asking the actual question. This lets the AI imitate the expected pattern (meta-learning) and significantly improves accuracy on non-standard tasks.

  • Chain-of-Thought (CoT) Prompting: An advanced technique that makes the model generate intermediate reasoning steps before it gives the final result. It simulates the human step-by-step analytical process, dramatically improving performance on hard logic and arithmetic problems.

Best practices

  • Building strong, detailed context: The more precise background information (the model's role, the business goal, the target audience) you put in the instruction, the more accurate the generated content becomes and the less prone to vague answers (so-called hallucinations).

  • Precisely formatting the output: Always state clearly what structure you want the answer in (e.g. a table, JSON, a specific number of paragraphs, a bulleted list). This saves the user the time of manually reformatting the data afterward.

  • Iterative refinement: Writing prompts is rarely a one-shot process. Watching the model's mistakes and fixing your queries with additional constraints lets you systematically "calibrate" the final result over a series of conversations with the assistant.

What to avoid

  • Using ambiguous or very vague language: Prompts that leave a lot of room for interpretation force the model to "guess" your intentions. This often leads to answers that are technically correct but useless from the user's perspective.

  • Overloading the context window (Context Overload) in the Few-Shot method: Avoid inserting too many lengthy examples to teach the model. They take up precious "tokens" of the LLM's limited working memory, raise the cost of generation, and can make the AI ignore key instructions at the very bottom of the prompt.

  • Mixing roles and contradictory instructions: Introducing many unrelated formatting rules, or clashing roles to play, in one small block of text can overwhelm the model, causing it to lose key points of the task.

Support this project by buying me a coffee ;)