What is Prompt Engineering ?

Introduction

Suppose you are making Spaghetti Marinara for dinner. A ready-made sauce from the jar is fine. But what if you buy your own tomatoes from the farmers market to create your own sauce ? No doubt it will be more flavourful. And what if you made your own fresh pasta also ? A whole new level of delicious meal will be obtained

Just as better ingredients can make for a better dinner, better inputs into a Generative AI model can return better results. These inputs are called prompts, and the practice of crafting them is called Prompt Engineering

Prompt Engineering encompasses the process of refining Large Language Models, or LLMs, with specific prompts and recommending outputs, as well as the refining of the inputs to generate required texts or images.

The importance of prompt engineering lies in its effectiveness for making the end-users life easier. Prompt Engineers create customizable templates and libraries of curated suggestive prompts, that are effective in exploring information more efficiently and even more importantly returning useful output to the user.

According to Grand View Research, the Global Prompt Engineering Market Size was estimated at USD 222.1 million in 2023 and is projected to grow at a compound annual growth rate (CAGR) of 32.8% from 2024 to 2030.

Prompt Engineering Techniques

Chain-of-Thought Prompting: In this kind of prompting, the complex and big question is broken down into several smaller parts that resemble a train-of-thought. This helps the model solve problems in a series of intermediate steps rather than directly answering the question.

Tree-of-Thought Prompting: In this kind, one or more possible branch steps are prompted. For example, if the question is “What are the effects of climate change?” The model might first generate possible subsidiary steps like “List the environmental effects” and “List the social effects.” and then elaborate on them

Maieutic Prompting: It is similar to Tree-of-Thought Prompting, but here, first part of the explanation is given to a question, and is then queried to be explained further. Inconsistent explanation branches of the tree response are pruned before the final response

Complexity-based Prompting: In this type of prompting, several chain-of-thoughts are rolled out and the one with the longest chain is selected. In this way complex questions are answered holistically

Generated Knowledge Prompting: This kind of prompting you can perceive in the following way – you want to write an essay on the effects of deforestation. To accomplish this, the model should first generate ‘ general ‘ facts like “deforestation contributes to climate change” and “deforestation leads to loss of biodiversity.” Then it should start elaborating

Least-to-Most Prompting: Imagine a user prompts the model to solve a math problem “ if 2x + 3 = 11, what is x ? “. The model should first list the subproblems in a reasonable order such  as ” subtract 3 from both sides ” and then ” divide by 2 “. It should then attempt to solve the question  

Self-Refine Prompting: In this technique, the model is prompted to solve the problem, critique its solution, and then resolve the problems with the critique. The process is repeated until a reasonable level of satisfaction is obtained for a predetermined criteria.

Directional-Stimulus Prompting: This can also be explained using an example – writing a poem about love. The model will pick up keywords like “heart”, “passion” and “eternal” from its libraries and templates and then integrate them into a composition. In this way it receives guidance and stimulation

Conclusion

Prompt engineering will continue to evolve in this era of AI and Machine Learning. Eventually, there will be prompts that allow us to combine text, code, and images all in one. Research is hot in this area. Of course, as AI ethics evolve, there will be likely focus on fairness and transparency of prompts.

Prompt Engineers need to be skilled in the fundamentals of Natural Language Processing (NLP), including libraries and frameworks, Python Programming Language, Generative AI Models, and contribute to Open-Source Projects

However, there are also some engineers with less technical background, such as in writing, and have gained experience by observing and experimenting with AI. Whichever way you look at it, smart and skilled workers both in this field have a promising future.

Image Source

Leave a Comment