Register for our webinar

How to Nail your next Technical Interview

1 hour
Loading...
1
Enter details
2
Select webinar slot
*Invalid Name
*Invalid Name
By sharing your contact details, you agree to our privacy policy.
Step 1
Step 2
Congratulations!
You have registered for our webinar
check-mark
Oops! Something went wrong while submitting the form.
1
Enter details
2
Select webinar slot
*All webinar slots are in the Asia/Kolkata timezone
Step 1
Step 2
check-mark
Confirmed
You are scheduled with Interview Kickstart.
Redirecting...
Oops! Something went wrong while submitting the form.
close-icon
Iks white logo

You may be missing out on a 66.5% salary hike*

Nick Camilleri

Head of Career Skills Development & Coaching
*Based on past data of successful IK students
Iks white logo
Help us know you better!

How many years of coding experience do you have?

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Iks white logo

FREE course on 'Sorting Algorithms' by Omkar Deshpande (Stanford PhD, Head of Curriculum, IK)

Thank you! Please check your inbox for the course details.
Oops! Something went wrong while submitting the form.
Our June 2021 cohorts are filling up quickly. Join our free webinar to Uplevel your career
close

Leveraging Large Language Models: The Software Engineer’s Guide to Effective Prompt Crafting

Last updated on: 
February 8, 2024
|
by 
Ashwin Ramachandran
The fast well prepared banner
About The Author!
Ashwin Ramachandran
Ashwin Ramachandran
Head of engineering at Interview Kickstart. Playing in the field of technology with the tools of Java for more than a decade. A mind full of innovative ideas and curiosity for exploring data.

With around 400 different opportunities in India and more than 2000 in the US, the promise of new jobs due to the usage of AI has begun to be delivered. AI has shown promising results in solving complex queries. Yet, it often lags in delivering expert output. So, interacting with AI has summed down to effective, prompt crafting. Learning it is easier for software engineers who are well-versed in computing concepts. Introducing you to designing the prompts suited for you, let us begin with the basics. 

Here’s what we’ll cover: 

  • Introduction to LLMs
  • Need for Prompt Engineering
  • Prompt Categories 
  • Prompt Engineering Crafting Principles 
  • Prompt Engineering Techniques
  • Tips for Prompt Engineering
  • Ultimate Guide to Prompt Engineering with Interview Kickstart
  • Frequently Asked Questions on Effective Prompt Crafting

Introduction to LLMs

Interaction with AI has never been easy, thanks to Large Language models. Utilizing Natural Language Processing and other related techniques, the conversations have been simplified down to user language-based prompts. These are processed by the AI through LLMs and further provide the desired output back to the user. 

Every conversation should be clear, and it holds true for AI as well. Crafting or writing prompts for AI is an art that all users, including software developers, must know. 

Need for Prompt Engineering

Writing prompts are everyday tasks for many people. The responses of GPT-3/GPT-4 for developers and other professionals are also satisfactory. Then why bother with prompt engineering? Here are the reasons why you should: 

  • Helps you mindfully write in the important information that serves as context to get an accurate answer, which might be missed out if you are unaware
  • Allows you to fine-tune for utilizing GPT for coding
  • Output is precisely controlled, eliminating the irrelevant data 
  • You can influence the adaptability as per the required domain 
  • Allows you to maintain consistent responses that further increase the depths of the domain
  • Aids to improvise the prompt based on previous responses
  • Carefully use mitigating strategies to eliminate bias

Prompt Categories 

Let us begin with the basics for effective interaction with language models in software development and other tasks. Choosing or knowing the right category while typing in your query can help you get the right mindset significant for obtaining the desired answer: 

  • Task-specific prompts: You simply give a specific task to the AI. 
  • Query-based prompts: You are using the prompt as a search engine. You will be getting an AI-curated response, which is designed on more factors than only keywords. Here, your prompts will begin with question words. 
  • Comparative prompts: You are using them for comparison. You can mold the output based on your preference, such as in the form of bullets, paragraphs, and even tables. 
  • Reflective prompts: Being more effective than search engines, AI gives you the freedom to gain new perspectives. You can ask their opinion, ideologies, and beliefs. Adding context and relevant information is important here before proceeding with the exact prompt for the desired output. 
  • Context-supplying prompts: Often, queries can have multiple perspectives and applications. Ensuring accuracy here is possible through supplication of context. A prompt aimed at business enhancement can get responses on literal meaning due to a lack of clarity. 
  • Role-specific prompts: Here, you can assign a role to AI and further instruct them to answer according to that role. You can make them recruiters, educators, software developers, or any other professional. Using this technique is recommended to accompany 5 Ws while answering: 

Who: Assign the role 

What: State the action to be performed

When: State the time limit for performing the task 

Where: Direct towards the location or context of the prompt 

Why: Indicate the motive, reason, or objective of the prompt 

Prompt categories

Prompt Engineering Crafting Principles 

Here are some key principles to be considered when curating a prompt. Always keep them in mind regardless of your field of profession: 

Clarity and specificity: Ensuring complete clarity can be achieved through the incorporation of the following:

  • Delimiters such as triple quotes, angle brackets, triple dashes and back-ticks, and XML tags. 
  • Specifying the requirement of structured output 
  • Depending on the type of query, request AI to distinguish between valid and invalid input and generate the response accordingly.
  • Use techniques mentioned in the next section

Time: Expecting a solution to complex queries in the average time set for regular prompts is impractical. You need to give the model some time through the following methods:

  • Begin by providing a complete task list 
  • Ensure specifying the steps and instruct to use those steps for reaching a conclusion rather than a generalized procedure. It adds to the specificity and guides AI thoroughly through the procedure. 

