Prompt Engineering Framework

Master Prompt Engineering framework — Harness the Power of LLMs

Leo Jiang
AI Business Asia

--

Unlock 10x productivity with the top five prompt engineering frameworks

The world has no lack of LLMs given the choices that we have; quite frankly, These models have been commoditized as we speak, and it is accelerating, e.g. refer to my last article OpenAI GPT4o, Meta Llama 3.1B, Google Gemini 1.5 pro. Apps such as ChatGPT and Perplexity powered by LLMs will become everyday tools similar to MS Word and Excel.

Therefore, what matters the most to a working professional is how we derive value from these models and how you get these apps to work for you at their best. That comes to an essential technique that every IT professional needs to master → prompt engineering.

What makes a good prompt?

To harness the power of large language models (LLMs) effectively, a good prompt should be clear, specific, and well-structured. Here are the key elements that make a good prompt

  1. Clarity and Specificity
  • Clear Instructions: The prompt should provide unambiguous instructions to avoid multiple interpretations.
  • Specific Details: Include detailed information about the context, desired outcome, format, style, and length.

2. Context and Background

  • Relevant Context: Provide sufficient background information to help the model understand the scenario.
  • Audience Specification: Tailor the prompt to the target audience to ensure the output is relevant.

3. Desired Output Format

  • Examples: Use examples to illustrate the expected output format.
  • Structured Format: Clearly define the structure of the response, such as bullet points, lists, or paragraphs.

4. Iterative Refinement

  • Feedback Mechanism: Allow for iterative improvements based on the model’s responses.
  • Experimentation: Test different prompt variations to identify the most effective ones.

5. Avoiding Ambiguity

  • Precise Language: Minimize the use of vague or “fluffy” descriptions.
  • Explicit Instructions: Clearly state what to do and what not to do.

How Frameworks Make Prompts Effective

The prompt Engineering framework provides a structure to help you construct a more effective prompt. Over 40 prompt engineering frameworks have been developed over the past two years, which is quite a pain to follow. Fundamentally, Evaluating a prompt engineering framework involves assessing its effectiveness, usability, iterative improvement capabilities, performance metrics, community support, and adaptability.

I recommend the following five frameworks based on ease of use, output performance, use case, prompt re-usability.

CRISP Framework

  • Context: Provides a detailed background, helping the model understand the scenario.
  • Request: Specifies the task clearly, ensuring the model knows what to do.
  • Insight: Adds additional information, enhancing the model’s understanding.
  • Style: Defines the tone and manner of the response, making it suitable for the target audience.
  • Parameters: Sets boundaries for the response, such as length and format, ensuring the output meets specific requirements.

ERA Framework

  • Expectation: Outlines the desired outcome, providing clear goals for the model.
  • Role: Specifies the role of the model, guiding its behaviour.
  • Action: Describes the specific task, ensuring the model knows what action to take.

RTF Framework

  • Request: Clearly defines the user’s request.
  • Task: Specifies the task to be performed.
  • Format: Outlines the desired format of the response, ensuring clarity and structure.

Chain-of-Thought (CoT) Framework

  • Step-by-Step Reasoning: Encourages the model to think through the problem step-by-step, improving the quality of complex reasoning tasks.
  • Iterative Process: Allows for refinement and feedback, enhancing the model’s performance over time.

LangGPT Framework

LangGPT is a prompt engineering framework Inspired by structured reusable programming languages that make NLP prompt more structured and reusable.

  • Template-Based: Uses templates, variables, and commands to create structured prompts, making it easier to generate high-quality outputs.
  • Dual-Layer Structure: Allows for reusable and modular prompts, enhancing efficiency and consistency.
  • Community Support: Provides shared templates and resources, fostering collaboration and continuous improvement.

The basic module includes the following elements:

It was created by a China-based community and has demonstrated better performance in guiding LLMs to perform tasks compared to other prompt engineering frameworks

The Pros and Cons of Each Framework with a Scenario

Each framework has its strengths and weaknesses, and the choice depends on the complexity of the task, and your objective and the user’s familiarity with the framework. Here is an example that highlights the pros and cons of these framework

Generate an SEO plan to optimise a SaaS product website:

You can find the the output of these prompts based on ChatGPT here.

The Ideal Use Cases for Each Framework.

The use case also plays a big part towards the framework of choice. Here’s a table that categorizes various fields and indicates the most suitable prompt engineering framework for each category based on their strengths and characteristics.

The Conclusion

The evolution of prompt engineering frameworks reflects the rapid advancement of AI language models and their applications. Initially, prompt engineering focused on simple instruction-based approaches, but it has since developed into more sophisticated frameworks to maximize AI potential.

  • CRISP: Best for tasks requiring detailed context and comprehensive responses, such as writing, finance, marketing, and legal.
  • CoT: Offers a step-by-step approach, enhancing clarity for complex processes.
  • ERA: Delivers a simple and straightforward output, suitable for quick and direct tasks.
  • RTF: Effective for concise and structured outputs, making it suitable for social media content.
  • LangGPT: Highly structured and customizable, making it ideal for design, SEO, and coding tasks that requiring consistency and reusability.

That being said, Despite this trend towards automation, human expertise remains crucial in tailoring AI applications for specific industries and ensuring compliance and safety.

Bonus:

here is the prompt that i use to come up with the this article title using CRISP, so suggest that you get to use this framework now.

Context: you are a tech writer and SEO expert, working on an article to give an expert view on the prompt engineering framework.

Request: Structure the article title to be the most SEO-optimised. Please use Google Keyword Planner, Ahrefs, and SEMrush to identify the top five keywords.

Insight: The article targets IT professionals who have some level of understanding of prompt engineering. it is used for a LinkedIn post and a newsletter.

Style: Engaging.

Parameters: The title must be short, catchy, and generate a call to action.

Subscribe

to our newsletter as we will be publishing more practical tips and prompts to optimise your daily work.

--

--

Leo Jiang
AI Business Asia

Ex-CDO of Huawei | Start-Up Advisor & Investor | Recognised Top 10 CDO & Top 200 CIO Globally