Prompt Engineering - 01
Before Digging in to what prompt engineering is make sure you have some idea about below terms.
- Generative AI: Unlike traditional AI, generative AI can create new content in response to natural language input (Human language), making it highly versatile and powerful.
- Large Language Models (LLMs): These models, like GPT-4 and Ollama, Deepseek, are trained on vast amounts of text and can engage in realistic conversations and reasoning.
- AI Applications: Generative AI includes various applications such as text-to-image (e.g., DALL-E 2), text-to-music, and even action transformers that can perform tasks like browsing the internet.
- Technological Foundations: The transformer architecture, attention mechanism, and reinforcement learning with human feedback(RLHF) are crucial components of these models. These are the key concepts behind gen-AI applications.
the mechanism like transformer architecture, attention mechanism and RLHF , if we talk about those in detail it will be highly technical one. But let me give some examples so that you can get some idea on those concepts.
Let's discuss transformer architecture with attention mechanism
Consider a translator,
You input below text to GPT-4 and ask it to translate to French.
"The cat sat on the mat"
"The cat sat on the mat" ----> An encoder breaks the sentence in to pieces
You input below text to GPT-4 and ask it to translate to French.
"The cat sat on the mat"
"The cat sat on the mat" ----> An encoder breaks the sentence in to pieces
Then for each piece it tries to understand it by looking at other parts (Attention mechanism)
Then it stores the this understanding in some data structure.
(Suppose it is storing each word with some notes)
Then it stores the this understanding in some data structure.
(Suppose it is storing each word with some notes)
------> A decoder get that data structure from encoder and translate each piece.
Before translating each piece it pay attention to what it has already translated. and look (pay attention to) at the notes(the understanding done by encoder)
Transformer Architecture is consist for multiple encoder and decoder layers and I think you can get some idea how attention mechanism helps here by looking at the usage of attention I've used in above use case.
Reinforcement learning with human feedback(RLHF)
Although with encoders and decoders and the self attention mechanism works well , the model might not be able to give you the perfect result.
In that case we need someone to judge/critic the results generated. And rank them.
This is what RLHF is about.
suppose one AI model with all the above mentioned techniques will give you set of outputs. Then there should be another model which can rank the results. so that in the end the two models together will be able to return a proper output.
And in the end all these new AI models are well versed with Zero-shot learning
This means that the models are capable of learning new information that they were given to process. The data/information does not need to be stored in your training data set. So , in each Prompt you are entering, the models learn. 😀
Why I need to learn how to write a good prompt? I'm already asking things from chatGPT, Claude?
Believe me I had the same question.
But remember when you ask to generate a picture from DALL E 3 did you get your desired output in the first run.
Or did you reclarify things with AI again and again.
Meaning that, you did not give the proper prompt at first. So you need to learn how to give a proper prompt to the AI so that you can get the best out of it.
Another ex:- recall a time when you ask about a solution from an AI tool. It might give you a working answer. but it may not be the best solution because it is time consuming, then you ask 'Hey your solution is time consuming' then it give a efficient coding solution. what if you can ask it in the first place so that AI can give you a super suited solution.
Ok. this became longer than I expected. Let's meet in a new chapter to see how we can optimize our prompt to get the best out of AI.
Before translating each piece it pay attention to what it has already translated. and look (pay attention to) at the notes(the understanding done by encoder)
Transformer Architecture is consist for multiple encoder and decoder layers and I think you can get some idea how attention mechanism helps here by looking at the usage of attention I've used in above use case.
Reinforcement learning with human feedback(RLHF)
Although with encoders and decoders and the self attention mechanism works well , the model might not be able to give you the perfect result.
In that case we need someone to judge/critic the results generated. And rank them.
This is what RLHF is about.
suppose one AI model with all the above mentioned techniques will give you set of outputs. Then there should be another model which can rank the results. so that in the end the two models together will be able to return a proper output.
And in the end all these new AI models are well versed with Zero-shot learning
This means that the models are capable of learning new information that they were given to process. The data/information does not need to be stored in your training data set. So , in each Prompt you are entering, the models learn. 😀
Why I need to learn how to write a good prompt? I'm already asking things from chatGPT, Claude?
Believe me I had the same question.
But remember when you ask to generate a picture from DALL E 3 did you get your desired output in the first run.
Or did you reclarify things with AI again and again.
Meaning that, you did not give the proper prompt at first. So you need to learn how to give a proper prompt to the AI so that you can get the best out of it.
Another ex:- recall a time when you ask about a solution from an AI tool. It might give you a working answer. but it may not be the best solution because it is time consuming, then you ask 'Hey your solution is time consuming' then it give a efficient coding solution. what if you can ask it in the first place so that AI can give you a super suited solution.
Ok. this became longer than I expected. Let's meet in a new chapter to see how we can optimize our prompt to get the best out of AI.
Comments
Post a Comment