Conf42 Prompt Engineering 2024 - Online

- premiere 5PM GMT

Ethical AI Through Prompt Engineering: Mitigating Bias and Reducing Hallucinations in Conversational Systems

Video size:

Abstract

Join us for a deep dive into prompt engineering and discover how to combat AI’s biggest challenges: bias and hallucination. Learn cutting-edge techniques like Chain of Thought and MRKL to enhance accuracy and inclusivity in AI, making your applications smarter and more reliable.

Summary

Transcript

This transcript was autogenerated. To make changes, submit a PR.
Hello, I'm Parvin Ghasemzadeh. I'm a senior software engineer at Amazon. And in this talk, I'll be talking about the role of prompt engineering in ethical AI and how we can mitigate bias and reduce hallucinations in AI systems. So here is the agenda for today's talk. We'll start with a brief introduction to LLMs Then I will explain two main Challenges we face in this area by some house nation in AI systems And we'll then discuss about methods to address these challenges and I will wrap up with some key takeaways Let's start with the definition of large language models And I thought it's better to ask the definition of one of the LLM to see how they define itself So here I used So basically it says LLM is a type of AI model designed to understand and generate human like text. And these models are trained on vast amount of data which enables them to predict and produce response based on the inputs they receive. So a few keywords here are important to note and remember. Generate human like text and trained on vast amount of data. So just let's keep these two phrases in mind, and we'll come back to this to understand how it impacts the outcome of the LLAMs. In general, LLAMs are powerful tools, but their response depends on the data they have trained on, which can lead to issues we'll discuss shortly. So let's discuss a bit about the background. So the transformer architecture is the background of the large language models, which allows AI to learn language patterns and generate text. So in 2017, Google researchers introduced the first transformer model, which is described in the paper, attention is all you need paper, which is added here, which light the groundwork for the modern LLMs. So before transformers, all those who relied on the sequence, like a processing, takes word by word, however with transformers, it scans, transformers look at the entire sentence, and, To understand the context better. here the model uses a special technique called self attention, which allows to look at the, all the words in the sentence at once, to understand the context and understand the relationship between the words, to predict the next word. after this transformer model, OpenAI created its own model. First, generative pre trained transform model in 2018 and 2020. They created the GPT 3 model, which is one of the largest language model created for now, and it has 175 billion parameters. And after that, so like many other models with billions, even trillions of parameters created by different companies. And the main thing to remember here is that all these models are trained using the data from like the public source from books, from websites, wikipedia, and like public forms like reddit. And let's keep in mind that like These are the, not the accurate source of the information, so it might have, some misinformation, some, bias, within the data, which could, impact the outcome of the LLMs, which we will discuss shortly in the upcoming slides. So now let's talk about a bit on the ethical part of the AI. So what do we mean by the ethical AI? It's mainly about like developing an AI stems that align with the core ethical principles and values. fairness, transparency, accountability, privacy, safety and inclusivity. in short, ethical AI systems should treat everyone fairly, regardless of their race, age, gender or any other characteristics. They should also make their process clear, keep personal data secure and safe, and respect the diverse perspectives. So the two key issues we are facing with ethical AI are bias and hallucination, which I will go into details in the next slide. So let's start with the bias. So bias in AI mainly refers to the systematic errors that cause certain groups or individuals to be treated unfairly by the model. So for example, if let's think about the example for if the face recognition application has been trained on, a lighter skinned individual, it may not accurately identify the darker skin tones, which can lead to the error rates for certain groups. So this, like a bias, can come from multiple sources. And the training data, is, this is the main source as we discussed before. So the, all these metals are trained using the, the information from the public source. And this could impact the bias on the output of the as. So this, like the data might be imbalanced, so the model design could have some limitations. So just feature selection is also important. Explaining some. Features could impact the AI's decision. Labeling might also be subjective here. So if the annotators, who, manually label some training data, have some bias on specific topics, might also impact the, decision of the AI. And also like even the biased input from the users could also impact the final output. So if this data is used for retraining the models. And also the ethical impact of bias is significant. it can lead to the unfair treatment of certain groups and ultimately people lose trust in AI systems. And for the hallucination, so this is the mainly commonly common term used in AI world. when the model generates incorrect or fabricated information. So this can also, happen for several reasons. So similar to the bias. So training data is also plays a huge role here, so low quality data also, cause some, AI models to hallucinate, to provide a fabricated and misinformation. So lack of sufficient context also cause the, issues here. Or, a complex language, inputs, Sarcasm, like cultural references, could be difficult for AI models to understand, and in that case AI models would just fill the gaps with some fabricated information. And also, this can also lead to the misinformation and reduce reliability in AI systems, which is why it's important to address all these issues. let's see what methods can be used to mitigate the bias. here are the few strategies listed below. as we discussed, the source of the issues is coming from the training data. using diverse training data sets that cover the range of demographics is a good idea. key starting point here. So for example, so if you are building a assistant like AI assistant to answer medical questions, we should use a data set that reflects diverse patients like demographics and conditions to avoid like a bias recommendation from the other side. So another method is fine tuning and debiasing where we retrain model. with specific data that helps to reduce the bias. So doing some bias audits and transparency about how these algorithms function are also important. And finally, updating the models regularly, keeping them aligned with social norms would help to minimize the bias. And similar to the bias, in order to reduce hallucinations, using high quality training data is important. So the more accurate the data, the better the model's output it is. So contextual training is another approach that we can use to reduce the hallucination here to where we provide the model with additional background information for specific tasks. For example, if we train the customer service chatbot on domain specific language, it will give more relevant answers. So fine tuning the pre trained models on this focus dataset also increase the reliability of the system. for example, I guess AI system design for the medical advice should The fine tuned on the verified health care data have an irrelevant output. So integrating with the external knowledge sources like a database is going to help verify the facts and provide additional context and help to reduce the hallucination. And also continuous learning is important. Which allows the model to keep improving based on the user interaction here. So all the previous methods we discussed for both minimizing the bias and reducing hallucinations is not scalable and cost efficient as they require retraining, fine tuning, which are any costly operation. So now we will discuss a few, prompt engineering methods, which will be easy and quick to implement and try. we'll discuss zero shot and few shot learning, chain of thought, and modular reasoning, knowledge, and language, in short, Miracle Framework. So let's start with the zero shot and few shot learning. So mainly zero shot and few shot learning methods are useful in areas where we don't have a lot of, labeled data. And zero shot means, allows the model to apply its existing knowledge to, new tasks without any specific examples. So it relies on the training data. Where in the few shot learning, we give model a few additional examples. Helping it to understand what we expect, for example. if we are building an AI system to, let's say, classify emails, we can show, show it a few examples, which will adapt, more effectively. here, in the, actually, in this screenshot shown here, shows the three examples, zero shot, like a glitched email. It doesn't provide any examples of one shot which provides a single additional example and a few shot which provides multiple examples that shows the translation of word from English to French and in the one shot it provides a single example to show what the translation of word from English to French and the few shot provides multiple examples. Which increases the accuracy of the result of the AI system. another method is the chain of thought approach. So this is the one, from the paper created by the Google resource team. and this, I'll add the link here. this helps the method to think step by step and break down the complex problems by reasoning through. like at each step, so instead of jumping directly to the answer, so it just asks the model to think step by step. this is the screenshot, this is the example from the paper itself. Make sure this is a good example that shows the combination of one shot example and the chain of the tiles. So in each, like in the standard prompting and the chain of the tile prompting, so it provides an additional example before asking the, example to the model itself. So in the first one, It provides the one example with math problem and in the answer part it just directly provides the answer. However, when it asks the new math problem it just couldn't find the answer correctly. In the second one, the chain of 10 problem, prompting part, so it provides a math, same math problem, but in the answer, so it just gives a, like a step by step explanation more, explain the reasoning of the answer here, which helps the, model to respond correctly. So in the, in that case, so it's able to correctly find the math, answer of the math problem. And the last method is the Miracle Framework created by the AI21 Labs. basically it suggests to enhance the capabilities of language models by integrating with external tools and knowledge sources. Some examples are like, using it for, integrating with the additional source to, to, check the weather, real time weather, or for the financial applications, maybe integrating with the financial source to check the real time, stock prices. Could be a good example here and in this screenshot below actually shows also like another use case for the math problems, so which is able to find the answers for the simple math problems but struggles to, calculate the complex math problems. So the calculator tool or calculator application is another good use case here. So basically it just. integrates with the calculator application and parse the user inputs and pass the parameters to the Miracle framework like through the APS which calculates and responds back to the correct result for the math problems. So just to wrap up, here are the key points to remember as part of this presentation. So ethical AI is important for creating systems that are fair, transparent, and accountable. We should also remember that prompt engineering is a powerful tool to address issues of bias and hallucinations, which makes the AI system more reliable and transportive. It's also important to remember that the ethical is a continuous journey, so we need to continuously, evaluate, update and take the diverse perspectives into account in order to tackle new ethical challenges here. And finally, Organizations must commit to ethical practices in AI development to ensure technology benefits society. So here are the list of references I used throughout the slides and thank you for listening. Please feel free to connect me on LinkedIn for further discussion and questions.
...

Parvin Gasimzade

Tech Lead @ Amazon

Parvin Gasimzade's LinkedIn account



Join the community!

Learn for free, join the best tech learning community for a price of a pumpkin latte.

Annual
Monthly
Newsletter
$ 0 /mo

Event notifications, weekly newsletter

Delayed access to all content

Immediate access to Keynotes & Panels

Community
$ 8.34 /mo

Immediate access to all content

Courses, quizes & certificates

Community chats

Join the community (7 day free trial)