Creativity: You must be specific but leave room to get creative output as well. The techniques to be followed are: 

  • Use Tolkien’s method, where you provide enough theory to provide information in your mind but not enough to complete it. For instance, you need to let it understand the product’s qualities, but AI’s responsibility is to add extra features and designs where it can exhibit its creativity. 
  • Get familiar with different decoding methods like temperature, Top-P sampling, and others and apply the same.
Prompt Engineering Principles

Prompt Engineering Techniques

Here are some techniques that you can follow to improve your prompt crafting: 

N-shot prompting

Here, ‘n’ refers to zero, one, or few shots. Overall, it indicates you can simply ask AI a query or give an appropriate example to be clear about your demands. Giving a single or multiple demands, as much as it covers the important parts, should be done. Through ‘n’ shot prompting, you can train the dataset to get the desired response. You will be using your dataset and AI’s understanding and reasoning abilities. 

Chain of Thought prompting

Well-tested by Google researchers, you will be using AI to generate final responses through multiple stages. It helps better comprehension and ease the accuracy of complex solutions. You are instructed to break down your query while keeping each query connected to the previous one.

Self-consistency

Here, you are required to mold the question to different forms, keeping the key characteristics or queries the same. The answers here will both vary and remain the same. But the best answer is considered the most repeated one. For instance, you can ask AI to select footwear with acupuncture properties and cloth fabric that is suitable for diabetes. You have to adapt the prompts to these three characteristics, and the most consistent brand or model will be your preferred answer. 

General knowledge prompting

You can leverage the knowledge of AI itself or provide external information here. This part will serve as general knowledge for AI, and related queries will follow it. You can use it to make out relations between two topics or ask about the dependency of one on another or of both on each other. 

Template filling prompting

Generating a response for a specific format is possible through this technique. You are simply required to provide the constants and instruct AI to fill in the variables for you. It is quite helpful to generate novel and creative content in the same format. In programming, you can use it to develop functions for different program outputs. 

Graph prompting

You get the chance to get an accurate interpretation of the graph or cross-check your views on the same. It allows converting graph input into a structured text output or any other format as required. It helps interpret the relationships among different objects of graphs or further analyze them for predictions. 

Tips for Prompt Engineering

Using some simple tricks to enhance the prompt can make your day. Go through following to understand their importance and level-up your AI game:  

  • Experimentation won’t be leaving your side; thus, use it with prompts. Developing a perfect prompt depends on perspective and requirements. We recommend iterating the response by writing it, executing it, analyzing it, and improving it further. 
  • Provide external information or data to give context for understanding your mind. 
  • Use objective words instead of subject. Instead of asking AI to improve the answer, write down the characteristics that will make your answer improve. It can be grammar, sentence structure, spelling, punctuation, or any other requirement. 
  • Instead of stating don’ts to AI, prefer specifying do’s.
  • Break down your query into small sentences. Ensure simplicity in your commands. 
  • You can also refine your prompts with synonyms and phrases. Use them and see the difference in answering yourself. 

Ultimate Guide to AI Job Roles with Interview Kickstart

Prompt engineering involves the thoughtful study of every aspect. It requires keenly developing the skills to come up with accurate prompts for efficient answers. With promised new job opportunities and widespread usage of AI, prompt engineering is only the beginning. Have you mastered the art of crafting prompts with time efficiency? You are the one being hunted for by MNCs. 

To be seen in the crowd, polishing your presentation skills is critical for your career. We help you do so at Interview Kickstart. With top recruiters cum instructors from FAANG companies, we have helped millions ace their interviews in tier-1 companies. Dive in our methodologies at the FREE webinar. Register Now! 

Frequently Asked Questions on Effective Prompt Crafting

Q1. How do I train ChatGPT on my own data?

Training ChatGPT with its own data is possible through the fine-tuning option open for GPT-3.5 turbo. It allows customizing data for personal or organizational usage. 

Q2. What is the least to most prompting strategy?

The strategy involves breaking down the query into a series of questions where each successive question is dependent on the predecessor question. The method is based on teaching strategies among educators. 

Q3. How do I make my GPT write like a human?

Specify your requirements clearly in the prompt.  Instruct AI to replace if you are aware of several words or style of writing that adds an AI touch. You can focus on phrases and sentence length, provide context, state the format, or handle a role to GPT for more personalized answers. Focus on the do’s for GPT rather than the don’ts. 

Q4. What is a positive prompt?

These are contrary to negative prompts. The focus here is on do’s and instructions to be followed. Contrarily, negative prompts refrain AI from performing certain actions. 

Q5. Can ChatGPT generate images?

The paid version of ChatGPT offers collaborative access with DALLE.3. The two can produce images. 

Q6. What skills are required to become a prompt engineer?

You must have knowledge of AI, NLP, and ML. You should be familiar with creative writing styles and have in-depth knowledge of the field. You should also be creative and capable of developing conversational skills. 

Q7. Which industries hire prompt engineers?

Industries like healthcare, education, technology, finance, marketing, retail, and others hire prompt engineers.

Posted on 
January 5, 2024
AUTHOR

Ashwin Ramachandran

Head of Engineering @ Interview Kickstart. Enjoys cutting through the noise and finding patterns.

Attend our Free Webinar on How to Nail Your Next Technical Interview

Square

Worried About Failing Tech Interviews?

Attend our webinar on
"How to nail your next tech interview" and learn

Ryan-image
Hosted By
Ryan Valles
Founder, Interview Kickstart
blue tick
Our tried & tested strategy for cracking interviews
blue tick
How FAANG hiring process works
blue tick
The 4 areas you must prepare for
blue tick
How you can accelerate your learnings
Register for Webinar

Recent Articles

No items found.
entroll-image