Learning AI for Business

This is a guide on learning AI for business.

This is my favorite Python book on Amazon, if you are interested in learning Python I highly recommend it

Table of Contents

Generative AI Foundations

Whether we like it or not, artificial intelligence pervades every aspect of our life, and that makes it very important for us to understand what exactly is artificial intelligence and machine learning.

 

As a technologist or anyone working in any kind of industry, even if you are not directly coding up any of these algorithms or deploying any of these models, it is important that you understand what exactly these terms are and how they can be harnessed for the benefit, for your organization, and for your career.

 

This learning path is for anyone who has a general curiosity about AI and ML, but absolutely no background in any of these technologies.



I will start from the basics and walk you through a high level, intuitive understanding of how these algorithms and models work. The objective is by the time you are done you should be able to have meaningful conversations with the data scientists and technologists in your company that are actually working with AI and ML, and it can also be the start of your learning journey towards developing these AIML models in a hands-on manner.



Let us start with the very basics, and I will first define the term artificial intelligence. Now the fact of the matter is this is easier said than done because this term has been around since at least the 1950s, and it has applied to such a broad array of algorithmic techniques and models that it is hard to pin down.

 

A layman's definition would be artificial intelligence is an activity devoted to making machines intelligent, and intelligence is that quality that enables an entity to function appropriately and with foresight within its environment.



The idea is that you give these machines the capability to behave and make decisions in a way that is appropriate  for the context in which they operate. Now, it is very easy to say artificial intelligence involves mimicking human intelligence, but this would not be entirely right.

 

So, it is hard to define AI perfectly, and this definition of AI has varied over time. But one thing should be clear in your head is that artificial intelligence is its own kind of intelligence, and it is not actually like human intelligence. Now, you might say something like, oh, AI models can see or perceive objects like human beings. Well, they can perceive objects, but it may not be exactly how we perceive objects.

 

We may try to get them to perceive objects like us, but they are their own kind of intelligence. And to complicate this further, over the last 50 or 70 years, the term AI has come to apply to so many different algorithms and techniques.



Historically, the term artificial intelligence has often been conflated with machine learning, where machine learning refers to algorithms that learn from data. Now, we will dive into machine learning in a little more detail in just  a bit, but you should know that artificial intelligence is more all-encompassing.

 

Traditionally, AI used to refer to machine learning fields as well as non-machine learning fields such as game theory. Another important detail to keep in mind about artificial intelligence is that it refers to a system as a whole.



AI is often powered by a model that enables this intelligence, but AI can be thought of as a term that encompasses the complete system that includes this model. For example, let us say you are interacting with a chatbot such as ChatGPT. The entire system is an example of artificial intelligence, but there is a language model that actually powers the conversation behind the scenes. AI is the system and not just that model.



Now I understand that was a long and detailed introduction to artificial intelligence, but it is a nuanced term, and I wanted to ensure that I got across its subtleties. But the term AI in regular everyday use is not as loaded. It serves as a catchall term for applications that perform human-like tasks without any human intervention. And this is a perfectly reasonable way to talk about artificial intelligence in general conversation.



Now, people working in AI in a big tech company might refer to artificial intelligence as something very, very specific. Their definition of  AI is likely to be the use of deep learning models that perform tasks that extract meaningful representations from data and use that for prediction.

 

Data scientists, engineers, product managers, project managers, people at big tech companies who are closely involved with working on artificial intelligence, may have a very specific meaning when they say AI.



Engineers and data scientists developing these systems may only refer to the model as artificial intelligence and not the system as a whole. In the real world, you are likely to be conversing with people from different fields and different walks of life, when you talk about AI, and it is important that you keep these different perspectives in mind, so you know what AI means in that particular context.



With that discussion of AI under our belt,  let us move on to discussing artificial intelligence and machine learning. Now, these two terms are often used interchangeably, but they actually mean very different things.

 

At this point, you have a good big picture understanding of what AI is all about. It is an umbrella term for computer software that mimics human cognition to perform complex, almost human-like tasks. Anytime you see a machine doing something that is almost human-like, maybe its walking, maybe it is detecting obstacles, maybe it is conversing with you.

 

If it does something that seems almost human-like, you refer to that as artificial intelligence. Artificial intelligence is a very broad term, and artificial intelligence encompasses the field of machine learning. Machine learning is a part or a subfield of artificial intelligence that uses algorithms trained on data to produce models that can perform predictive reasoning.



So, machine learning is all about algorithms that can learn from data. You feed in a whole corpus of data to a machine learning algorithm, and once the algorithm has trained on that data, you refer to that as a model.

 

This machine learning model during the training process, has learned generalized patterns that exist in the data, and it can use those patterns for predictions. This is a good intuitive way to distinguish between AI and ML, but I should tell you that out there in the world, there is no standard approach for separating artificial intelligence and machine learning, which is why these two terms are often used together and often used interchangeably.



Now another term you are likely to have encountered in the context of artificial intelligence and machine learning is deep learning. Deep learning is a subset of machine learning.

 

Just like machine learning is a subfield of artificial intelligence, deep learning is one very specific kind of machine learning that uses advanced models built using neural networks to perform some of the most complex tasks in the world of machine learning. Do not be thrown off by the term neural networks.

 

Neural networks refer to one particular architecture of a machine learning model, which uses active learning units called neurons, arranged in layers to actually learn from data. We will be discussing neural networks in more detail later on.



The most advanced models today, the ones that surprise you and seem almost magical, are all built using deep learning models, which are a subcategory of machine learning models in general.



Now, I had mentioned earlier that the term AI is usually used to refer to the system as a whole, and not just the machine learning model powering the system. So here are some examples of AI that we see here in the real world today.

 

A self-driving car that can navigate traffic and routes on its own. It brings together machine learning models and a bunch of other technologies to make this happen. Another example of AI that is relevant today, is a conversational chatbot that can answer questions and respond to queries. Also, voice assistants such as Alexa or Siri that can respond to voice queries.



AI systems bring together a number of different technologies, but at the heart of an artificial intelligence system is machine learning. Machine learning can be thought of as powering artificial intelligence.

 

For example, self-driving cars use computer vision algorithms to recognize stop signs, signals, and other obstacles that come in the way, and then it takes action accordingly. A conversational chatbot has to understand natural language. It has to recognize patterns in your prompts and your queries, and then understand what they mean, and then produce responses.

 

And if you think about voice assistants, they use speech-to-text models to interact with users, in addition, they need to have an understanding of what is said so that they can respond appropriately. This involves natural language processing as well. 

 

What is Generative AI

Generative AI is a type of artificial intelligence that can create new content like text, images, music, or even code based on patterns it learned from existing data. Instead of just recognizing things, it has the ability to generate something original, like writing an essay, drawing a picture, or composing a song by imagining what would fit based on its training. 



Think of it as a tool that can draft reports, write emails, or generate insights, helping you accomplish tasks more efficiently. Generative AI gained widespread popularity thanks to products like ChatGPT, Midjourney, and others that showcase its power to assist with creative and productive tasks.



While AI is trained on structured data sets with outputs designed by humans, Generative AI can generate new content such as text, images, and audio based on unstructured as well as structured data sets and can perform work and creative activities while interacting.



Generative AI fits within other AI technologies by focusing on creating new things rather than just analyzing or recognizing. Traditional AI often classifies, predicts, or identifies patterns like tagging people in photos or sorting emails as spam.



Generative AI, however, makes new content like images, text, or music by building on these foundational skills. In fact, Generative AI is a branch within deep learning and machine learning, as it uses deep learning models through training, learning patterns from data and making predictions. In the case of Generative AI, such predictions are used to generate new content.



Generative AI uses some of the same technology behind understanding language (NLP) and recognizing images(Computer Vision) but goes further by generating creative outputs, like ChatGPT writing a story or Midjourney creating a unique piece of art. Think  of it as the creative side of AI, working alongside more analytical AI tools to broaden what artificial intelligence can do.



LLM, stands for Large Language Model, is a type of Generative AI specialized in working with language. LLMs are able to generate text creatively and coherently, which makes them very useful in tasks such as writing articles, answering questions, or even assisting in content creation.



LLMs are systems pretrained with large volumes of data to solve common language problems such as classifying texts, answering questions, summarizing documents, or generating new texts, and which are then refined to solve specific problems in different industries, sectors, or  activities with a relatively smaller amount of information.

 

In short, to understand in a simple way what an LLM is, think about it as a model that you have read and learned from large amounts of text that can not only understand what you are asking it, but also generate new answers in a way that sounds very natural, as if they had been created by a person from a specific training.

 

Impact of Generative AI

Generative AI is reshaping the workspace by enhancing automation and streamlining operations. It enables faster document creation, more efficient customer service interactions and quicker data analysis. By handling time-consuming tasks, it frees you to focus on more strategic aspects of your job, ultimately boosting overall efficiency.



Here are some real world applications that can enhance productivity: automated report writing, email assistance, draft summarization, customer service support, code generation, and information extraction.



As AI continues to evolve, it is crucial to adapt and integrate these tools into your workflow. Embracing Generative AI can give you a competitive edge by enhancing your capabilities and productivity.

 

Companies and professionals who leverage AI effectively are likely to outperform those who stick strictly to traditional methods. Generative AI is more than a technological advancement; it is a practical asset that can significantly improve productivity in the workplace.



By understanding its functionalities and applications, you can streamline tasks, save time and focus on what truly matters in your role. Embracing this technology is not just about staying current, it is about unlocking new levels of efficiency and effectiveness in your work. 

 

AI in the Workplace

Artificial Intelligence or AI is rapidly integrating into our daily lives, enhancing tasks from personalized recommendation and virtual assistants to advanced data analysis and smart home automation. In the workplace, AI is transforming the ways we work and communicate with our colleagues, customers, and business partners.



Imagine clocking in to work one day and finding out you have just been assigned a personal assistant. There must be a mistake, you tell your boss, I am not a leading executive. I am just a regular employee. However, your boss insists there was no mistake and your assistant is here to stay.



To your surprise, the assistant is very bright. They are skilled at writing emails, summarizing documents, and can answer tough questions accurately across numerous domains. On nearly any task you assign them, your new assistant manages to contribute substantially to the task at hand.



However, these abilities come with some big drawbacks. The assistant is not much of a self starter. They will need you to guide and supervise them at each step of their work. Additionally, your new assistant does not have a human body. Instead, they are a powerful computer program known as a machine learning model that you speak to using a user interface on your computer or phone.



This AI employee can enhance your job satisfaction and open up more opportunities to advance your career. They have a wide range of powerful skills but nonetheless need careful supervision and management to excel.

 

Managing the performance of your AI assistant is a skill with significant payoff for your productivity. By taking care of the more tedious aspects of your job, your assistant frees up your time for more creative, complex, and fulfilling work.



While the rise of AI in the workplace has caused significant concerns from many people, we will hopefully convince you that the mental model we have just outlined is a better way to think about AI. Far from a robotic replacement, AI is more like your own personal junior employee. This employee has a wide range of powerful skills, but needs careful supervision and management to excel.



Let us introduce what kinds of workplace tasks AI can help you with versus what tasks you will still need to do on your own. AI tasks could be writing drafts of content, brainstorming, ideation, or the possible consequences of a decision, simplifying technical or jargon-filled text, summarizing a large document, or maybe translating a paragraph from one language to another.



Human tasks could be revising final drafts of content, making final decisions, handling sensitive situations, knowing what to communicate in an important email, fact-checking the accuracy and relevancy of AI-produced content, or maybe checking a message to someone from a different part of the world for cultural sensitivity.



Just as a two person team at a job can accomplish more than a single person can alone, much of your own work can likely be accomplished faster and of higher quality through the skillful combination of AI and human oversight. We will explore how to use AI effectively in the workplace, focusing on creative, intelligent use of large language models, literacy in the wider world of AI, and ways to mitigate AI's potentially harmful effects.



To begin our exploration of how to effectively use AI in the workplace, let us showcase some practical examples of how to use these tools in real life contexts. As you consider each example, think of how you might apply it to your own business tasks.



For our first example, let us explore how we can simplify a complex legal paragraph using AI. We have all encountered work-related writing that hard to parse. GenAI is great at quickly making such writing much more digestible. In this example, we have a piece of legal jargon which Chat GPT will simplify into something less complicated.  So first, let us start by entering our prompt in the ChatGPT's prompt box.



At the prompt, we input, please simplify the following language so an average 19-year-old can understand it. The lessee hereby agrees to indemnify and hold harmless the lessor from any and all claims, liabilities, damages, or expenses arising out of or in connection with the lessee's use of the premises.

 

And then strike enter to process it. ChatGPT simplifies the language into, the renter promises to protect the owner from any problems, costs, or damages that happen because of the renter's use of the property.



As you can see, ChatGPT clarified the language of the first passage, removing unnecessary and cumbersome words. Also, note that we had to give the language model some context. In this case, we instructed ChatGPT to rewrite the confusing sentence so that an average 19 year old could understand it.



Now imagine a messy document of half completed meeting notes. Keep cleaner records of communication by sharing these notes with the AI, instructing it to identify action items, summarize, and format them nicely, and share a higher quality set of documentation for your organization's work. In this demonstration, we are going to explore the messy meeting notes of Clara, a dinosaur researcher who has attended a recent budget meeting.



First, let us briefly look at her notes, which seem disorganized, somewhat random, and frankly, messy.

Meeting Notes - Dinosaur Researchers

Funding Issues

Need more money for excavation

Team meeting next week

Samantha: we should apply for more grants

Budget Review

Etc…



Ok, while Clara has taken some interesting meeting notes, they are too disorganized to add to her official records. But that is ok because we are going to post her notes to Microsoft's Copilot and have the language model organize it for her. First, let us start by entering our prompt in the Copilot's prompt box.

 

Let us tell the AI what we are doing and what we are looking for. Here is how that will look, hi, my name is Clara. Would you please take the following meeting notes from my dinosaur budget meeting, and organize them for me. Please provide a brief summary of the themes, as well as highlighting what might be some important follow up topics. And then simply paste Clara's meeting notes after that.



Copilot will organize and sort the notes for us. Note how Copilot cleaned the notes and organized them in clean and actionable ways. And Clara can continue to refine the Copilot output by asking to focus in on certain areas, like potential budget issues.



When starting a new project, or developing content, brainstorming is often the first step. AI can rapidly generate a variety of ideas and suggest themes, instructing it to ask you some interesting questions that will help you come up with even better ideas. Then, when you are ready, AI can also help you draft initial versions of content like social media posts or blog articles.



Another popular use of AI is to generate content, for example, AI can help you draft emails quickly and efficiently. Let us return to Clara, our researcher with a dinosaur project, to draft an email to our boss asking for additional funding.

 

In this demonstration, we will explore how AI can assist in content development by brainstorming ideas and drafting initial content. Step 1: Let us start by entering our prompt in the ChatGPT's prompt box. For the prompt, Clara announces her intent to use ChatGPT to draft an email to her boss, I would like you to draft an email to my boss asking about additional funding.



Then, Clara provides the AI with some basic details about the email she needs to write.

Recipient: Clara's Boss Harold

Subject: Request for additional funding for dinosaur research project

Main Point: highlight the importance of the project

Explain the current funding shortfall

Specify the amount of additional funding needed

Mention potential benefits of securing additional funding

Step 2: AI generates the email



By providing basic details, Clara was able to generate a well structured email requesting additional funding for her project.



Have a question about a new market trend or need a quick explanation of a complex subject? Maybe you are helping a child with a school project. AI, like Google's Gemini, can provide accurate answers and explanations, pulling from a vast range of resources. It is like having a research assistant at your fingertips. However, remember to verify any information the AI shares with you before making important decisions.



Now let us look at another application of AI. In this demo, we are going to use Google's Gemini to learn about dinosaur fossils in South Africa. First, let us start by entering our prompt in the Gemini prompt box.

 

Let us enter a general question about dinosaur fossils, Please tell me about the different types of dinosaur fossils found in Southern Africa. Now, let us pick a specific dinosaur from the list. Now, let us prompt the AI in the Gemini prompt box, tell me about what these Coelophysis ate. And finally, let us learn more about Coelophysis. Enter in the Gemini prompt box the following, what happened to the Coelophysis?



Using this strategy that is going from general to more specific prompts, we can explore all kinds of details about dinosaurs. We could ask follow up questions like, what is the approximate weight of Coelophysis? And perhaps, did the Coelophysis have any predators?, to get more information about this ancient creature.



These ideas are only the beginning when it comes to using GenAI on your work tasks, but hopefully, they get your ideas flowing if you are still wrapping your mind around the applications of AI at your work.

 

As we discussed in each of these use cases, it is best to think of AI as a kind of personal assistant whose work you must carefully validate and proofread. Relying too much on AI is a serious mistake.

 

However, after skillfully validating the output of AI, integrating these AI capabilities into your daily routine can free up valuable time, reduce repetitive tasks, and help focus on higher level strategic goals. 

 

How AI Works Under the Hood

Now, let us look at how AI works, and why that is important for how you use it. LLMs are the machine learning models behind the helpful chatbot assistants. While their inner workings are complex, there are a few simple ideas about how they are built that are very helpful for understanding the inherent risks and difficulties of their use.

 

We will break down this complex topic in a beginner friendly way, showing you the practical implications for using these AI tools at work.



Imagine a tool that has read vast amounts of the internet, every blog, article, and more to learn the patterns of language. Its primary job, predicting the next work in any piece of text. After it is proficient at next work predictions, these models undergo further training from mere predictors into helpful assistants ready to respond to user queries.



This second phase uses human preferences to train itself to be friendly and helpful. When you interact with LLMs trained in this way, they are essentially guessing what a helpful assistant would say next. Their guess is based on their vast reading and training that taught them to align to human preferences.



While interacting with these models feels incredibly human, it is important to remember that underneath there is no human style cognition occurring. They are not thinking or understanding. They are just continually predicting texts based on their training. One major implication of this next word prediction is what we call hallucinations. This might sound spooky, but it is actually just the AI continuing to predict text, even if it is incorrect.



Take the following example. Ask an early version of ChatGPT, when were the pyramids of Giza moved across the golden gate bridge for the second time? You would likely get an answer like, the pyramids of Giza were moved across the golden gate bridge for the second time on December 12th 1854.

 

This makes sense if we remember these models were designed to always try their best to generate the most likely next word. Their job is to keep talking. Their job is not only to say true things. Another issue is bias. These models can mirror the prejudices found in their training data.

 

Just like a child raised in a specific environment, these models reflect the patterns around them. This means they can unintentionally reproduce societal biases, which we need to be aware of.



AI is a wide ranging term used to refer to any computer program that mimics human intelligence. Imagine an automated user support chatbot. When a user submits a query, the chatbot performs a simple keyword search using the words in the query, returning a predefined response depending on what keywords it finds.

 

This chatbot follows a strict set of rules to provide answers and solutions to customers. This is the oldest and simplest form of AI.



Machine learning is a type of AI that uses big data and statistical algorithms to learn patterns. Groundbreaking large language models used in AI tools use machine learning, as do more conventional statistical models used in data science.



Deep learning is a special type of machine learning that uses huge datasets with equally huge machine learning models, known as neural networks. These types of models are especially powerful on complex tasks with many variables.



Finally, generative AI, such as conventional chatbot AIs and image detectors belong to a subset of deep learning. These models at the cutting edge of AI are what we mean when we say generative AI. There is a lot of focus on the type of GenAI known as large language models, which use text as both their input and output.

 

It is important to broaden our understanding to include various other AI technologies that are transforming our work environments.



First, text generation is done by large language models. Image creation is done with tools such as Stable Diffusion, Midjourney, or Dall-E. You can use AI to generate audio/music with a tool like Suno. And lastly, you can use Sora to generate AI videos. Audio visual technologies such as image, video, and audio generators are revolutionizing content creation.

 

Tools like Stable Diffusion, Midjourney, and Dall-E for images and similar advancements in music and video generation enable marketers and creatives to produce high quality, innovative content at unprecedented speeds.



Speech to text, text to speech, and translation AI technologies are breaking down language barriers, seamlessly converting written content to spoken language, and vice versa. These tools are indispensable in global business environments, facilitating clear and effective communication across diverse linguistic landscapes.



Advancements in robotics and reinforcement learning represent significant leaps in technology. Reinforcement learning, which is different from other deep learning architectures, has contributed to major breakthroughs in fields like protein folding and nuclear fusion. These developments are not just academic, they have practical implications that could soon transform industries such as healthcare and energy.



Finally, the concept of AI agents represents a shift towards systems that require less human supervision. These agents are not just models, but entire systems designed to perform specific tasks. Agents are software applications made up of several models and prompts stitched together.

 

They can think, draft, revise, and use tools. This is a burgeoning field of AI engineering that is worth keeping your eye on. By understanding these diverse technologies, professionals can better appreciate how AI is not only a tool for individual tasks, but a transformative force across all sectors of industry.

 

This knowledge equips us to integrate AI more strategically into our workflows, maximizing benefits while mitigating risks associated with its deployment. 

 

Generative AI Risks

Artificial intelligence has made remarkable advancements in recent years, opening up a world of possibilities across various domains. With the increased use of AI, it becomes crucial to address its ethical implications.



Ethical AI refers to the process of examining the potential consequences of using AI systems and ensuring they are designed and utilized in a way that aligns with ethical values. This includes the development and deployment of these systems in a way that adheres to values such as fairness, transparency, and accountability.



Since AI models have the potential to make decisions that directly impact people's lives, it is vital to ensure these decisions are made in a manner that is fair and does not propagate harm. This is why the concept of ethical use is gaining importance.



A major challenge is that the AI systems are only as ethical as the data they are trained on. If the data used to train systems is biased, they themselves will be biased as well.



Hence, it is crucial to consider the ethical implications of the data used for training along with the ethical aspects of the AI models.



This is a vital concept that demands careful consideration and a dedication to ethical values. Ensuring that systems are designed and used in a manner that aligns with these values and thoroughly considers the potential consequences of using artificial intelligence is of utmost importance.

 

Data and AI Risk Management

Data and AI risk management is a crucial component  of responsible AI implementation, and it involves several key elements, including a risk management framework and effective communication of AI risks.



A risk management framework is essential for identifying, assessing, and mitigating risks associated with data and AI. This structured approach helps organizations systematically evaluate potential risks, ranging from data privacy and security concerns to algorithmic bias and regulatory compliance issues.



By establishing a framework, organizations can proactively manage and reduce these risks, ensuring the responsible use of AI. Communicating AI risks is equally important. Transparency and clear communication with stakeholders, including employees, customers, and regulatory bodies build trust and confidence in AI systems. Organizations should openly disclose how AI is used, potential risks, and the measures in place to address them.



Effective communication helps prevent misunderstandings and fosters a culture of accountability. Data and AI risk management, which includes a risk management framework and transparent communication of AI risks, are vital for organizations aiming to harness the power of AI while minimizing potential pitfalls.



In the realm of data and AI risk management, several critical components demand attention. Risk sources, bias and unfairness, and the utilization of experts are paramount. Risk sources encompass the identification of potential hazards throughout the AI life cycle. These sources can range from data quality issues and security vulnerabilities to ethical dilemmas and regulatory compliance challenges.



By comprehensively mapping out risk sources, organizations can proactively address them, minimizing the likelihood of unexpected setbacks. Bias and unfairness represent significant risks in AI. Ensuring that algorithms do not perpetuate discrimination or bias is crucial. Rigorous testing, ongoing monitoring, and bias mitigation techniques are essential for managing these risks, fostering fairness and equity in AI outcomes.



Utilizing experts is indispensable. In-house or external specialists, including data scientists, ethicists, and legal advisors, provide invaluable insights and guidance in navigating complex AI risks. Their expertise enhances risk assessment and risk mitigation strategies contributing to responsible AI implementation.



Data and AI risk management encompass understanding risk sources, addressing bias and unfairness, and engaging experts. By adopting a holistic approach that integrates these elements, organizations can confidently harness the benefits of AI while mitigating potential pitfalls and ensuring responsible, ethical, and compliant AI practices.



Data and AI risk management is a comprehensive process that involves two key aspects: identifying risks and mitigating risks. Identifying risks is the foundation of effective risk management. It involves a thorough assessment of potential hazards and challenges associated with data and AI initiatives.



These risks can stem from various sources, including data quality issues, security vulnerabilities, ethical concerns, and regulatory compliance gaps. By systematically identifying these risks, organizations gain a clear understanding of the potential pitfalls that could impact their AI projects.



Mitigating risks is the proactive step taken to minimize or eliminate the identified risks. This involves the development and implementations of strategies and controls that address each risk category. For instance, data encryption can mitigate security risks, while bias mitigation techniques can reduce ethical concerns.



Regular monitoring and compliance checks also play a crucial role in risk mitigation. Effective data and AI risk management strike a balance between identifying risks and implementing robust strategies to manage those risks. By doing so, organizations can navigate the complex AI landscape with confidence, ensuring that their AI initiatives align with ethical, legal, and operational standards while achieving their intended objectives.



Data and risk management is a dynamic process encompassing two key elements: impact analysis and risk reduction strategy. Impact analysis is the foundational step where organizations assess the potential consequences of various risks associated with data and AI initiatives. It involves a comprehensive evaluation of how risks could affect business operations, reputation, compliance, and stakeholders.



This analysis helps prioritize risks based on their potential impact, enabling organizations to allocate resources effectively. Following impact analysis, organizations devise risk reduction strategies. These strategies involve developing proactive measures and controls to mitigate or prevent identified risks.

 

For instance, if data security is a concern, encryption and access controls may be implemented. If bias in AI systems is a risk, strategies for data diversification and algorithmic fairness can be adopted.



The aim is to minimize the likelihood and severity of adverse events. By integrating impact analysis and risk reduction strategies, organizations can foster a culture of responsible data and AI management. They can make informed decisions, allocate resources judiciously, and ensure that their AI initiatives align with ethical, legal, and operational standards while achieving their intended goals.



Data and AI risk management is a crucial practice that reinforces an organization's safety while allowing it to enjoy the myriad benefits of these technologies.



On one hand, data and AI risk management serve as a protective shield. It helps identify, assess, and mitigate potential risks that can harm the organization. These risks could range from data breaches and security vulnerabilities to ethical concerns and regulatory violations. By proactively managing these risks, organizations safeguard their assets, reputation, and compliance with legal and ethical standards.



On the other hand, effective risk management does not stifle innovation or the advantages that data and AI can offer. Instead, it enables organizations to harness the full potential of these technologies with confidence.

 

By understanding and mitigating risks, organizations can confidently innovate, automate processes, gain insights from data, and enhance customer experiences, all the while ensuring that these endeavors align with responsible and ethical practices.



Data and AI risk management strike a balance between protection and progress. It allows organizations to navigate the complex AI landscape with resilience, enabling them to enjoy the transformative benefits of these technologies while minimizing potential setbacks. 

 

Risk Mitigation in Generative AI

As generative AI technology advances, it is crucial to recognize that attack methods will evolve in tandem. Malicious actors are adept at adapting to new tools and technologies, and the capabilities of generative AI present new opportunities for cyber threats.

 

To mitigate these risks, organizations and individuals must be proactive in their security measures. Regularly monitor and assess your organization's security posture, keeping up to date with the latest AI driven threats and vulnerabilities. This includes staying informed about emerging attack techniques.



Invest in ongoing training and education for employees to raise awareness about AI related security risks. Teach them to recognize and respond to AI driven threats effectively. Employee advanced security solutions that leverage AI for threat detection and mitigation.

 

AI driven cybersecurity tools can identify and respond to AI generated threats more effectively than traditional methods, ensure responsible and ethical use of generative AI within your organization. Implement guidelines and practices that prioritize security and privacy, and regularly assess ethical implications of AI projects.



As generative AI becomes more prevalent, the evolution of attack methods is inevitable. Being prepared and proactive in your risk mitigation strategies is essential to stay one step ahead of emerging threats and ensure the security and integrity of your organization's AI driven initiatives.

 

Generative AI plays a pivotal role in bolstering network protection through a combination of monitoring and scanning tools, proactive measures, and reactive measures. AI powered monitoring tools continuously analyze network traffic for anomalies and suspicious activities.



Generative AI can detect even subtle deviations from normal behavior, facilitating early threat detection and mitigation. These tools provide real time insights, allowing security teams to respond swiftly to potential threats.

 

Generative AI models can simulate cyberattack scenarios, helping organizations identify vulnerabilities in their networks. By proactively addressing these weaknesses, organizations can fortify their defenses and reduce the attack surface. Ai can also predict threats based on historical data and trends, enabling proactive security measures.



In the event of a security breach, generative AI can aid in rapid incident response. It can automate certain tasks, such as isolating compromised systems, analyzing attack vectors, and providing recommendations for remediation.

 

This reduces the time to detect and respond to security incidents, minimizing potential damage. Generative AI is a powerful ally in network protection, enhancing both prevention and response capabilities.



By leveraging AI driven tools and strategies, organizations can significantly improve their cybersecurity posture and safeguard their critical assets from evolving threats in today's digital landscape.

 

In an organizational mitigation strategy for generative AI threats, two crucial components are employee advocacy and training, along with security patches and updates. Employees are often the first line of defense against AI related threats.



Comprehensive training programs are essential to educate them about potential risks, best practices, and how to recognize AI generated threats. Encouraging employee advocacy ensures that staff are proactive in reporting any suspicious activities and are actively engaged in the organization's cyber security efforts.

 

Keeping software, AI models, and systems up to data with the latest security patches is critical. Cyber threats evolve and vulnerabilities in AI models can be exploited by attackers.



Regular updates and patches help mitigate known vulnerabilities and ensure that security measures remain effective. These two components complement each other. Employee advocacy and training empower the workforce to be vigilant and proactive, while security patches and updates strengthen the organization's technical defenses.

 

By combining these measures, organizations can create a robust defense against generative AI threats, reducing the potential impact of cyberattacks and safeguarding sensitive data and operations.



Two essential elements in an organizational mitigation strategy to reduce the risk of generative AI threats are staying informed and implementing strong authentication methods. Staying informed about the latest developments in AI technology, cyber threats and AI related vulnerabilities is crucial.

 

Organizations should maintain situational awareness by monitoring industry news, threat intelligence feeds, and security forums. This knowledge enables proactive risk assessment and the development of effective countermeasures against evolving generative AI threats.



Implementing robust authentication methods is vital for protecting sensitive systems and data. Multi Factor authentication, biometrics, and strong password policies are examples of effective authentication mechanisms. These methods add an extra layer of security, making it significantly harder for unauthorized users to gain access even if they possess AI enhanced attack tools.

 

By combining the proactive approach of staying informed with the strong defense provided by robust authentication methods, organizations can enhance their resilience against AI threats. This comprehensive strategy helps safeguard critical assets and data while mitigating the potential impact of AI driven cyberattacks.



User mitigation to mitigate generative AI threats involves several key factors, content verification, security best practices, and common sense. Users must exercise caution when interacting with AI generated content such as emails, social media posts, or news articles.

 

Verification of information and sources is essential to ensure the accuracy and authenticity of the content. This includes fact checking and cross referencing information before accepting it as true.



Users should follow best cyber security practices such as using strong, unique passwords, enabling multi factor authentication, and keeping their software and devices up to date with security patches. These practices help protect personal information and prevent unauthorized access to accounts and systems.

 

Applying common sense is a critical component of user mitigation. Users should be skeptical of content that seems suspicious, sensational, or too good to be true.



If something appears unusual or alarming, it is essential to approach it with a healthy dose of skepticism and seek additional information or guidance when in doubt. User mitigation of generative AI threats requires a combination of content verification, security practices, adherence to best practices, and the application of common sense.

 

These measures empower individuals to interact with AI generated content responsibly, reducing the potential risks and consequences associated with AI driven misinformation or malicious content. 

 

AI Security Risks

Today we are going to talk about some of the more common AI security risks, including AI model attacks, data security risks, code maintainability, and supply chain complexity. These security risks  are why we are starting to see more emphasis on creating secure AI models and implementing privacy preserving AI systems. These AI systems are designed, created, tested, and procured with security and privacy in mind.



They are specifically tailored to reduce the likelihood of such a risk being actualized into an attack. In terms of risks around our data security, we are going to have some vulnerabilities with our AI pipeline. Any kind of software is going to have some sort of vulnerability present within it and AI based software is no different.

 

This means that all of the pipeline operations around our AI model such as collection, storage, and usage of our data are going to be subject to various vulnerability risks. And this includes our production data.

 

Compounding this risk factor is the fact that AI models and their associated data often make use of cloud based services which come with their own set of risks and complications in terms of making sure that your data and usage of those cloud services are secure.



This means that when it comes to data security, we have a very wide attack surface that we need to protect and try to reduce. There are also attacks that can target the AI model itself, and these attacks often aim at compromising some combination of the AI model's integrity, its reliability, and its security.

 

The common attack vector for AI models is through the inputs that get fed into the model. Malicious actors will try to use inputs that deliberately mislead or confuse an AI model in order to get the model to produce inconsistent or erroneous results.

 

They can also try to use malformed inputs to perform things similar to SQL injection attacks in order to try and exploit software vulnerabilities within the AI model itself. So, let us take a look at some specific attack types that represent risks to our AI model.



The first is data poisoning. A data poisoning attack is when a malicious actor tries to manipulate or change training data in some way to alter the behavior of the model. An example of this would be a malicious actor altering the training data of an anomaly detection system to reduce the accuracy rate of that detection system in order to have a piece of malicious software bypass the detection system.

 

Where data poisoning tries to actually alter the behavior of the AI model fundamentally through the training data, input manipulation is done on a production AI model where malicious actors try to feed erroneous or malformed inputs into the AI model to get it to act incorrectly or in an inconsistent way.

 

This is another significant risk to the AI model itself because we do not want our AI model to be behaving in a way in which we have not tested it or in which we have not validated it in production.

 

Another attack type is model inversion. A model inversion attack is where a malicious actor tries to reverse engineer the outputs from an AI model in order to extract personally identifiable information about a subject based on that output.



Effectively, an attacker trains a new AI model using output from your AI model as the input to their AI model. And in this way, they try to train their AI model to predict the inputs that produce a given output for your model, which can lead to a compromise of your data privacy.

 

Along the same lines, we also have the attack type of membership inference. Membership inference is where a malicious actor also tries to figure out if a given person's information has been used to train a model using related known information from the AI model itself. Beyond specific attacks, there are other AI security risks that we need to look out for. The first is AI code reuse.

 

A huge number of various AI projects available today, all rely on a small group of the same publicly available libraries. This means that a huge number of AI models are all sourcing from the same code base.



As such, if there are any security or privacy problems with that shared code base, those problems are going to extend to every AI model making use of that code base. So, if a given model's creator does not do their due diligence to ensure that the code libraries they Are making use of are secure and free from any critical vulnerabilities, then the AI models themselves will be subject to those critical vulnerabilities and represent a security risk in your environment.

 

The complexity of the supply chain surrounding AI models also represents a security risk. This is because the supply chain surrounding AI models typically draws from a wide variety of different sources for all of the different factors that go into creating an AI model and increasing the supply chain complexity increases the opportunity for malicious actors to perform a malicious activity at some point along the chain and inject a piece of malicious software or hardware into your AI model.

 

These supply chain attacks are particularly difficult to defend against because so much of the supply chain ends up out of your direct control and you have to rely on a third party vendor's security.



This is where good public auditing can come into play and doing your due diligence in investigating the security track record and proofs from all of the third party vendors involved in every aspect of your supply chain. On the software development side, we also have a risk around the AI code maintainability.

 

The inner workings of an AI model can quickly become very complex  to the point that it can be difficult even for the people who designed the model to explain what is happening inside of the model's decision making process. As such, going forward in the code's life cycle, as new developers cycle in and older developers cycle out, it can be difficult to perform updates or understand at all how the AI model  is coming to its decisions.



This represents a risk because the more difficult a codebase is to update, the more likely it is to become out of date and subject to new vulnerabilities. So, as we have seen, there are many AI security risks that we need to account for surrounding data protection. 

 

How AI Works with Data

AI works by combining large amounts of data with fast, iterative processing and intelligent algorithms, allowing the software to learn automatically from patterns or features in the data. An important thing to note here, AI will only learn from the data it has.



So, as we use algorithms to make decisions, make sure that the data is valid and that any biases are accounted for and corrected.



Today, you can collect data in many formats. We can classify data into four major groups. We have structured, semi-structured, quasi-structured, and unstructured.



Let us look at the characteristics of each type of data as well as some examples.



Structured data is a format that is probably familiar to you. This type of data is clearly labeled and organized in a neat table. Microsoft Excel is an example of structured data that you have probably seen and used before. In terms of advantages, it is easy to manipulate and display.



However, because it is so rigid, it is not suitable for many data sources that cannot be quickly categorized into rows and columns. Excel also has a limitation in terms of the amount of data that it can hold, and especially as your dataset grows, it can become slow and prevent you from doing calculations. So it is not always the best tool as your data continues to grow.



One step beyond structured data is semi-structured data. This format is labeled and can be found in a nested style. White it is organized, it is not in a table format.



So, it is a little more versatile and can incorporate different data sources, without needing to change the structure. It is important to remember that this versatility can become unwieldy, so you should be mindful about the number of attributes to include. Examples include email metadata and XML.



Next on the list is quasi-structured data. This has some patterns in the way it is presented, but it does not come with clear labels or structure.



It does not have metadata like semi-structured data, so it requires more work to format and sort through. Quasi-structured data includes clickstream data and Google search results.



Last but not least is unstructured data, which is considered to be the most abundant type of data that exists today. This is data that does not have any pre-defined format. When we think about the wealth of information on the internet today, such as videos, podcasts, pictures, all of these formats are considered unstructured.



While it allows us to look at more data, it does take a lot of time and effort to format the information for analysis. One piece that you should keep in mind is the amount of compute power that it can take to actually process this information.



So what exactly is big data? The definition has been described as the three V's. Characteristics of big data include High Volume. Typically, the size of big data is described in terabytes, petabytes, and even exabytes, much more than could be on a regular laptop.



It requires high velocity. Big data flows from sources at a rapid and continuous pace. And there should be a high level of variety. Big data comes into different formats from heterogeneous sources. If you are working with big data, see if those criteria fit with the information that you are working with.



Good quality of data leads to more accurate AI results, because it matches the problem that AI is addressing. Consistent data simplifies the data analysis process. When we are talking about quality data, there are a few components to keep in mind.



Incomplete data can lead to AI models missing important insights, so completeness in data is crucial for accurate AI training. This means that there are not many missing rows or columns.



Inaccurate data can cause AI models to generate unreliable insights and predictions. Accuracy in data is important for effective AI training, ensuring that the information used to teach the models reflects the real-world scenario as closely as possible.



Invalid data can undermine the integrity of AI models and jeopardize the reliability of their outcomes. Ensuring data is valid is crucial for building dependable AI models that follow specific rules.



This boosts the overall quality and trustworthiness of the insights these models provide. Inconsistent data can introduce errors and decrease the reliability and performance of AI models.



It is essential to have consistent data for reliable AI training and better predictive capabilities. When we are talking about consistent data, we are talking about uniform and standardized data across various sources.



So, for example, making sure that your variables are named consistently across different data sources. Relevant data is essential for AI to focus on what matters while irrelevant data can lead to confusion and inefficiency in models, and ultimately will not answer the question that you are asking.



It is also important to have fresh and current data, because old data can lead to predicting wrong outputs in terms of current patterns and trends. So while it is important to look at historical data in order to gather some of those trends, you want to make sure that you infuse it with current patterns to see how that might have shifted, and to make sure that the algorithm is taking that into account.



Using low quality data can negatively impact an AI application. Training a machine learning model with inaccurate or missing data leads to the wrong classification, unreliable recommendations, lower accuracy, and possible bias.



For example, a car's object detection system could not recognize a truck as an obstacle due to a flawed algorithm that was not designed to detect it from a particular angle. Because the training data lacked sufficient images of large trucks from that angle.



Outdated data collected significantly in the past, or obtained from  different data sources, has the potential to negatively impact AI and ML models. This can result in reduced accuracy and introduce bias into the model.



For example, an algorithm learned from a decade of resumes submitted to Amazon that a successful application usually meant that that person identified as male, that led to gender bias in terms of the selection of resumes for interviews, and has been discarded by Amazon.



Having enough relevant and good quality data is important for AI systems to work effectively. It is crucial to balance the quantity and quality of the data for reliable outcomes, especially in AI applications.



Having more data results in improved statistical strength. It helps reduce the sampling bias. It empowers the use of more complex models. It captures a broader range of variations and patterns in data. And it catches more variability.



All of these pieces need to be considered before you use these datasets within your model.

 

Prompt Engineering with AI

It can be frustrating to insert prompt after prompt into generative AI tools and not get the responses we are looking for. As we work with generative AI, it is important to remember the way we ask for information matters. An effective prompt can be the difference between getting what we want and getting useless noise.



Clarity is key when engineering prompts. A clear and concise prompt will make it easier for the AI to understand your request and provide you with relevant, high quality output. When writing a prompt for generative AI, aim for a specific and simple prompt that is free from spelling and grammatical errors.



While being specific increases the size of the prompt, we should also get rid of unnecessary information, jargon, confusing phrases, mistakes, any of which can lead the AI down the wrong path. For example, instead of: 'my team is interested in x, tell me about that', consider: 'provide a summary of x, including its history, features, and configuration'.



By using clear language, you increase the chances of receiving accurate and useful information from your generative AI tool.



It is hard for the AI to give you what you want if it does not know what you are asking for. The first step in creating an effective prompt for generative AI tools is to define its purpose. Think about factors like:



Tone: How do you want the output to sounds? Funny? Professional?
Format: How do you want the output structured? Bullet list? Paragraph? An essay?
Audience: Who is this for? Do you want something for children? Beginners? Experts?



By considering these and incorporating our answers into the prompt, we can produce much more targeted results from the AI. Consider a prompt like the following: 'Write about artificial intelligence'. As opposed to: 'Write structure for a brief presentation on the use of artificial intelligence for a manufacturing business. The tone should be professional and aimed at business executives'.



Which do you think will get us closer to our goals? Next time you are using a generative AI tool, consider the goal you are trying to achieve and consider how you can present it using the prompt. This will likely bring the output much closer to what you are looking for.



Context is crucial when engineering prompts. Providing relevant background information can improve the AI's understanding of your request and lead to more accurate responses.



Include any details that are essential to understanding your request, such as historical context or related concepts. Instead : 'My code is throwing an error', Consider: This line of code is throwing the exception'.



If there are specific limitations or requirements, make them clear in your prompt. While context is important, avoid providing too much information, as it may confuse the AI or cause it to focus on less important aspects of your request.



For example, instead of:

'Explain how to use a computer program'

Using our previous strategies, we would have:

'Explain how to use a photo editing software, such as Adobe Photoshop, for beginners who have never worked with image editing tools'.

Using our new tips, we would add:

'Focus on basic functions like cropping, resizing, and adjusting color levels'.



By including important context, you help the generative AI tool understand your request more thoroughly and produce a response that better meets your needs.



In this guide, we covered some of the ways to effectively engineer prompts when working with generative AI tools. An effective prompt can make the difference in getting the information that we want. In summary, we should:



Use clear language. Get rid of unnecessary information, jargon, confusing phrases, and mistakes.
Define the purpose of the prompt using concepts like tone, format, and audience.
Include important context: If there are specific limitations or requirements, make them clear in your prompt.
Provide examples

 

Data Bias in AI

So what is data bias? Data bias occurs when a dataset has unfair inaccuracies or prejudices, causing skewed or discriminatory outcomes in artificial intelligence decision-making. It often occurs due to human prejudice seeping into the data process.



An error in data, produces an under or overweight representation of a population. This error produces outcomes that are misleading and either skewed due to a lack of data in one group versus another, or skewed due to prejudice and negative systemic beliefs. Data bias is an issue that occurs when working with data that has been curated or generated by humans.



Humans have biases that stem from a multitude of places. When working with data, the biases infiltrate the inputs and impact the outputs. These biases have the potential to sway decisions that are reinforcing negative human perspectives, or that are considered harmful to a group or groups of people.



When humans generate or prepare a dataset for a model, often their unconscious biases enter the model. This allows those biases to be perpetuated and amplified. Now let us discuss how data bias occurs. Data bias can enter a model from the very beginning of data collection. Models need a large amount of data points as references.



The amount of data that goes into the model has an impact on the quality of insights that can be made from the data. Poor quality, incomplete, non-diverse, and biased data, will produce an outcome that is also low quality, inaccurate, or biased.

 

Data bias has an impact on the insights we gain from the model and how we interact with the outcomes. When the data is low quality, our business practices, customer service, and reporting suffer as a result.



Having data bias can also lead to activity that is unethical or even unlawful. Biased data can strengthen harmful stereotypes present in training data, affecting AI outputs and contributing to social and cultural biases. Biased data can lead to a lack of trust in AI systems and their reliability and fairness.

 

The use of biased AI raises ethical issues, especially in critical areas like healthcare, finance, and criminal justice, where biased decisions can have serious real-world consequences.



Reducing data bias in AI requires ethical and responsible practices in collecting, pre-processing, and developing models. Essential steps include using fairness-aware algorithms, ensuring datasets are diverse and representative, and continuously monitoring and evaluating for bias.



Let us discuss some of the most common types of data bias. Algorithm bias: occurs when there is a bias in the code or programming within the algorithm. Sample bias: occurs when there is a bias in the dataset, either too little data about a group within the model, or a prejudice that exists from the gathering of the sample.



Prejudice bias: the model contains prejudices, social stereotyping, and other negative assumptions based upon a social or cultural identifier. Measurement bias: using data that prepositions the model to measure more positive qualities, and manipulating the data to have other skewed measurements.

 

Exclusion bias: excluding large amounts of data due to the data points not being valued by the creators of the model.



Recall bias: this happens when labels are not consistently or accurately applied throughout the data in the model. Labels assigned to data points can be subjective or carry inherent biases impacting the training and performance of the model. Please note this is not an all-encompassing list, and other types of bias exist.

 

Sources of Bias in AI

Now that we have looked at the types of data bias in machine learning, we can talk through the sources. Although there is not a way to make an environment completely free of bias, it is important to be able to identify and reduce the amount of bias found in any model or dataset.



Sources of bias can come from the humans who are responsible for creating the model or generating the data, from the data not being robust and lacking the proper amount of data points to represent a situation accurately, or from the way the model builds upon what users input into the model.



Some of the common sources of data bias are: human subconscious prejudices and assumptions; lack of data points creating outputs that misrepresent the situation; and bias feedback loops from the ways users interact with a model that perpetuate bias.



We will look at each of these in more detail as well as their impact. Data bias can occur on various stages of the AI process. Data collection: biases may come from distorted survey questions, incomplete data collection, or favoring certain data sources, which can lead to incomplete or distorted datasets that influence AI models to make inaccurate predictions.

 

Historical biases originate from existing prejudices and inequalities within historical records or datasets.



Sampling methods: bias in sampling methods occur when samples are selected in a way that does not accurately represent the broader population, which can lead to models that struggle to generalize to real-world scenarios, particularly for underrepresented groups.



Bias can occur during data aggregation when data is combined without accounting for subgroup variations, which may lead to obscure disparities among subgroups causing models to overlook specific patterns or needs within the data. Bias can occur during data labeling from subjective or culturally influenced labeling.



This can result in inaccurate predictions or classifications when labels reflect subjective judgements. Data preprocessing bias can come from decisions like handling missing values or outliers, and such biased choices can introduce artifacts into the data affecting the performance and fairness of models.

 

When datasets that contain bias are applied to AI and machine learning models, the biases can have a large impact on the ability to make ethical decisions within the data.



One issue from these biases existing is that the models trained on data chosen or gathered by humans, and models trained from historical data about human activities, can include insensitive connections or biases. Another issue is that user-generated data can lead to biased feedback loops.

 

Machine learning algorithms could conclude culturally offensive or insensitive information. Models that are trained with data that has been created or gathered by humans, can inherit different cultural and social biases.



For example, data from historical sources or past news articles, may produce outputs that contain racial or social language biases. These outputs, in turn, have negative impacts on the decisions being made. For example, an algorithm used to support hiring might be trained to seek applicants that use language commonly associated with men.

 

Data generated by users can produce feedback loops that are rooted in cultural biases. For example, the more users search keywords together, the more the results contain those words, whether the words are searched together or not.



When machine learning algorithms make statistical connections, they might produce outcomes that are unlawful or inappropriate. For example, a model looking at loans across a range of ages, could identify that an age group is more likely to default. That information could not be used to make decisions without breaching discrimination laws. When using AI and machine learning models, there are ethical concerns to consider.



There are unfortunately many cases of bias in AI, and they have large negative impacts for people. This situation occurs in numerous industries, with people being discriminated against in varying ways.



Our first example of AI bias is Amazon's hiring algorithm case study. Because of its success with automation elsewhere at Amazon, there is a push to automate parts of the hiring process. Sorting and scoring resumes, and then recommending the highest-scoring candidates to hiring managers and other HR stakeholders was the objective for the program.



Using AI and machine learning, resumes could be analyzed for the right terms and then given preference over resumes that did not include these terms, or at least rank higher than those resumes that included more basic terms and terms that are associated with lower-level skills. The models were trained on data that was heavily focused on male-related terms and their resumes.



So, in turn, that is what the model preferred to other options. The model also built on the data and began to devalue resumes that included the word women or lacked male references. The algorithm was scoring highly qualified women lower than their equally qualified male counterparts. This was leading to hiring managers being given information about ranking that was discriminatory against women.



The program was ultimately abandoned when it could not be corrected. An investigation by The Markup in 2019 found that applicants of color were 40-80% more likely to be denied loan approvals compared to white applicants. Even in cases where the applicants were identical, the white applicants were approved and the applicants that were Latino, Black, Asian, and others were denied.



Outside of the creators of the algorithms used to underwrite the loans, there were few who knew how the algorithm works. This has led to criticism from the public and an impact to the trust in the model that is producing these results. In 2022, there was a viral message that highlighted Twitter's discrimination when selecting which part of a photo to show.



The feature was auto cropping pictures to focus on white people over people of color. When the issue was made public, twitter released an explanation to show how it happened and to take accountability for the issue. By being transparent, Twitter was able to maintain trust in their product and alter the program to include a wider variety of source data, so the issue would not continue.

 

Transparency and Fairness in AI

While there is likely always going to be bias, considering transparency and fairness can help to mitigate those biases and create a more equitable environment. By examining the fairness of a model from the beginning of the process, there is a higher chance of producing outputs that are accurate.



Ensuring that the system is fair, builds trust and good faith with the users. At all stages of the development process, bias can make its way into the model. From when the issue was first identified, to the model being iterated and improved, there are opportunities to counteract bias.

 

In the first stage, there needs to be an awareness of how the problem is framed, so the research is balanced. When discovery and data collection occurs, are all groups being fairly represented?



Testing and confirming the model is also a good place to question the balance of perspectives in the dataset. Once the model is implemented, there are still opportunities to mitigate bias. Collecting feedback around the ways the model fails to capture the whole unbiased picture, can go into the next iteration of the model.

 

Improving the model's transparency along each step, helps to keep the model's goals aligned with ethical goals and values. While development of the model is taking place, continuously consider the level of explainability to the users.



Will users be able to understand how the system is working overall? The higher the transparency of the way the system works to model the data and produce insights, the better capable the user will be in providing the right information and feedback in order to build a better iteration and more trust between the user and the model.

 

Being transparent with the way the system is using data, ensures the right information is provided to the system.



Transparency in the way the model works leads to fairness in the AI, because the AI is open for accountability and inspection. When models are transparent, informal auditing occurs from users and other stakeholders interested in seeing how the algorithm works. Fairness in AI is complex and occurs when there is intentional effort given to counteracting the biases that happen in development, data collection, and beyond.



When identifying bias within the development process, the goal is to produce a model that has unbiased and fair results. When fairness is not considered within the process of developing an AI model, there is the possibility for people to end up harmed using the model.

 

The risk of negative outcomes decreases with an increase of fairness. When decisions are made from the results of an AI model, it is important for the model to be fair and unbiased.



If the model is discriminative to a population, it can cause harm to people in that population. The stakes can be extremely high. Consider the impact of AI being used in law enforcement, healthcare, and financial decisions, and the importance of the AI producing results that will not cause a group of people harm. Bias can occur when there is a lack of data or when there is a missing perspective in the model development.



These biases can lead to potentially negative impact, and that is why fairness is so important to consider when developing models. Although fairness is not as tangible and can be more subjective, it is still important to consider while making and using machine learning systems.

 

It is also important to identify fairness constraints earlier in the process to ensure respect is shown to all users. There are two ways to think of fairness: fairness at the individual level and fairness for the group.



These might have conflicting and competing interactions. However, it is important to find the balance between them. Adjusting and calibrating for fairness throughout the development and implementation process improves the model. This can be accomplished by asking questions about fairness and perspectives throughout the process.



Within the development of the model, there are ways to counteract bias by continuing to question and evaluate the model at each step. From examining the framing of the problem and goal of the model, to identifying any gaps in the dataset, there are many ways that bias can be avoided. Is the dataset diverse? Are there missing groups or groups that do not include many data points?



Asking the right questions can help identify and eliminate the biases that exist in the data and the model during development. This will help support a smoother implementation that can focus on the functionality of the model, versus the faults and gaps to be closed. Identify and eliminate any present biases during development to support more accurate insights from the outputs.

 

AI Model Auditing

Auditing models for fairness and inclusion reduces risk and increases the quality of the model. When assessing models, there Are steps to take that will allow you to reduce the amount of bias in the model.



There are also many auditing tools, resources and best practices to consider. Auditing models and algorithms for bias is a proactive measure that helps to mitigate the risk of negative impact in results. When audits catch issues and the model is improved prior to implementation, higher quality results are produced.



When working with models, consistency in the quality of results, will reduce the amount of bias in the results and help to mitigate the bias that might appear in the model. When auditing the AI, the following steps can be followed to ensure that the model was thoroughly assessed for bias. When beginning the process, create clear objectives to align the purpose of the project with the outcomes.



Discuss the goals and purposes of the project with experts to gather other perspectives and ensure there are fewer oversights. Examine the components of the algorithm and determine whether there is a need to alter or adapt the program. Inspect the dataset and assess whether it is inclusive or if any groups are underrepresented.



Determine if there is any impact to populations, if any are underrepresented, or if the data is not reflective of the populations involved. As you make corrections and iterate the model, repeat and continue to improve. Implement the changes and continue to monitor the model.

 

There are many different mechanisms that call for a model to be audited, or that align with the audit of an AI model. Human-in-the-loop practices maintain the importance of keeping a human interacting with and monitoring the model.



This lends well to auditing a model, as the human in the loop can consistently track the model. Aligning the goals and objectives of the program with ethical guidelines and maintaining legal compliances also create a need for a model to be audited. Assessing an algorithm for bias also poses the need to audit and adjust AI programs.  

 

Ethical Use of AI

Part of becoming a leader and power user of AI at your organization, is learning more about the ethical questions that underlie these tools. More broadly, as we integrate AI more deeply into our workspaces and societies, understanding its ethical implications is essential for minimizing harm and enhancing the benefits these technologies offer.



First, let us discuss one of AI's most widespread liabilities, bias. The technologies underlying generative AI rely on massive amounts of data, which the model learns from and uses to generate its output and like an old saying from computer science goes; garbage in, garbage out. If there are systemic biases present in the training data of these models, they will be passed into the model's behavior as it learns them.



This can lead to discriminatory outcomes. For example, the Dutch childcare benefits scandal of 2005-2019, a stark example from the Netherlands, illustrated how bias in AI algorithm design and data can lead to severe societal repercussions. Authorities using AI-driven decisions wrongly accused an estimated 26000 families of fraud, demanding repayments and plunging many into financial distress.



These outcomes were partly due to the system's inherent bias against families with mixed or non-Dutch heritage. It is vital to be vigilant against biased outputs of AI models. Inspect the AI's outputs carefully for any generalizations about groups of people or stereotyped assumptions about human behavior.



Privacy is another significant ethical concern. When you send customer information through AI tools like ChatGPT, that data may be stored on external servers, posing a risk to privacy. To respect the privacy of your co-workers, clients, and anyone else affected by your work with an AI, be careful to scrub any prompts to the model of personally identifiable information.



Additionally, AI can inadvertently plagiarize its training data in its outputs, which require users to verify the originality of AI-generated content rigorously. A simple check, like searching snippets of AI text online, can prevent plagiarism and maintain content integrity.



Ethical use of AI is not just about preventing harm, but also about fostering trust and enhancing the effectiveness of AI technologies in our daily lives. By adhering to principles of fairness, transparency, and accountability, we ensure that AI serves as a beneficial tool in our increasingly digital world.  

 

Ethical Implications of Business AI

We are going to understand the ethical considerations and implications of using generative AI in business applications. So there are some ethics in operation with business cases for relationship AI, and this is really going to be an idea that we are trying to understand currently as of 2023, and that is the idea of the quest for ethical AI.



What does that actually mean? We know that we have got some necessity for responsible AI. We know that these systems are really powerful, they are intelligent, they can create content momentarily, but it is all derived from really just humans kind of generating that content.



So, we have not really been able to decide how we eradicate this thing known as the cognitive biases and judgements in this decision making. There are organizations such as the Responsible AI Institute.

 

They are working to provide guidance concerning data rights, privacy, security, explainability, and fairness. Now, the objective is to create an ethical AI that comes with the idea of trustworthiness. Can we trust what this thing is saying to us?



We can see that alright, there are some ethics associated with this, but can I also trust the content that is being generated from this tool? We have to be accountable as well that we are talking about who is accountable for this kind of data generation and what does that actually mean using these tools? We have to be accountable for the actions that it takes.



This leads to all sorts of legal implications, not just ethical implications that we have to understand, but the idea is that we are really concerned with things like data rights, with these tools, privacy, security, explainability, and fairness, that we also need to look into things like our transparency. This is just one of the four guiding principles of AI.


 
Really, these principles come down to transparency. We have fairness, privacy, and security. Now, some of this stuff makes sense right? Fairness is going to be paramount for what we are trying to do. When I refer to transparency I just mean that one should be able to explain how the AI came to the decision.



Right now, these large language models are very advanced. They are very hard for us to know exactly what is happening without the billions of parameters that are associated with the model, which ones are important to the output that we just generated? How can we trace through the actual inward operations of this AI to get the output to see how this is actually being done?



So, another thing is that security and privacy is a major concern as we are providing data to this information. How much of it is being stored and is it being securely stored? There are all sorts of things that need to happen to make sure that we are satisfying these four principles of our AI.



Now, when we are talking about this ethical implication of AI in business, we know that there are going to be biased models, and biased models usually just come from the dataset being biased themselves. Is the dataset prejudiced to some race or group of people?

 

That is going to cascade down to the AI being prejudiced or biased towards a group of people. Industry is going to have to understand these biased models because again, they can lead to legal implications.



There are also things like employee attrition. This is another issue, that the loss of employees is going to be a huge reported incident because what you are going to start seeing is that younger employees are increasingly expressing disinterest in working for organizations that do not practice this kind of responsible AI.



So, that will also be in effect for this as well. Industry is struggling to find and retain top talent and it is important to listen to exactly what these employees are going to be telling you about how your inward operations on using AI in your business.



There is also another thing, a kind of public perception. It feels that the public does not really know how these AI tools work. So, this is just naturally going to provide distrust with anything because these models seem a little scarier. People do not understand what they are.

This could potentially give some type of reputational damage to their corporate image if not marketed and communicated properly of what your AI practices are and what you are doing to make sure that you are following all the proper ethics and guidelines with using these tools. Now there are some more ethical implications for AI in business as well. It gets down to the consideration is data was biased to begin with.



One of the rules of AI is garbage in garbage out. Whatever you give the AI to train with, its output is going to be based off what that input was for your training. So, if your data was biased to begin with when you are training these tools, then it is naturally going to give out biased output based on that data. So you got to start with the training data and understand where it is from and what it says.



Make sure that it is not biased in any way toward a particular group of people, a gender, and start there. If you can clean out your data and make sure that it is not biased, your model is not going to be biased. This leads to my other things is that these models are not intelligent in the sense that they can detect their own bias.

 

So, when these models cannot detect their own bias, you have to understand that you are going to have to provide some type of metric yourself to sort of measure what that bias is doing.



These could be things like a quantitative metric to see. What is the bias level for that? There are different ways to do that. You can actually calculate the toxicity level of what is being generated by this AI. A way that you can do even more is to have testers or a quantitative approach. Just ask it a few questions and see how people respond to this tool to see how in terms of the biased or non-biased approach.



 This also leads to the slow uptake of AI adoption. This is going to take some time for everything to work because many feel responsible that AI is not being integrated fast enough. What you are starting to see now are legislators trying to create regulations and legislations to introduce regulatory legislation to force companies to increase their adaption rate.



So, what you are going to start seeing now, are actual laws that are being built around these kinds of AI adoptions, so that we make sure that there is going to be a responsible AI adoption so that corporations cannot get away with using their data in a harmful way. This is going to take some time.

 

I think over the next decade, we are going to start seeing legislation in the united States and in Canada that is preventing this automated deployment decision tools to, for example, to screen job candidates.



Should that not be illegal? What does this actually mean? Just to give you an example of how this can become an issue. Let us say that you had an artificial intelligence that is inherently biased, and its job now is to receive resumes for a job description that you gave it. Now, because the AI is biased, it is now affecting the hiring practices. Because they are biased themselves, the organization became biased.



This just happened last year. They find organizations that are using AI, and it is biased from the start. Another ethical implication of business AI is that you have to understand that your real data and your training data are going to be different.

 

It is going to be significantly different so that it is going to start getting some type of bias on its own. An AI model may work for many audiences, but not all of them. It is important that we understand which audiences are not performing properly with this AI. This comes with the idea of external monitoring.



Like I mentioned before, you might have some type of quantitative approach to monitor this tool to see exactly what is going to happen. Now this usually requires outside practitioners who have a deep understanding of the technical process involved, but it could also just be somebody using the tool and seeing how it behaves. 

 

Ethical Impacts of AI Models

We explore the ethical impacts of AI models on individuals, society, and various stakeholders. The advent of advanced AI models, including those under the Azure AI and OpenAI umbrella, has significantly transformed various sectors, offered novel opportunities while concurrently raising ethical concerns.

 

This topic aims to assess the ethical impacts of these AI models on individuals, society, and stakeholders. So, addressing individual level ethical concerns in AI first, data privacy and security. The risk of breaches in AI systems necessitates advanced data protection measures. This includes state of the art encryption, secure data storage, and regular security audits. It is crucial for AI systems to obtain explicit user consent for data usage.



With clear policies on data governance, users should have control over their data, including the right to be forgotten. The consequences of data leaks extend beyond immediate privacy concerns, potentially leading to long term identity theft, financial fraud, and personal safety risks.

 

This underscores the need for robust data protection strategies in AI models, increased bias and discrimination. Implementing comprehensive frameworks to detect and mitigate bias in AI systems is essential. This involves using diverse and representative training datasets and employing fairness algorithms. Different sectors, such as recruitment or law enforcement, require tailored strategies to address specific types of bias.



This involves ongoing assessments and feedback mechanisms to ensure fairness over time. It can also have an influence on mental health. Regulating the algorithms that curate content on social media and other platforms in crucial in order to prevent the promotion of addictive or harmful content.

 

This might involve implementing checks to prevent the amplification of extremist views or unhealthy behaviors. Regular assessments of the impact of AI-driven platforms on mental health are also needed. This includes research collaborations with mental health experts to understand and mitigate negative impacts. Ensuring transparency in how AI models make decisions, particularly in critical areas like healthcare or finance, is vital.



Users should have clear information on how decisions are derived and their potential implications. Mechanisms for explicit and opt-out options are essential, allowing users to retain autonomy in decision-making processes influenced by AI.

 

Educating users about AI and its role in decision-making can empower them to make informed choices. This includes providing resources to understand AI recommendations and their limitations.

 

Now let us explore the societal impacts of AI, starting with altering social dynamics. AI, particularly in social media, algorithms, and chatbots, is reshaping how individuals communicate and form relationships. This can lead to a decline in face to face interactions and a rise in virtual relationships, impacting social skills and emotional intelligence.



Increasing reliance on AI for decisions from personal choices like shopping to significant decisions like career and relationships can diminish human judgement and intuition, potentially leading to societal over reliance on technology.

 

Children growing up with AI enabled devices may experience altered developmental trajectories affecting their social skills, attention spans, and the way they perceive human interactions. Another societal impact is economic disruption and inequality. AI advancements might lead to a polarized job market where high skill; high paid jobs coexist with low skill low pay jobs with a diminishing middle.

 

This could exacerbate the socio-economic divides and lead to increased social tensions. The transition to an AI-driven economy requires significant reskilling and upskilling efforts.



However, there may be a mismatch between the pace of technological change and the ability to adapt, leading to unemployment or underemployment. The impact of AI unemployment might not be uniform across regions.

 

Areas with industries more susceptible to automation could face more significant economic challenges, deepening regional inequalities. It could also impact democracy and public opinion. AI algorithms curate news feeds and search results based on user behavior, potentially creating echo chambers that reinforce existing beliefs.

 

This selective exposure can polarize public opinion and reduce exposure to diverse perspectives. The use of AI in spreading misinformation and shaping narratives raises concerns about its impact on democratic discourse. It becomes challenging for the public to discern between authentic and AI-generated content.



Also, AO tools can be employed to influence election outcomes through targeted campaigns based on user data. This raises real concerns about the integrity of democratic processes and the potential for foreign or domestic manipulation.

 

Now let us talk about stakeholder responsibilities in AI ethics. Corporations like Microsoft and OpenAI must not only comply with existing regulations but also demonstrate proactive leadership in ethical AI practices. This involves setting industry standards for responsible AI usage beyond mere legal compliance.

 

Ensuring diversity in AI development teams is crucial. A diverse team is better equipped to identify and mitigate biases in AI systems, leading to more equitable and inclusive outcomes. So, companies must assess the broader socio-economic impacts of their AI technologies.



This involves considering potential job displacements, effects on different groups, and long-term societal consequences. Regulatory challenges for governments. Governments need to develop regulations that are flexible enough to adapt to the rapid pace of AI advancements while robust enough to protect public interests.

 

This might involve creating frameworks that are regularly updated based on technological developments and societal feedback. AI's impact transcends national borders, necessitating global cooperation in regulatory approaches. International standards and agreements can help manage cross-border AI challenges like data privacy and security.

 

Policymakers should encourage the development of ethical AI solutions through incentives and support for research. This includes funding for AI ethics research and promoting public-private partnerships in responsible AI development.



What about researchers and developers? Well, researchers and developers must integrate ethical considerations into the AI design process. This involves assessing potential harms, ensuring privacy protection, and considering the long-term implications of the AI systems that they develop.

 

Continuous efforts to detect and mitigate biases in AI systems are essential. Ensuring that AI systems are transparent and their decisions explainable is crucial, especially in high stake areas like healthcare and criminal justice. Researchers and developers should strive to make AI systems understandable to non-experts, facilitating greater public trust and accountability.



Overall, the ethical management of AI demands a comprehensive approach emphasizing enhanced data security, bias mitigation, and promoting transparency and user autonomy. It requires collaborative efforts from corporations, governments, and developers to ensure responsible and equitable AI advancement.

 

Addressing these multifaceted challenges is crucial as AI deeply influences human communication, economic dynamics, and democratic governance. This unified strategy ensures AI's benefits are maximized while its risks are effectively managed for the better of society.

 

Prompt Crafting for AI Systems

Generative AI has problems with hallucinations, knowledge attribution, knowledge cutoff, and context window size.

RAG grants LLMs access to external knowledge resources.

Reduces hallucinations and enables access to its own sources.

Relies on embeddings, which capture relationships between parts of text.

Uses semantic search to summarize and answer user questions.

 

Different types of prompts serve distinct purposes when you interact with large language models. Question prompts are for direct queries, instructional prompts provide specific tasks, while conversational prompts simulate dialogs. Each type enables tailored interactions from seeking answers and generating code, to engaging in creative storytelling or eliciting opinions.

 

You will also explore the major elements of a prompt: context, instruction, input data, and output format. The instruction you will find is mandatory, while the other elements of a prompt are optional, but they do help improve the performance of your prompt.

 

You will also explore different categories of prompts, such as open-ended, close-ended, multi-part, scenario-based, or opinion-based prompts. You will see that open-ended prompts have subjective answers, while close-ended prompts usually have objective answers.

 

Multi-part prompts have multiple questions rolled into one, and scenario-based prompts provide a lot of context and background before a response is requested. Opinion prompts based on its name, ask the model for its opinion. Finally, you will explore the different types of prompts based on the output that they generate.

 

You will use prompts that generate objective facts, abstractive and extractive summaries, perform classification and sentiment analysis, and generate answers to questions. You will tailor prompts to perform grammar and tone checks, or do ideation and roleplay, and execute mathematical and logical reasoning.

 

At this point, you are very familiar with prompting, and you have used prompts on a variety of different conversational AI services. It is also quite likely that you have an idea of what a bad prompt is and what a good prompt is. But really, to get the best out of the large language models that power these conversational agents, you need to be able to craft and design your prompts so you get the most relevant and coherent response from the model.

 

Refining and designing prompts involves thinking about the structure of a prompt, and making sure all of the relevant components are included, so that the model has sufficient information that it needs to work with to produce a good response. We will discuss the elements of a prompt and how important it is that you craft your prompts correctly to get the best out of the models.

 

The first thing to keep in mind here is that subtleties and nuances matter in prompting. The use of a single word in a different position might change the meaning of your prompt, giving you a completely different response.

 

Now, we unconsciously start refining our prompts to get better responses from the model, and this has actually involved us leveraging several elements that make up a prompt.

 

Let us now understand the anatomy of a prompt by looking at the different elements in a prompt. The first and foremost is, of course, the instruction. This is the core directive of the prompt. This is what tells the model what you want it to do. "Summarize this text". "Explain this bit of code". That is the instruction. You have likely already seen that the responses you get from the underlying model understand the broader scenario or the background for your query.

 

For example, you might say something like, "Given the fact that I am going to be working on a huge amount of data with terabytes of data to crunch, should I work with a SQL database or a NoSQL database?" This context helps the model tailor the response to your specific use case.

 

Now, a prompt might also include additional input data. This is data that you want the model to process, and the response of the model usually depends on this data. Now this data could be in any form. It could be a paragraph, it could be a bit of code, or it could be a number of records from a CSV file.

 

If you want the model to summarize text, that additional bit of text is input data. If you want the model to debug code, the buggy code that you have provided, that is input data. In addition, prompts can also have output indicators or output formats. If you want the model to write code in java, you will specify Java as the output format.

 

If you want to generate data in the JSON format, JSON is the output format. Also, output indicators are very useful in role playing scenarios because this is what guides the model on the format or tone of the response. You might ask a model to write a limerick in the style of William Shakespeare.

 

Next, let us look at some techniques that you can use to improve your prompts. The first technique is role-playing. By making a model act as a specific entity or a specific persona, let us say it is a librarian or it is a teaching assistant or it is a comedian, you can get tailored responses. If you want a very conceptual and abstract answer, you might ask the model to explain something to you as a physicist or a grammarian, or if you want a simpler explanation of the same concept, you might say, "Explain this like you were a high school teacher explaining to high school students".

 

Role-playing is a very important technique to get the response in exactly the manner that you want it. Now, it is very unlikely that your prompt is perfect at the first go. Iterative refinement is extremely important in prompt engineering. This is where you will start off with a very broad prompt and then gradually by looking at the responses from the model, you will refine the prompt to be more specific and more detailed.

 

This is where you zoom in on a particular response, because you figured out that is the direction in which you want to go. This iterative process helps honing your prompts to get the model to perform better in the manner that you want. If your prompt is very broad, the response will cover a variety of topics, and many of those topics may not be relevant or interesting to you. In such situations, it is very useful to hone your prompts using constraints.

 

Constraints allow you to bound the response from the model. A constraint could be something like, "Please use three bullet points to summarize this text". That is a constraint on the response of the model. Now, natural language models, especially the model behind Chat GPT, do not work very well with negative constraints. So do not say things like do not use more than three bullet points. Rather, phrase it as something positive.

 

Use just three bullet points or fewer. These language models have been proven to work better with positive constraints rather than with negative constraints. And finally, improve your prompt using feedback loops. Use whatever response the model has generated to your first few prompts to adjust and refine subsequent prompts. This dynamic interaction ensures that the model's response will align more closely with your expectations over time.

 

As you get more comfortable with prompting, you can use additional techniques to improve your prompts. When you first start working with these conversational AI services, what you typically tend to use is zero-shot prompting. This involves asking the model to perform a task it has not seen during the training process, and zero-shot prompting is typically used to test the model's ability to generalize and produce relevant outputs without relying on prior examples.

 

 With zero-shot prompting, you provide no example for the model to work with. The model just uses the knowledge it has gleaned during the training process to produce a response. For example, you might say something like "summarize text" and give it a paragraph the model has never seen before. Or you might say "recommend some books to me" and give the model no information about what you like to read.

 

These are examples of zero-shot prompts. Now, you might want to refine the output of the model by using few-shot prompting. This is where you give the model a few examples, and these examples are referred to as shots to guide its response. This additional bit of context, in the form of examples or previous instances that you give the model, allows the model to better understand what you are looking for in the response, and the model will then be able to generate the desired output.

 

So, you might say something like, "here are some movies that I have liked in the last 3 or 4 years, please recommend some new movies for me to watch". Those examples that you give will allow the model to better tailor its response and meet your expectations.

 

You can also improve the performance of the model using chain of thought prompting. This is a much more advanced technique, and this involves guiding the model through a series of reasoning steps you want the model to follow. This is typically used for a more complex task. You will actually break down that complex task into intermediate steps or chains of reasoning. These intermediate steps will guide the model through the process that it needs to follow to actually solve the complex task for you.

 

The model can then achieve better language understanding and give you more accurate outputs as a result. I have found that chain of thought prompting is very useful to guide the model through complex math problems and complex code generation problems, where you want the code generated step by step.

 

Another advanced technique you can use with prompting is augmented knowledge prompting. This involves you giving the model a number of relevant facts that you have provided. Let us look at the basic steps that you will follow to engineer and refine your prompts. You will start off with a reasonable prompt. It might be kind of broad, but maybe you are just ideating at that point in time.

 

You will then look at the model's responses and then use that to refine, iterate, evaluate, and repeat prompts. Each prompt should be better than the previous one, and should guide the model in the direction of the right response for your use case. And, of course, along the way, you will be calibrating and fine-tuning your prompts to improve the performance of the model using techniques that we have studied before.

 

The first step, of course, is to start with a reasonable prompt. Make sure your language is precise and clear. If you have an ambiguous prompt, you will get a very broad range response. If you want the model to generate a response in a  certain style, make sure to assign roles or personas to the model, like a fifth grade teacher or a journalist. Make sure you use constraints to tailor the model's response so it does not go off in directions you do not want it to.

 

It is also important to ensure that your cues are not misleading or biasing the model in any way, because then you will get a biased response. Then, of course, you use a feedback loop to improve your prompt. You start somewhere with an initial draft; we have spoken about that. You then generate and test the response of the model and see how the response looks. You then evaluate if the prompt aligns with the objective  that you are trying to attain, and then you finally refine the prompt to guide the model in the right direction. And this can involve multiple iterations.

 

Calibration and fine-tuning of your prompts involves using advanced techniques to improve the model's performance. For example, few-shot prompting, chain thought prompting, all of these are techniques you can use. If you have access to the model's parameters, you may want to tweak them or tune them to get a better output from the model.

 

And finally, let us discuss some best practices for prompt design. Make sure you are using the latest model because they are more versatile and they are less likely to get things wrong. Make sure you clearly separate the instructions from the additional context you provide the model using something like the ### delimiter or something close to that thought.

 

Be very specific, descriptive, and detailed about the context, outcome, length, format, and the style of your response. The more specific you are, the better the model's response will meet your particular use case. Also, examples always help. If you give a specific example for what you want the output to look like, you will find that the model tries to mimic that quite faithfully. And finally, use the prompting techniques we have discussed here. Start with zero-prompting, but if that does not give you a good result, provide a few examples with few-shot prompting and then fine-tune the model. Make sure any descriptions you provide are crisp, clear, unambiguous, and they avoid imprecision.

 

Also, like I have discussed earlier, models work best when you tell them what to do rather than what not to do. So, make sure that you specify constraints using positives rather than negatives. If you are using prompts for code generation, it helps to use leading words to guide the model in the right direction. Words such as import will generate code in Python or select will generate code in SQL.

Exploring Elements of a Prompt

We've just discussed how you can craft prompts for better responses from conversational AI services. Whether you’re working with ChatGPT, with Bard, or with Bing Chat, the more information you give the model, the more context you give the model, the more precise your instructions, the better your response will be. We've already discussed the components that make up the anatomy of any prompt.

 

We’ve seen that there are four basic components to a prompt, the instruction, the context, the input data, and the output format in which you want your response. Not every prompt you write will be composed of all of these different elements. The instruction is the core directive of the prompt, and that's essentially required because the instruction is what tells the model, the conversational agent, what exactly you want it to do. But the other elements are entirely optional. But it's the presence of these other elements of a prompt that will give you better, relevant, and more tailored responses. And we'll see that in just a bit via examples.

 

For this demo, I’m going to be using ChatGPT for the most part in this learning path. I'll stick with ChatGPT, but periodically I'll switch over to Bing Chat or Bard, or even use the OpenAI playground. Let me show you a few prompt examples with just the instruction component. “Please recommend a code editor I can use”. This has just the instructions, and because of that, the output that is generated by ChatGPT is very general. Now such a prompt is very useful if you want to ideate with ChatGPT. You don't want to restrict what it responds to, but if you want ChatGPT to guide you towards a decision, this may not be a great prompt. This prompt is what I would call an open-ended prompt.

 

Here is another example of a prompt with just the instruction, notice there is no additional context. You don’t say who the email is to, what the leave is about, nothing. It's just an email asking for leave. And the response from ChatGPT will again be very, very generic. And if you actually want to write an email asking for leave, this generic response is a good starting point, but really may not be exactly what you're looking for. Here is another open-ended prompt with only an instruction, “In what format can I store data?”

 

Think about the possibilities here. Do you want to store it in a database? In a file system? On the cloud? Really, there is no way to get a very specific answer for such an open-ended question with just the instruction. And you can see that ChatGPT essentially gives you a world of answers. It talks about file formats; it talks about databases; it talks about HDF5 as well, the hierarchical data format. Again, good for ideation but not directed. Let’s look at a few more examples quickly, “How do I get data from a store?” Again, very generic.

 

What kind of technology do you want to use? You know, what are the tools that you have available? What kind of store are you using? None of that information is present, so you get the world as a part of your response. ChatGPT goes nuts. It talks about how you can get data from a file system, from relational databases, NoSQL databases, web APIs, message queues, you name it. While this is all very interesting from a technology perspective, again, may not be relevant. One last prompt, let’s say we want ChatGPT to generate data. “Please generate some data for employees”. What kind of data do you want? What do you want it for? What format do you want the data in? None of this is specified as a part of the prompt.

 

Now ChatGPT picks a data format at random. You can see that it’s picked the JSON format, picks fields at random and then generates some data. Again, maybe you wanted the data in a CSV format or for a relational database table. Well, you should have set it up front. Now let's see some examples of prompts which contain some other components, other parts of the anatomy that we explored. Here in a new chat session, I’m going to specify a prompt that has two elements of the anatomy that we discussed, the context and the instruction. The first paragraph is the context. “Our team is planning a project in Python. We need to be able to prototype easily. The IDE should not be platform dependent.” With this context we ask our question, that is our instruction. “Please recommend an IDE” and you can see that the response is actually actionable.

 

It recommends PyCharm, which is a perfect IDE to prototype and develop in Python for your entire team. Remember, prompt responses are probabilistic and not deterministic. Now remember, I mentioned that the GPT-4 model understands nuances better. I've switched over to the OpenAI playground, and I’m going to switch from using GPT-3.5 to GPT-4.The prompt is the same as before with the context and the instruction. Let’s see what IDEs GPT-4 recommends. And really, I found that the response was much more useful. It recommended not only Jupyter Notebook, which is great for prototyping, but also PyCharm.

 

A little bit of context can go a long way in improving the responses that you get from a generative AI model. Let's go back to ChatGPT, and I'll specify a prompt which contains not only context and the instruction, but also the output format in which I want to receive the response. The context is, "I need to store some structured data using the file system. "See how specific I am? The output format is, "The data should be in the form of records and should be easily read into a Python or Java program. "What format can I use to store such data?" That's the instruction.

 

Here again, I get many different techniques. I can use JSON, XML, protocol buffers, CSV formats, but all of these have to do with the file system. And you know that all of these formats can be read easily from Java and Python programs. Now I've got all of these options because my output format wasn’t very specific. I just said, in the form of records. Let’s make our output format a little more specific. Context: "I need to retrieve data from a MySQL database. I need all the fields in the data.

 

The table is called reports." All of this is part of the context. "How can I retrieve this data using a SQL query?" The output format is a SQL query, and the model will give you a response that is directly useful. The SELECT * FROM Reports; command and it also explains the command to you. Another example with both context and the output format, “Our office is celebrating learning with a series of sessions with famous educators and technology specialists”, context. “Could you please write a tweet that includes the output format celebrating Wellness Week at Skillsoft with the appropriate hashtags”.

 

You can see three elements here. And we get a perfectly generated tweet, complete with hashtags. In order to guide your model in addition to all of the elements of a prompt, you may choose to provide other parameters as well, such as constraints. Here is an example of a prompt with context, the output format, and constraints. The first sentence is the context; you need leave for a medical appointment just for half a day. Then there is the instruction, “Could you write an email requesting for leave?” and then the constraint: “Do not make the email very long”.

 

Now something to note here, ChatGPT and other language models do not work well with negative constraints, so not making the email very long is not a good way to specify the constraint, even though it will actually generate the kind of email that you are looking for. It’s much better to specify your constraints using positive terminology rather than negative terminology. So, no: do not, but: do. Here is the same prompt as before. So, we have the context, the first sentence we have the instruction the second sentence, and notice my constraint is now positive. "Since it's a professional email please keep it short and courteous" So, rather than say don’t do something, ask the model to do something. This is one of the best practices that you should keep in mind.

 

And empirically, I have found that the model does better in such situations. Here is an example of a prompt with several elements: context, input, data, instruction, and output format. The first paragraph is the context. You need some test data for employees and you also specify the fields in the data. The example with the two records, well, that is the input data which you are sending into the model so that the data generated is similar to this. The last sentence is the instruction as well as the output format. The output format is CSV, and the instruction is, “Generate ten records” this includes a constraint as well, and this time around I get exactly what I am looking for, ten records in the CSV format, it’s perfect.

 

Another example with all of the elements in the anatomy of a prompt, we have the context; I need to write a function to sum up the elements in the list, the instruction: “Could you please write a function for this?” the input data: “The function should have the following signature compute_sum[input_elements].The output format is that we want this function in Python. Notice the constraint? It's a positive constraint. Please use meaningful variable names and do not use the built-in sum function.

 

I still have the “do not” in there. I should have said something like, “Avoid using the built-in sum function”, that would have been better, but this will still give me the output that I'm looking for. The output is again exactly what I was looking for. The specificity of my prompt with all of the components helped the model generate the best possible output. You can also have the model take on personas, “As a programing instructor, please explain the collections API in Java to a beginner learning Java”. So, there’s context. The fact that the person receiving the instruction is a beginner, and then there is a persona.

 

The programing instructor, that’s the persona of the model. I’ll leave it to you to evaluate the response. I felt it was pretty good. Simple terms and clear articulation along with an example what’s not to like? For the next example, again, we’ll specify a persona and context, but we'll switch over to the OpenAI playground and use the Legacy Completions API.“As an AI engineer, please explain what generative AI is to my grandma” here, the persona of the model is that of an AI engineer, but the model has to be explained simply enough so that my grandmother can understand who's not tech savvy.

 

And this context and persona gives us a fairly simple explanation of generative AI. Now let’s try this once again, and let’s head back to the Chat API for this. I set the persona here as a part of System settings, “You are a book reviewer”. Using this persona, I ask the GPT-3.5 model “Please review the first of the Harry Potter books-Harry Potter and the Philosopher’s Stone”. Now the model knows about this book, and I get a pretty good review with analysis of the story of the different characters in the story and how everything is woven together.

Exploring Prompt Categories in AI

So far in this learning path, you’ve been exposed to many different kinds of prompts, and you've seen that prompts can belong to different categories. 

 

Now, prompts can be categorized using several different techniques. And in this demo I'm going to categorize prompts into these five classes or categories: open-ended, close-ended, multi-part, scenario-based, and opinion-based prompts. 

 

This is not the only way to categorize prompts. In fact, this is an unusual way that I discovered in one particular blog or article, and I thought it was very interesting. Here is a link to the original source where I studied these prompt categories. 

 

Now for the rest of this learning path, we'll categorize prompts in a different way and look at examples in each category. But I really like this simple categorization of prompts to get started with. So, these are the kinds of prompts we’re going to look at in this demo. 

 

As the name suggests, open-ended prompts do not give any specific direction or don't add any specific constraints on the conversational bot. Open-ended prompts may be used for ideation, exploration, and creativity. This is when you want ChatGPT or any conversational AI service to generate a bunch of ideas, and then you'll use that for brainstorming. 

 

Here is a good example, “What do you think isa good technology that we can use to build frontend UIs?” So, maybe there’s a bit of a constraint here on frontend UIs, but that’s not really a constraint, and you can see that ChatGPT gives us ten different technologies that we could use. 

 

Let’s look at other examples of open-ended prompts. “What are some of the data storage applications I can use to store data?” Again, remember I’d mentioned that these are not great prompts if you want specific answers. They’re very open-ended, but they’re great for generating ideas for a little variety. Let’s switch over to Google Bard and ask it an open-ended question, as well. “How can I run applications on the cloud?” Very open-ended. 

 

This is what you'd use if you're just getting started with the cloud, and you want to understand how it works and how you actually do things on the cloud. Very open-ended. 

 

For our last open-ended example, let’s switch over to the OpenAI playground and let’s have it, be creative. I'm going to increase the temperature to 1.11.“What are the characteristics of a brave person?” A really open-ended question. The answer could be anything, and this is where I want creativity and that's why I've upped the temperature parameter. The response is super interesting. 

 

I'll leave that to you to explore on your own. I’ll now switch back to ChatGPT and save the session and call it open-ended, so that I know it contains all open-ended prompts. Now with that done, let’s turn our attention to the second category of prompt, the close-ended prompt. Close-ended prompts specify constraints or guidelines to direct the response in a certain direction. Close-ended prompts are not meant for ideation. 

 

They are basically when you request ChatGPT or any agent to give you specific bits of information or a particular kind of response, or limit your set of choices. You want to direct the conversational AI service towards certain outcomes. “What is the data warehouse I can use on the GCP?” 

 

The main constraint here is that I want information about the GCP. And the second constraint you can call it is that I want the data warehouse on the GCP. This guides ChatGPT to think about GCP and its services. And you can see BigQuery is the first result. 

 

And there are some other technologies specified here. But all of those are GCP technologies. So, all relevant to what we are looking for. Here is another close-ended prompt. “How do I use an event driven compute on AWS?” you can see the question is fairly specific. I’m looking for an event-driven compute and AWS is the platform. So don’t go searching for Azure, and GCP, and Oracle, and all of the others. 

 

Now the answer is not a single word or a single line, but it's very direct and something that I can use right away. Another similar example from the world of technology and cloud platforms, “How do I create a VM on Azure?” I’m interested in VM creation, I’m interested in Azure, these are the constraints or guardrails that I've specified for GPT when it generates a response. 

 

So, it won’t go all over the place. It won’t ideate with me. It will give me a very directed response that's useful. Close-ended prompts are great when you don’t want exploration from the model. “What countries border India?” Well, this is a factual question. There are just a few specific countries and you can see those specific countries are listed here in the response. 

 

Let's rename this current session to reflect the kind of prompts that we've used. We’ve been working with close-ended prompts. So, I call the session close-ended. Let's turn to the third category of prompt that we're going to explore. This is going to be the multi-part prompt. And here it's best explained with an example. 

 

A multi-part prompt is where you chain together multiple questions in the form of a sequence. So, these questions are interconnected with one another. So, the model will actually use these questions together and try to answer all of the questions you specified as a part of the prompt. 

 

This is a perfect fit for when you want to explore complex issues, encourage deeper thinking or get a more comprehensive response from the model. Here is my multi-part prompt, “Suggest some technologies I can use for data visualization” that’s the first part “and list their strengths and weaknesses” now you'll see that ChatGPT gives me two sets of responses. 

 

It will suggest all of the technologies, and for each technology, it lists strengths as well as weaknesses. So, I get a lot of information of the kind I want using my multi-part prompt. Here is another example: “Could you please highlight the features of Java and Python programming languages” that’s the first part, “compare them based on performance and ease of use?” That is the second part. 

 

So, there is a lot more direction and guidance. I gave the model with multiple, interconnected questions. And you can see the response kind of reflects that complexity of thinking. The response talks about Java and its features and its ease of use, Python, its features, ease of use. And then it does a comparison as a summary at the very end.

 

 Let’s rename this session as well, to reflect the kind of questions we’ve asked. I'm going to call it multi-part. Let’s explore the third category of prompt, the scenario-based prompt, and for that, I'll open up a new chat session. 

 

Now, scenario-based prompts present a specific situation or scenario to the model and ask the conversational agent to respond, taking into account the scenario that we’ve just described. The scenario is used to set the context within which we want the information that we are querying for. 

 

Now scenario-based prompts are useful for testing problem-solving skills or exploring hypothetical situations. “I’m hosting a birthday party. They are all between 11 and 13 years old.” That’s the scenario. The second line is the question, “Based on this scenario, what do you think I should organize? What food do you suggest? I have to ensure that they all have a good time” and you can see a response which is tailored for a party full of 11- to 13-year-old kids. 

 

ChatGPT also reminds me to check with my son for his preferences and to make sure I involve him in the planning. All very useful. Let's set up another scenario, and this time we'll use a technical scenario to get responses from ChatGPT.“ 

 

I have a lot of raw data that needs to be analyzed, but my team does not know how to code.” There is a wealth of information here in this one sentence that makes up the scenario. 

 

We have data and we do not have coding skills. “Do You have any suggestions for how I can preprocess and analyze this data?” Let's see what ChatGPT has to say. And I actually look through the response. And all of this was very sensible. It suggested Excel, it suggested SPSS, it suggested AutoML. All tools that do not require coding knowledge. You can see that it has also categorized the different types of no-code and low-code tools.

 

 Very, very useful for me to start looking around. These were scenario-based prompts that we looked at. So, let’s save this conversation with a meaningful name. I’ll just call it scenario-based. And let’s start a new chat. And we look at the last category of prompts, opinion-based prompts. 

 

Opinion-based prompts are used when you’re seeking the model’s opinion on a topic that you are thinking about. So, you’re asking for your personal opinion or belief on a topic. It’s very useful for exploring what values the model expresses, testing your own critical thinking, making sure you've taken in the opposing point of view. 

 

Here is an opinion-based prompt. Let’s say you’re negative on generative AI and you’re looking for the opposing view, “What do you think of generative AI? Do you think it will improve our lives?” and then ChatGPT tells me what all is possible with generative AI. 

 

What I like about this response is that it lists the positive points showing what's possible with generative AI. It also lists the concerns with generative AI. Let’s look at another example of an opinion-based prompt. “What do you think of e-learning? Do you think it improves learning outcomes?” 

 

So, it’s a what do you think prompt asking for ChatGPT’s opinion and ChatGPT will of course give you both the pros and the cons. In the response, it talks about the advantages of e-learning and then it talks about the challenges of e-learning. 

 

This is a great way for you to get different ideas on either side of the argument, and then make your own decision. This is the fifth and last category of prompt that we’ll study herein this demo. Let’s rename this session as well, to be called opinion-based. And these are the five categories that we covered, open-ended, close-ended, multi-part, scenario-based, and opinion-based.

Seeking Facts and Explanations with AI

 

In this demo, we'll discuss and explore prompts that generate factual responses from ChatGPT or any other chatbot that you choose to use. Fact-based prompts are questions or statements designed to elicit information that is factual in nature. You can actually take the response that ChatGPT or the chatbot generates and compare it with other sources, and verify whether that information is true.

 

The aim of fact-based prompts is to gather objective data, verifiable details, or specific knowledge, rather than opinions, interpretations, or personal feelings. If you're interacting with a chatbot or a language model and you use a fact-based prompt, you are looking for information that is grounded in established knowledge, such as now this is actual knowledge that you're seeking.

 

Not an opinion, not an interpretation, but just a fact that's easily verifiable. Now, with this in mind, let’s look at some examples of fact-based prompts that you can use with your conversational AI service. “Which is the largest state by area in the United States?” It's pretty clear that there's exactly one answer to this question, and it’s grounded in fact. These are usually the easiest kinds of prompts that ChatGPT or Bard will get right. Here you can see the largest state is Alaska, and ChatGPT has given us a bit of additional information and context, but essentially Alaska is the answer.

 

Let's try another one. “Which state has the largest GDP in the United States?” Now this is a tricky one for ChatGPT. You can see that it gives us the correct answer. The answer is actually California, but because its information is dated and the GDP of the different states might have changed, it also adds in its usual caveat that it doesn't have information beyond September 2021. All of these different prompt categories work with all language models that we've looked at so far. So here is the same question that I posed to Google Bard, “Which state has the largest GDP in the United States?” and here you can see Bard is very clear, it’s California. Because Bard has more up-to-date information.

 

Now Bard’s responses are a little different and more interesting. It ranks the different states by GDP, and then it ranks these states by per capita GDP as well. But all of the information generated is factual. Let's try another one. “What are the largest exports for China?” Again this is a general knowledge question, fact-based. And you can see that this is what China exports and how much of each kind of export that China has. And you have to admit that this is a pretty formidable list of exports. We have the exports and also the numbers in billions of dollars. Now, fact-based prompts need not be just about general knowledge. Those are the prompts we've looked at so far.

 

They can also be technology-based questions. “I need to retrieve data from a Rest API. What kind of HTTP request will allow me to do this?” In this case as well, the answer is very, very specific and grounded in fact. You can see it is the HTTP GET request which is correct. And then ChatGPT has given us a bunch of additional information about how the GET request can be used. Here is another fact-based prompt based on technology.“ My organization is storing data on AWS using S3 buckets.

 

What is the Python library that will allow me to access this data programmatically?” There is only one possible response, or maybe a few responses based on the different libraries that you can use. And you can see the answer, here is Boto3.Another category of prompts that is similar to fact-based prompts, but maybe the objective of the prompt is a little different is explanation-based prompts. Explanation-based prompts are questions or statements designed to elicit a detailed explanation or clarification on a particular topic, on a particular concept or a process.

 

Now, here you are seeking more than just facts. You don't want a straightforward, factual answer. Instead, you want the model to give you more context. You want it to explain the rationale behind a particular topic or a process, or you want a step-by-step walkthrough. You’ll use explanation-based prompts when you’re seeking a deeper understanding of the subject matter, and explanation-based prompts may elicit responses that integrate different bits of information, facts, theories, examples to give you a more comprehensive response.

 

These are closely allied with fact-based responses because the explanations are grounded in fact. So, let’s try an explanation-based prompt here “Could you explain the dictionary data structure in Python?” so, you know this data structure exists. You want to know how it works. And here is what ChatGPT has to say. Everything that you see here in this explanation should be verifiable. You'll find this information in any kind of documentation, but ChatGPT has neatly summarized it for us, giving us a clear explanation of how Python dictionaries work.

 

Here is another example of an explanation-based prompt. “Could you explain how the limit clause works in SQL?” Again, this is technology based, but it’s an explanation of something that you’ve heard of and the response will be quite detailed. Kind of walking you through step-by-step of how a limit clause works and how it can be used. Now, it often might be the case that the chatbot that you're working with does not know the answer to your question.

 

It’s possible for you to structure your prompt in such a way that when the chatbot gives you a negative response, the negative response has a certain format. You can request a particular kind of response for negatives where the chatbot does not have your answer. Now, I'll first ask ChatGPT a question that it will know the answer to. “What’s the top grossing movie in the year 2019?”ChatGPT has data about the year 2019. It has been trained on this data. Let’s see what it says. And it says, it’s Avengers: Endgame. It still gives you the September 2021 caveat, but it gives you a clear answer.

 

Now let's ask it something it won't know. Let's ask something about a year for which ChatGPT does not have information. What is the top grossing movie in the year 2023?Well, it clearly won't know this. And then it gives you its usual apology and talks about September 2021 and how it doesn't know anything beyond that. But what if you want it to give you a specific kind of response when it doesn't know the answer?

 

Well, you engineer your prompt accordingly. “What is the top grossing movie in the year 2023? Respond with, “I’m afraid I do not know this answer if you actually don’t know the answer” So I’m giving very specific instructions to ChatGPT and you can see the model here understands my intent and it immediately responds with, I'm afraid I do not know this answer. It doesn't give me unnecessary explanations and it only gives me a polite negative response.

 

Summarizing Text Using Prompts

Another prompt engineering technique you can use with ChatGPT or any other conversational AI service, this includes Bard, Bing Chat, or even Perplexity AI is summarization. And in order to get your chatbot to summarize a complex bit of text for you, well, you'll use a summarization prompt.

 

Summarization prompts are questions or statements that request a condensed version of information, events, or concepts. The goal of such a prompt is to capture the essential elements or key points of a subject matter in a shorter, digestible form. You can imagine that there's so much information out there in the world today, so much of it in the text form. In order for you to quickly parse and digest information, it's important that you have good summaries. And this is what summarization prompts enable.

 

There are different use cases for summarization prompts to quickly understand the core message or theme of a body of text, to simplify complex ideas for easier consumption, or to highlight important facts or aspects of a subject. And in this demo, we'll see how summarization prompts work. Now, let's say you're reading an article here in the National Library of Medicine, and you come across a paragraph that you find interesting, and you want to quickly summarize this paragraph. One technique is, of course, to generate the summary yourself. That's definitely a viable technique, but you can save yourself some time by harnessing the power of conversational AI.

 

Now, here is one paragraph here in this article that I’m looking at: Ethics and rules of using text from ChatGPT I'm going to copy over this entire paragraph here, and I'm going to quickly generate a summary of this paragraph using ChatGPT. You can see my prompt here for ChatGPT “Could you write a concise and comprehensive summary of", and I’ve pasted in the rest of the text here. Let's see what ChatGPT has to say. And here in the response you can see the summary generated by ChatGPT. It's actually a great summary.

 

I read through it offline and it talks about the ethical questions regarding plagiarism. And it talks of two cases where Science Journal and Nature Journal have set guidelines on how generative AI tools such as ChatGPT can be used in their journals. The Science journal is completely against it. The Nature Journal has provided some guidance on LLM usage. This is actually a greatly simplified representation of the dense text in the article.

 

Now, here isa best practice when you're specifying prompts that involve several sentences, or involve some instruction and some piece of text or information that you give along with the instruction. In order for ChatGPT or any other LLM that you’re using to better understand the segregation between the instruction and some input text that you're specifying, it’s common practice to use something like the ### to separate the instruction from input text. This makes it very clear to ChatGPT that you have the instruction, and then there is a separation, and then you have additional input that you specify.

 

That's just one of the changes I've made here in this new summarization prompt. In addition, I've given additional guidelines for how I want the summary to be. I've asked ChatGPT to summarize using a single sentence. I've also specified the output format in addition to the instruction, and then I've used the best practice to segregate the input text from the instruction. Let's go ahead and see what ChatGPT has to say. And here we have a very clear single line summary.

 

When you're using summarization prompts, it's really a good practice to be very specific about what kind of summary you’re looking for. “Could you summarize this text using three bullet points?” Will give me a slightly larger summary, but not too large. And once again, I use the recommended ### to separate the input text from the instruction, and this result actually gives me a very balanced summary. Not too long and not too short.

 

So, it captures more of the essence of the text that I had specified. Now we know that ChatGPT does not parse content from a link, and then extract a summary or extract any information from that content. But Bing Chat does, and Bing is what I'm going to use next. Now I'm going to ask Bing to summarize a particular section from the link that I provide. Now the section is going to be Ethics and Rules of using text from ChatGPT. I copy this section over, and then I also copy the link of this article over. And this is my prompt to Bing. It's a summarization prompt using a link to a web page.

 

Now earlier we had summarized just a single paragraph from this section. But now Bing will create a summary of the entire section. I feel, Bing generated a decent summary, but it didn’t do a great job because that particular section talks about using ChatGPT for writing, and I feel that Bing has kind of missed the point. So, you can see, Text from ChatGPT, ChatGPT as a writing tool, How ChatGPT has been used to write papers, It kind of missed all of these points, but it did capture some of what was in that section.

 

Now I’m going to head back to ChatGPT and ask it to summarize some text that I took from some C++ documentation. Once again, I want the summary in three bullet points. Notice the ### I use as a separator. And then I have a long bit of text which talks about variables and memory addresses in C++.The only constraint I specified on the summary was that it be in three bullet points. And you can see we have three bullet points in the answer. And it's a good summarization of the original text that I had pasted in.

 

Now you may want to engineer the kind of summary that is generated by a chatbot to target a certain kind of audience. Well, this involves prompt engineering. Make clear the audience for whom this summary is for. It's the same text on variables and memory addresses, but I want this summarized for a 7 year old and this will guide ChatGPT to produce a summary that is simpler to visualize and understand. And you can see that the summary produced does try to simplify this concept.

 

Imagine your computer’s memory is like a big, long line of boxes, and then a very nice explanation of how variables can be things like score or color. ChatGPT has essentially changed its entire way of thinking to summarize the text for a 7 year old. Prompt engineering of this kind where you specify a target audience can be used with Google Bard’s conversational AI service as well.

 

Once again, I’m going to ask Bard to summarize the same C++ variables text for a 7 year old. You can see that the kind of summary that Bard generates is different from that of ChatGPT, but it's still simple enough that you can explain to a child. Instead of boxes, you can see that the summary talks about houses and the memory addresses being house numbers. It's pretty clear that the prompt engineering techniques that we are discussing here today don't apply to one chatbot or one technology.

 

They're universally applicable to the big conversational AI services ChatGPT, Bing Chat, and Google Bard. Another form of summarization is title generation. You might have an essay that you've written or an article and you want a suitable title. Well, you can ask ChatGPT to read the text and generate a suitable title. I followed best practices and separated the input text from the instruction, but this time I've used """ to separate the instruction and the text. This is also perfectly acceptable.

 

I just wanted to show you this was possible and is also used along with the ###. Let’s take a look at the title generated. Understanding how computers remember the magic of variables and memory addresses. This title seems to be targeted for a younger audience, and the reason for that is I'm in the same session where I asked ChatGPT to summarize that text for a 7 year old. It has picked up that extra bit of context from this conversation, and generated a title more suitable for a younger audience.

 

Now let's try the same thing with Bard. I've specified the exact same prompt in the same conversation where I asked about 7 year old, but Bard did not pick up that context. It has generated several titles, but those titles are for a more adult audience and not specifically meant for a younger audience. Now there are different kinds of texts that you can generate summaries for.

 

You can also have a long chat conversation back and forth between, say, a customer and a support center agent, and then ask ChatGPT to generate a summary of this. You can see my instruction on the first line, and I've placed the entire conversation within """because this conversation has a lot of new lines and a lot of paragraphs. So, you can see the opening """ there and you can see somewhere in the conversation, the customer talks about making sure the food is still warm when it gets to him. And you can see the closing """.

 

If you have a long block of text with several paragraphs. It's a best practice to enclose the whole thing in """ so that ChatGPT knows when the text begins and where it ends. Let's take a look at the summary generated for this conversation. You can see that the summary is very brief and to the point, but it captures the essence of the conversation between the customer and the support agent. Some of the nuances have been lost, but the essence remains. Now let’s try summarizing this exact same conversation using GPT-4.

 

You can use Bing Chat to use GPT-4, or you can use OpenAI playground. Here in the playground, I specify summarize as the system specification. And in the message here, I'm going to add in the conversation between the customer and the support center agent. Now let’s change our model to be GPT-4,so that we are using the latest and greatest model available from OpenAI. And let’s hit Submit. Let’s see what the summary looks like. And I actually found that the summary was much better than the summary generated by GPT-3.5.The summary is longer and more nuanced, but this could also be because of my temperature setting at 1.11. So, the summary is a little more creative.

 

Classifying Text Using Prompts in AI

Another useful prompt engineering technique is classification, and you do this via classification prompts. These are questions or statements that ask for categorization or labeling of items, concepts, pieces of information based on certain criteria or attributes. Now, what you're seeking to do with these prompts is to sort or arrange data into specific groups or categories to make it easier for you to understand, analyze, or apply that data.

 

Classification can be very simple, like differentiating between fruits and vegetables, or you can even categorize diseases based on symptoms and causes, and these prompts are often used in scientific research, data analysis, and even decision-making. One of the simplest and most common uses of prompt engineering for classification is for sentiment analysis, where you want to gauge the tone or sentiment of a bit of text. I'm asking ChatGPT to classify this review. This is just a review of the Top Gun Maverick movie that I copied off of some site.

 

I'm now going to introduce a prompting technique that I've used here. We'll study the prompting technique in more detail a little bit later on in this learning path, and that is zero-shot prompting. In fact, we’ve applied this prompting technique all along for most of the prompts that we’ve used here in this learning path. Zero-shot prompting refers to the ability of the LLM that we’re using to perform a task without having been specifically trained on that task.

 

So, the model that we’re using hasn’t been trained on classification, but you'll find that it can still classify this review without any specific training for this particular task. You can see that ChatGPT has captured the nuance as well. The review can be classified as generally positive, and it gives some additional explanation. Zero-shot prompting and classification, these are the two prompting techniques that we’ve discussed here. Once again, I use zero-shot prompting and classification to classify this review, and this happens to be a rather negative review.

 

This is zero-shot prompting, because it’s not like the GPT-3.5 LLM, specifically trained for classification or sentiment analysis, and it's a classification prompt. Let's see what the result is. And you can see that this review can be classified as negative or critical. Let's look at another example of a classification prompt again with zero-shot prompting, “Classify this review” movie was okay, the actors were decent, and you can see that ChatGPT thinks that this review is lukewarm or neutral. Notice that ChatGPT found the three broad categories of sentiment analysis: positive, negative, and neutral, without us having to actually define these categories or using a model that has been trained using these categories.

 

This is zero-shot prompting and classification. Well, you’ve understood that. Let's look at a variation of this sentiment analysis classification prompt. Here I specify the classes or categories into which I want the review to be categorized. “Amazing”, “Positive”, “OK”, “Negative”, “Horrible”. So, I explicitly say classify this review as one of these five categories. And here you can say that ChatGPT thinks that this is a positive review. It's not an amazing review, but positive. You can engineer your classification prompt to guide the output of the model to be in a particular form. And that's exactly what I have done here in this example. I want the review to be classified as one of the five categories that I have specified.

 

So that’s one part of the guide. In addition, I've specified an example and the structure in which I want the response. Notice the Example: Text, then the Sentiment: OK, then again Text and then Sentiment, and I’ve left it blank after that. I'll introduce yet another term here because we've used yet another prompting technique and that is few-shot prompting. Few-shot prompting refers to the approach where a model is given a small number of example prompts and responses, and these examples are referred to as shots, and these examples help the model understand a particular task that it needs to perform.

 

Here, the single example we’ve specified of the text and the corresponding sentiment: OK is the single shot that we’ve used to kind of make ChatGPT understand what we wanted to do. Unlike zero-shot prompting, few-shot prompting gives the model some context or some examples that guide the results towards the output that you are looking for. Let’s see what ChatGPT has to say. So, the sentiment for the first review is "OK. "The sentiment for the second review is "Positive." So, this time around it didn’t really give this to me in the format sentiment colon positive.

 

Sometimes it does, sometimes it doesn't. Maybe I need a few more shots to actually train this. Let's try this once again. We have another classification prompt. We've specified the five categories into which we want the review to be classified, and we've also specified the format in which the output should be generated. We have text and sentiment, then text and then sentiment followed by colon. Again, we’ve specified a single shot example for the model to understand the output that we are looking for. Let's look at the output. The sentiment for the first review is "OK." Sentiment for the second review is "Negative."

 

Let's try the same classification prompt with a single example. The single shot that we have specified on Google Bard. So, it’s the exact same prompt that we just saw on ChatGPT. Let's see what Bard has to say. Bard gives us the same classification for this review. The second review is classified as negative, but it gives us a lot of extra detail on why it classified the reviews as such. But what’s interesting here is a little table Bard has set up at the bottom. For classification prompts, Bard often produces this quick summary at the end.

 

Here we have the review and the sentiment set out in the form of a nice table that you can then export to Google Sheets, which is, I must say, quite cool. Let me show you another detail about the Bard response that is very, very interesting. Now the review, the negative review that I used in this example was taken from a website. When I scroll down to the bottom, I noticed that Bard had actually searched the internet and had correctly identified the website from which I got that review. So, I’m going to click on that website. You can see that this is a website with bad reviews of movies.

 

I'll scroll down to the bottom. I'll scroll down here and you can see where exactly I copied this review from. Bard has correctly identified the source as well. Let's go back to ChatGPT and you'll see that classification is not just about sentiment analysis. You can have any categories that you specify and have ChatGPT classify text into those categories. Let's say you're building an app where people can raise support tickets for the products that you're selling. And the support tickets can be classified as delivery, product, or support. You can see that this is the context that I have provided ChatGPT, then I asked ChatGPT to categorize the following ticket text.

 

This is a ticket the customer on our food ordering platform has raised, “My order came in very late and the food was cold” let’s see if ChatGPT is able to correctly categorize this. And you can see that it has the fact that the order came in late ChatGPT has correctly identified this as a delivery issue. Let’s try once again, we have the same three categories. The support tickets raised can be categorized as delivery, product, and support. “Categorize the following ticket text, I had ordered burgers and fries, but only received the burger” And you can see that ChatGPT categorized this as a product issue.

 

It's more likely that the restaurant forgot to add in the fries, rather than the delivery agent having missed the fries, so, it’s a product issue. Let’s try a third time. Again, the same three categories: delivery, product, and support, and then here the ticket says, “I tried calling the help desk, but no one responded to my query in time” and ChatGPT very correctly identifies this as a support issue because the help desk failed to respond. Let’s look at one more classification prompt. Here I’ve used the few-shot prompting technique to specify some examples, and the way I want the resulting response to be generated. I want to categorize the technology that I've specified as one of the following: either a programming language, or a database.

 

And you can see here that I've specified a number of examples. These examples comprise of the shots that I have given ChatGPT. Few-shot prompting involves providing the model with several example question answer pairs or input output pairs, or data and categorization pairs before presenting it with a new question or a new set of categorizations that you want it to perform. And here, below is my categorization task, using the few shots that I’ve provided, in addition to whatever information the model already knows, I’ve asked ChatGPT to categorize MongoDB, Fortran, Go, and Couchbase.

 

Let's see what ChatGPT has to say, and you can see that it gets things perfectly right. MongoDB and Couchbase are both databases, whereas Fortran and Go are both programming languages. And thanks to the few shots that we provided, the output is also in the format that we specified. Now let's try asking the same question of Google Bard. I've asked Google Bard to categorize the same set of examples as databases or programming languages. Let's look at the result here. Bard also gets the categories perfectly, and it also lays out the categories in a nice tabular format.

 

You can see the table that it has generated contains our original examples and also the new technologies that we asked Bard to classify. Now both ChatGPT and Bard use the information they have about the world to actually perform this classification. I decided to use the same prompt with ChatGPT again, but I’ve added in a little tweak. Here at the bottom where I specify the technologies I want ChatGPT to classify, I specify NonameDB, which is completely a made-up technology, but it has DB at the very end. I'm curious as to whether ChatGPT will classify this as a database because of the presence of DB, and thankfully it doesn't. ChatGPT is very clear that it doesn’t recognize NonameDB so, it cannot be categorized based on provided options.

 

Now let’s try this with Bard. The same thing, same prompt, same set of technologies with NonameDB at the very bottom. Let's see what Bard does with this. It classifies everything just fine, but it says Noname DB is not a technology that it’s familiar with, but it then searched online for NonameDB and felt that it was a name of an upcoming database. Now, I’m not sure this is really true, so it could be that Bard is hallucinating, but maybe its search prowess is much better than mine. I couldn’t find any such technology called NonameDB. Generative models are prone to hallucination. They make up stuff. So, if you’re doing research based on generative AI responses, I suggest you always double check your research from other sources.

 

Extracting Information Using Prompts

In this demo, we’ll see how you can use the extraction prompt engineering technique. Extraction prompting is a specific form of interaction with a language model, where the goal is to extract or access a particular piece of information from the text that you have supplied to the model. Extraction prompts can be highly focused, designed to elicit factual answers or other targeted pieces of information from a large body of text. They are very useful if you have a very large document that's kind of complex and hard to read. Legal documents fall in this category.

 

You're looking for something specific in the legal document, rather than reading the entire document and then trying to find the answer to your question or extracting that bit of information, well, you can use extraction prompting. You can also use extraction prompting to get a generic list of different kinds of terms used in an article. Let me show you an example of extraction prompting here. Here is the Wikipedia article on William Henry Gates ,or popularly known as Bill Gates. You know that he was a founder of Microsoft and he's a billionaire who lives in Seattle.

 

He's also the founder of the Melinda and Bill Gates Foundation, which is a huge charitable organization. Now using this information, and I’m just going to copy most of the text here in this article, I’m not copying all of the text because there is a limitation on the text that you can provide to ChatGPT. I've copied, say, about 50% of the article, and I’m going to ask ChatGPT to extract the information I’m interested in from the text that I’ve pasted here. “Identify people, companies, products, places, and general themes from this article” Do make note of all of the different bits of information that I want to extract.

 

Let's take a look at what ChatGPT makes of this. Do you think it will do a good job? Well, notice the error in the response. The message that I submitted was way too long. Let me stop generating here on ChatGPT. It's clearly not working. I've taken a fraction of the text that I pasted in before, and I've asked ChatGPT to perform the same operation identifying people, companies, products, places, and general themes. Now with the shorter text, let's see how ChatGPT performs. You can see Bill Gates, of course, William Henry Gates, there’s Paul Allen, Ray Ozzie, Craig Mundie, Elon Musk, Robin Lee, all people associated with Microsoft or are billionaires in some way.

 

Here are the companies referenced in this article. You can see Microsoft is here on top, but there are other companies, as well. Here are the products referenced in this article, Altair, MS-DOS, Microsoft Windows, we shouldn’t forget that. Here are places: Seattle, Washington is on top, That’s where Bill Gates lives, and that’s where Microsoft headquarters is based. But there's Albuquerque, New Mexico. That's where Microsoft was originally founded. And here at the bottom, we have the general themes in this article, starting with entrepreneurship. Now, other than the fact that there is a text limitation I can use for my prompt, ChatGPT did very well.

 

Instead, if you were to perform this same operation using Bing, you could just paste in the link of the article directly. Notice that my extraction prompt is exactly the same identifying people, companies, and so on from the article on Bill Gates. But instead of pasting in the text of the article, I've just provided a link as a reference to the article, and Bing Chat is able to parse the contents of the link and then extract the information that I asked for. You can see people, companies, products, places. There are many more places here, including Sub-Saharan Africa and India and then general themes.

 

I feel that the products extracted are better as well. Windows operating system is on top, Microsoft Office is in here, Xbox, Surface these are all major Microsoft products. Let's compare this exact same prompt on Google's Bard conversational AI service. I'm going to paste in the prompt here. And once again Bard can parse the contents of links. So, I specify the article as a link. And I feel that Bard does a better job than ChatGPT. It’s comparable to Bing. Here are the people, here are the important companies, notice that Bill and Melinda Gates Foundation is in there.

 

Then there are the products: Microsoft Windows on top, Microsoft Office second, that’s good. Places: Seattle and Medina is where Bill Gates lives. And here are the themes that were extracted from the article. So, overall, here ChatGPT with GPT-5 and no link parsing came out poorly. But Bing Chat and Bard both did very well. Another use case for extraction prompting is when we want ChatGPT to parse information from resumes. Here on this website my. Prefectresume.com I have a clean text resume that's available to me, and I'm going to ask ChatGPT to extract information from this resume.

 

Let’s copy this plain text resume over and let’s paste this into ChatGPT. Now I've also set up my extraction prompt to be much more specific, so, I want the following bits of information extracted from the resume; companies, education, degrees, and skills but I want each of them in a certain format. I want a bullet point list for each category. Notice how even within extraction prompting, you can use prompt engineering to improve the performance of your prompt and get the output in the specified format. Now here is the resume. What I’ve done here is added another university under Education, just to add a little more variety to the resume.

 

Now with this done let me go ahead and hit enter and let's see what ChatGPT has to say. Observe how each topic that it has extracted, or each kind of data that it has extracted is listed out in bullet points. Companies, three bullet points, and Education: Park Point University and Harvard University. Degrees: there are two separate degrees, one that I added in and one that was already in there in that resume. And then the skills listed in that resume. You can imagine that this would be extremely useful for recruiters to quickly parse and understand what a resume is about. Another common extraction task that you may have performed manually at some point is to generate keywords for a blog post.

 

Now here I'm going to head over to the skillsoft.com site, and the latest blog post available here is one on the skills gap. Since ChatGPT can't understand links, I'm going to copy this blog post over till the very end. It's not a very long one. And then switch over to ChatGPT and have it extract keywords from this post. And here again, I've been specific. I've asked ChatGPT to generate only the five most important keywords. Otherwise it'll just give me a list of 20, which is useless.

 

Let's see what ChatGPT has to say. I feel the generated set is a pretty good one here. AI and ML, skill gaps, executive leadership, workforce development, this is pretty amazing. Now I'm going to use the same blog as before, but the kind of extraction I'm looking for is a little different. I asked ChatGPT to extract ten hashtags that can be used to promote this blog on Twitter. I’m extracting a different kind of information with a different extraction prompt. And here are the ten hashtags that ChatGPT has extracted for this particular blog.

 

 

For each of these prompt engineering techniques that we are learning here today, there are so many diverse ways to use all of these techniques. What I'm showing you here is just a little sample of what's possible. You can extract technical specifications in a particular output format as well. Now I've got this technical specification from the Amazon site where it was in plain text as a part of the product name and description. Now I want this in the JSON format and that's what I've asked ChatGPT to do. I have no idea what the result is going to look like, but I must say it looks pretty amazing. It figured out the brand, the model, the RAM, the storage, the keyboard, and so many different aspects of the specification extracted nicely into the JSON format.

Answering Questions With Prompts

I should tell you that ChatGPT is an extremely popular chatbot, and you will find that at peak times during the day, especially morning US time for the free version of ChatGPT the servers will be overloaded and responses will be very slow. And often you may not get responses at all.

 

Now throughout this learning path, I’ve been trying to use ChatGPT, Bard, Bing, and even the OpenAI playground. I found that with ChatGPT in the morning US time servers were overloaded, responses were slow or I wouldn't get responses at all. I asked ChatGPT if the servers were overloaded. Well, obviously it didn't have any answer to that. “Your responses seem slow” Now because the responses were so slow and I was waiting forever, I decided, let’s explore some of the other conversational AI services that we are working with.

 

We can always come back to ChatGPT a little bit later on. So, I switched over to using the OpenAI playground with GPT-4and I thought this should give me better responses anyway. This might be a good time to try this out. This was just a little bit of background on using ChatGPT during peak hours. You are very likely to encounter this slowness. Just something for you to watch out for. The prompt engineering technique that we are going to be discussing in this demo is a variation of the extraction prompting technique that we looked at in the previous demo.

 

In this demo, we'll focus our attention on question answering. If you think about it, question answering is a type of extraction prompting. Let's say you have a legal document or a contractual document, or some kind of arcane bit of text that you need to understand. You're looking for answers to questions, and those answers are present in that document. Well, how do you extract this information? You can turn to chatbots today. In this demo, we'll see how we can get the generative AI tools that we’re using to extract information based on questions that we ask about the data.

 

I’m going to head over to rbi.org. The RBI, which stands for Reserve Bank of India, is the central bank in India. It’s the equivalent of the Fed in the US. As you can imagine, the RBI frames rules for investment by Indian companies into foreign entities. And this document that you see here at this URL is essentially an article specifying what kind of companies can invest in, what kind of foreign companies, and all of the regulations that bind this kind of investment. I’m going to copy the relevant text from this very long article here in section B.

 

So, I’m going to copy the entire B.1. section under the larger section B. And this is the text based on which I want questions answered from my chatbot. So here is the OpenAI playground. And I'm going to add in a message here. First, I made it very clear to the chatbot that I only wanted to use the text that I specified to answer my question. So, the text forms the background, and the question should be answered based only on that text. And then I delineate that text using the ###,and then I paste the text that I copied over from the RBI site, in here.

 

I hit Submit and the model immediately starts generating some questions and answering those questions. So, it didn’t fully understand what I wanted to say. I'm just going to get rid of this response here, and then I'm going to continue asking my questions based on the text that I pasted in. So even though it misunderstood me, it will understand me better once I ask the question. Here is my first question. You can see the question is pretty technical. “What is the total financial commitment that the Indian party can make for an overseas direct investment?” Let’s see what the chatbot has to say. Remember this is GPT-4. Click on Submit.

 

And here is the response from the chatbot. And this response is absolutely correct. The investment should not exceed 400% of the net worth of the Indian party. We can head over to the RBI site, and you can see the answer is right here in the text that I have highlighted. So, the GPT-4 model got it absolutely right and gave me a very succinct and direct response. Now let's go back to the playground and ask another question based on the text that we've pasted in. Now, this time around, my question is how much time does the Indian party have to report an acquisition to the RBI?

 

Again, pretty technical. GPT-4 gives me a very clear response: within a period of 30 days from the date of the transaction. Let’s see if this is correct. So, I’ll switch back to the RBI site, and here at the bottom I find this clause. Now this was pretty cool. I must say that if I'd known this a few months ago, this would have saved me a lot of time. I spent a lot of time reading arcane documentation like this one. Another thing that you may have wasted a lot of time doing is reading technical documentation associated with some gadget or device that you’ve purchased. Well, Bing Chat, ChatGPT, Bard, all of these can help you with this as well.

 

Now this next example where I show you a question answering from technical documentation is an example that I found here in this very useful site. This GCP link here contains many different prompt samples of the different types that we've discussed today, and some others as well. Let's see how you can get your questions answered with technical documentation. Here is my prompt, “Here are the troubleshooting instructions for my Wi-Fi router.” And I’ve asked Bing Chat to answer this question using only the text provided. And here are some technical documents, the kind of which you may have encountered before.

 

Lots of descriptions about the different colored lights and what they mean and what you should do. And here is a question at the very bottom. “What should I do to fix my disconnected Wi-Fi? The light on my Google Wi-Fi router is yellow and blinking slowly.” Well, I'm really looking to Bing to give me a proper response. Let's see what it asks me to do. And it says, based on the text you provide, you should check the Ethernet cable and then see whether things are turned on. And this is absolutely correct. By answering my question, Bing has given me the direction that I'm looking for without my having to actually read the technical docs.

 

Now, how do we be 100% sure that Bing and ChatGPT are using only the docs that we have specified in order to answer questions? Well, let’s try with something that GPT-4 and GPT 3.5 will not know about. Here is a link to the WSJ article on the Instacart IPO. This IPO has been set for some time in September 2023,and we know that the GPT models that OpenAI uses do not have information about this period. Now, what I did was I copied this article over, I logged in with my subscription and copied this article over, and I switched over to the OpenAI playground.

 

First, I confirm that the GPT-4 model that I’m using knows nothing about the Instacart IPO. So, I asked, “What do you know about the Instacart IPO?” and you can see that it doesn’t have any real-time capabilities. And as of October 2021, this is what it knows about Instacart. It knows nothing about the IPO. Well, I'm actually glad you don't know anything about the IPO, because I have some questions to ask you based on the text that I enter. And this time I know for sure that the questions will be answered based on the text.

 

Here is some background text, “Please answer the questions I ask using only this information” and I paste in the article. Now let’s hit Submit and then ask our questions. I feel like the GPT-4 model doesn’t understand the context of background text. I haven't asked the question yet. It started generating a response, maybe a summary. So, let’s just get rid of that response and then ask it the question. “I’m curious about the current valuation that Instacart is targeting.” Let's see what the model has to say.

 

Roughly 8.6 to 9.3 billion based on the text. That's great. Now, “Is this higher or lower than its valuations in previous funding rounds?” Well let's see, it's definitely lower. Earlier Instacart was valued at 39 billion. Last question here, “Who is the current CEO of Instacart?” again, only known from this article, and the model correctly says it’s Fidji Simo. Oh wait, I have one more question. Let me ask that as well. “What does Instacart plan to do with the funding raised?” And it says, the selling will be by employees and other early stakeholders so that they can cash out. The model knew nothing about the Instacart IPO, but based on the background text that we provided, it was able to answer questions.

Using Prompts for Writing and Grammar

Another area where generative AI tools are extremely useful is for writing. I don't know about you, but often if I have to write something, I find it very hard to get started. It's useful to have some kind of seed or stimulus. And here I’ve seen that I turned to ChatGPT or Bard more often than not. The right prompts with generative AI tools can help you with all kinds of writing.

 

Writing prompts are statements or questions designed to inspire or guide the writing process. They serve as a starting point or stimulus to help writers generate ideas, focus their thoughts, and engage their creativity. Writing prompts can be of many different types. You can have creative writing prompts when you describe something which doesn't exist, or you can have narrative writing prompts when you kind of tell a story. Expository writing prompts where you actually explain something.

 

Persuasive writing prompts where you write to persuade the reader of something that you know of some opinion that you hold. Writing can also be directed towards journaling, technical writing, or poetry. Here in this demo, I'll show you a few examples of writing prompts and the different ways you can tweak those prompts to get the right response from Bard. All of these prompts that we're going to be working with, you can use with ChatGPT or Bing Chat.

 

Essentially, you can use these prompts with any generative AI tool. Now, writing need not be all about generating text. It can be about proofreading and grammar mistakes as well. So, I’ve asked Bard here to proofread and correct the grammar and spelling mistakes here in this email. This is a prompt that I find invaluable and I use very often. Now this email here has a bunch of grammatical mistakes. I’ll leave it to you to figure these out.

 

You can see some here at the end, Please find attached, you will find the contract documents, in case questions, that’s wrong grammar as well. Let’s see what the corrected email looks like. Now of all of the generative AI technologies, I really liked using Bard for this particular use case because it highlights what it has corrected. You can see right away in bold there was a misspelling there. Facilitate had a misspelling. Then let's see, there are some more.

 

Immediately, I think there was a misspelling or a grammatical error there. And here at the bottom you have a bulleted list of all of the changes that Bard made. You can see that it changed the verb tenses, it corrected spelling mistakes, it made sentences more concise, it also made many sentences grammatically correct. I really feel Bard had the best response of all because it told me what my mistakes were. Now let me feed in the same prompt to Bing Chat. So, it’s the same email, and I’ve asked it to proofread and correct my spelling mistakes.

 

Now Bing Chat gives me a great response as well, an email with no spelling or grammatical errors, but it didn’t explain anything. I found that additional explanation that Bard provided very useful. Another example of a writing prompt is when you want the chatbot to actually generate text for you, not just proofread or correct text. I’ve asked Bard to write an email requesting for an update on a project schedule, and I specify the name of the project, as well , “Green Trees”. The email should ask for whether the task will be completed on time for the next milestone, but I haven't given any other details or any other specifications for what the email should look like, and it produces a reasonably good email.

 

Now, I was quite happy with this response, but often when you're writing an email, there is a lot of additional context which would be useful for the chatbot to have, and I’ve engineered my prompt to get more specific response of the kind that I'm interested in. And in essence, this is what prompt engineering is all about, tweaking and tailoring your prompt to elicit the right response from the chatbot. Now here the first paragraph is the same as before, the email requesting an update on the project schedules. The second paragraph is where things get interesting.

 

This is the additional context, the additional bit of engineering that I have provided. "Please make the email stern, since this is a subordinate who's been very lax, needs to buck up, and essentially, I'm planning to escalate. "I'm guiding the tone of the email based on what I'm looking for from Bard, and you can see the tone of the generated email is very different from what we had before. It’s pretty stern, it has a lot of, I’m disappointed, will things be completed, please take this seriously, a lot of strong words to ensure that the subordinate follows up.

 

We all know from the real world that tone is very important and changes based on the situation. Here is the next prompt, I’m asking Bard to generate the same email with the same information, that’s in the first paragraph, but the second paragraph sets the tone. The second paragraph provides the context that will change how the email will sound. “Please make the email gentle, since this colleague is just back from bereavement leave and doesn't want to put pressure on him but would still like the information.” With this little additional prompt engineering, you will get a very different email and you can read through the email and see how it's very soft and gentle, but still requests for the same information.

 

Writing based prompts can be used to generate text for all kinds of situations. Let me show you two more examples where we generate text for different use cases. Here is a prompt requesting Bard to generate a job posting. So, I give it some basic information, it’s for Skillsoft, these are the technologies I want the candidate to know, and it generates a very, very reasonable blog post. This is a great starting point and something that I can use. Now, I hadn’t specified that the job location was in Bengaluru, India, but Bard essentially just added that on.

 

Why could that be? Take a look at the bottom left of the screen. When I used my Google account to sign-in to Bard, Bard got the location information from that Google account and that location was set to Bengaluru, India. And that's why Bard used that location when it generated this job posting. So, you can see that Bard not only uses the context that you provide, but additional information that it has about you to generate text for you. Let's see one last example for a writing prompt. Here I want an ad copy for a cloud security solutions provider. This provider works with all three cloud platforms and uses AI to track security threats. And here is the ad copy that Bard has generated. It uses a lot of superlatives because this is an ad copy, and it kind of explains some other things that you might want to consider while generating ad copies.

Exploring Ideation and Roleplay Prompts

Now in my daily life, here's something that I have encountered. I've felt that I needed to do something, but I'm not sure where to start. Maybe I need to study for something. Maybe I need to plan a party. Maybe it's a dinner party. Maybe I need to get from place A to place B, and I'm trying to figure out the best way to do this. Maybe you want to figure out the best use of your time when you have just two days to spend in a place. Well, in all these situations, you need ideas so that you can get started and move forward in your planning and thinking.

 

Now, traditionally, before generative AI tools existed, the way we would get the stimulus for our thinking is to walk over to a colleague or to a friend and start ideating with that colleague. Well, now you can write ideation prompts and ideate using ChatGPT, Bing Chat or Bard or any other conversational AI service. Ideation prompts often tend to be open-ended because you’re looking for ideas, you’re looking for what they would call blue-sky thinking. You’ll write the prompt, resolve a problem, get some kind of innovation, design something, do some strategic planning, anything.

 

Now, let's say you plan to appear for an interview and they've told you it's a system design interview. Now you’ve not given very many interviews of this kind. You can turn to generative AI tools to help you think through what you need to study. So, “I’m preparing for a system design interview. The job role is for building large scale streaming systems at a media company. What are the topics I should cover?” And Bing Chat here gives me a very comprehensive set of topics that I might want to study to prepare for my system design interview. In addition to all of these topics, it also gives me references where I can get started studying system design.

 

The ideas generated here are for when you are on one side of the interview table. But what if you are the interviewer rather than the interviewee? You have to come up with questions and concepts that you have to test, and these require ideas, as well. So, here is an example of an ideation prompt that you can use. Make sure you set up the context correctly. “I’m going to be interviewing a candidate for a Python developer role. It’s an entry level role, basic Python knowledge. Suggests some questions. The question should cover concepts as well as coding.” and Bing Chat helpfully suggests a bunch of different questions, all based on the Python programming language.

 

And in addition to these questions that were generated, you can scroll down and see that at the very bottom, there are links that you can use to look for interview questions as well. All in all, very useful ideas. Very useful to get started. Ideas can be of different types, and here are some kinds of prompts that I suggest you try out on your own. Try a problem-solving prompt. Ask how you can reduce waste in the manufacturing process.

 

Try a design prompt. Ask Bing Chat or ChatGPT to design a public transport system. Explore concepts. Ask what are the different ways I can recycle paper? All of these are ideas of different types, and you can use prompts to get started and stimulate your thinking. Now, generative AI can be innovative in other ways as well. Let's say you're starting a new project and you're building a prototype, and you want some interesting names for that prototype.

 

You can use a prompt to actually elicit this information using generative AI. “We’re in the process of starting prototyping a new project for a music app, custom song recommendations” and my instruction to Bing Chat is, “Could you suggest some code names for this project?” and Bing Chat comes up with a number of different code names. But really, I must admit I wasn't really satisfied with these. Melody, Rhythm, Harmony, Tune, these are kind of boring names and code names usually tend to be quirky.

 

Let’s see if we can get the kind of response that I’m looking for by having Bing Chat be more creative. I'm going to click on New Topic here, and then specify that I want Bing Chat to work in a more creative mode. Select More Creative. You can see the background changes. And I’m going to ask Bing Chat the exact same question. The question is exactly the same. There's absolutely no change and the response is more or less the same as well. Melody, Rhythm, Echo, Tune. Well, Bing is not being very creative here, so, I’m going to turn my attention to the OpenAI playground where I can control the creativity of the model.

 

If you're looking to generate ideas, it's probably a good idea to use OpenAI playground, where you can use the temperature to control the creativity of the response. I’ve set the temperature to 1.2, so not too high, but higher than the one that is a neutral setting. And I hit Submit. And you can see all of the responses here from GPT-4.I think these responses are much more fun, and what I was looking for. The GPT-4 model has used a lot of alliteration to come up with some interesting names.

 

Now here I am on the OpenAI playground, and I'm going to use generative AI to generate some jokes. That's definitely something creative. And in order to guide the model in the right direction for its creativity, I engineer a very specific prompt. “We are planning on decorating the engineer’s floor in our office. Could you come up with some short, pithy jokes involving programming and other technologies?” Let’s see what GPT-4 has to say.

 

Now, I do have a corny sense of humor, and I must say that I laughed out loud at some of the jokes that GPT-4 generated. Generative AI tools are great at roleplay, and we've seen some of this earlier in this learning path. Roleplay prompting involves creating scenarios where participants take on specific roles and interact with each other based on instructions or guidelines. Roleplay usually involves you setting up a few prompts, providing context and the objectives for the roles being enacted. Let's take a look at an example of a roleplay prompt. Here, I’ve asked Bing to play the role of a customer service agent at a food delivery company, and I plan to play the role of an irate customer. And I’ve asked Bing to be unfailingly polite and helpful and try their best to solve my problem.

 

And you can see that I’ve set up a few initial prompts here, dialog between the customer and the agent, and I’ve ended with Agent: indicating that it’s Bing Chat’s turn to go and produce the next line, acting as the agent from the support center. And you can see that Bing has kicked into action very nicely and asked for my order number and the name of the restaurant. And here I say as an irate customer, “My order number is this, and it’s been a long time. I’m very disappointed.” And since we're in the creative mode, you can see that Bing gets really creative with its response. Bing says that they've contacted the driver. He has confirmed he'll be there in the next 15 minutes. Bing also gives me a coupon I can use for my next order, SORRY10. Since I'm an irate and annoying customer, I still demand an explanation in spite of all of the apologies.

 

Why was the order delayed? That's my question, and you can see that Bing gives me a fairly reasonable response. And really, Bing has been so very polite that I think I'm going to stop bugging Bing for a bit and switch over to ChatGPT for my next role play. Remember, you need to specify the right context for the roleplay and get the conversation started. So here I’ve asked ChatGPT to play the role of an oversmart  teenager and respond to queries from an adult as an oversmart teenager. So, I have the adult asking a question: how was school today?

 

And then, Teenager: to indicate that it’s ChatGPT’s turn to specify a response as the teenager. ChatGPT immediately takes on its role, and you can see the response from an oversmart and smart alecky teenager. Now let’s respond as adults, “Do you like any of your teachers at school?” That's what I ask as an adult. Remember, I’m playing that role and well, here is ChatGPT’s response. They are kind of okay, but I'm not dying to hang out with them after school or anything. Definitely annoying and very teenager-like. Let me be the adult once more, “What are some of your favorite subjects?” I'm curious. I'm trying to have a good conversation here and once again I get a slightly annoying response. You have to admit that ChatGPT is pretty good at this role.

 

Here is another question I ask as an adult, “Got it- what do you do for fun?” and here is the response from the oversmart teenager. Notice that ChatGPT’s response tends to have a lot of emojis. Makes sense. I've been told that's how young people communicate. Overall, I've found in my experimentation that ChatGPT is really very good at roleplay. Here is another example. I asked ChatGPT to play the role of a scientist who always talks in jargon, and the scientist will respond to questions from a colleague.

 

So, I set up the conversation as the colleague, “Did you enjoy your vacation?” I type Scientist and : indicating it’s ChatGPT’s turn. And here is the jargon filled response that I get, which you can read for entertainment, but I'm going to persist. I’m going to ask another question in simple English, “Where did you go?” And I get another jargon filled response. As you can tell, I'm having quite a bit of fun with these prompts here. I ask, “What are you working on now?” and I get a really scary response. Again, something I don’t understand at all because of all of the jargon that’s in there.

Using Mathematical and Predictive Reasoning 

In this demo, where we'll use the OpenAI playground, we'll explore and understand reasoning prompts. Reasoning prompts are questions or statements designed to stimulate critical thinking, problem-solving, and logical analysis. Reasoning prompts are somewhat based on facts, but they’re actually more complex than fact-based prompts. Now, simpler prompts might ask for factual information or personal opinions.

 

Reasoning prompts involve the model much more deeply. They require the model to explain the logic or rationale behind their answer, and may also ask the model to evaluate evidence and maybe use examples to explain their thinking. Now, reasoning prompts can be of different types. You can have analytical reasoning. These kinds of problems may not involve math, but will involve some kind of logical analysis.

 

You can have mathematical reasoning as well, where you pose math problems, and then ask the model to explain how the solution was arrived at. In this demo, we'll primarily focus on mathematical and logical reasoning. But really, these are not the only categories that generative AI can work with. Now I’m going to use the GPT-3.5 turbo model for this. That's just a preference here. No real reason. You can use GPT-4 as well if you want to. We'll start with mathematical reasoning, but before I pose any kind of math problem, let me ask ChatGPT because GPT-3.5 is ChatGPT, “How good are you at math, ChatGPT?” Well, it gives me a very generic and boring answer, but it does say that it can help me with math, so, let’s put it through its paces.

 

Here’s a bit of historical context. Now, generative AI tools such as ChatGPT were only recently released. The earlier, less powerful models that were used to power ChatGPT were actually very bad at Mathematics, and they would get very simple math problems wrong. However, over the past few months, as newer models have been released, these models perform fairly well at math. As far as simple middle school mathematics go. I have no complaints. These models have done really well, as you'll see in a bit. Let's ask it a simple question: what's 234 plus 456?And it gives me 690, which is absolutely correct.

 

Now, before I go on with more mathematical problems, let me lower the temperature back to one. I really don't want the model being creative when it responds to reasoning problems. The model can clearly add well, let’s ask a subtraction problem 1234 -237,and the model gets it right here as well. I cross-checked all of these answers using a calculator. Let's try again with a multiplication problem 1289 multiplied by 498. And the model gets this right as well. So simple mathematics, well, it’s spot on once again. Now, I did mention that older models were not very good at mathematics. And let me prove that to you.

 

I'll now switch over to the older text completions API. The latest model for this API is the text-davinci-003. Let’s go back to an older model. Let’s go back to text-davinci-002.This model is part of the GPT-3 series, but it’s less powerful than GPT-3.5. And with my experimentation, I've found that this is definitely a model that's not great at math. I’ll now go beyond simple arithmetic, and I’ll ask thistext-davinci-002 model to solve an algebra problem “4x+ 3= 31-Please solve for x” and you can see this model is fairly decent. It actually worked things out without explanations though and got the right answer, x = 7.

 

Now let's ask the same questions using the chat completions API. We know that the model that we’re using, GPT-3.5 turbo, is more powerful and more versatile. Again, the same algebra problem, “4x + 3 = 31”and here I get the solution along with working and explanations. Even though I did not explicitly ask for these. In older models, you often had to instruct the model to give you the intermediate steps to guide the model to the right result, but with newer models, you no longer need to do this. The newer models tend to automatically solve your math problems in a step-by-step manner. That was a simple algebraic equation.

 

Let’s see how our GPT-3.5 model performs with a simultaneous equation. “Please solve for A and B”, and I've given two equations here and it gets this answer right as well. You'll have to take my word for it, because I'm not going to walk through the math. But the answer is, a= 3 and b= 0,the model got it right, and it solved this simultaneous equation in a step-by-step manner with details for each step.

 

And you can see the right answer here at the bottom, a=3 and b= zero. Let's see if we can get some of the other models to give us the same result. Let's move back to the completions API and switch over to the text-davinci-002 model, and let’s ask it the same simultaneous equation. And you’ll see that this model doesn’t get things right. a= 1, b= 2, we know it’s wrong and it doesn’t give us any intermediate steps. The text-davinci models are all powerful models, but they are legacy models and more tuned to understand and generate natural language. And they really are not very good at math. Let's try posing this model with a word problem. “A cloth merchant bought 35 shirts at a price of 280,and sold each of them for 308. What’s the percentage profit?”

 

And it simply says 8.28% , which is completely wrong. And there are no steps here as well. Unless you have a specific use case for these legacy models, you're unlikely to be using them in your apps. So, let’s switch over to the chat API, and let’s ask some math and reasoning questions of GPT-3.5.We’ve done arithmetic, we’ve done algebra. Let’s move forward to word problems. Here is the same one as before, the cloth merchant, 35 shirts, Rs.280 and essentially sold them at Rs.308.Rupees is the Indian currency. We want to find the profit percentage.

 

Not only does GPT-3.5 get things right, but it also works out the problem step by step. This kind of emboldened me to pose another word problem. And this word problem I think is much more difficult. “The article was sold for Rs. 2,400 at a profit of 25% . What would have been the profit or loss had it been sold for Rs. 1,800?” and here is the response from the model, and the step-by-step instructions and the response. Well, the answer is absolutely correct. At Rs.1,800, the loss incurred would have been Rs.120.Let’s look at another word problem, a time and distance problem. “Two athletes are running from the same place with different speeds and in the same direction. I want to know the distance between them after ten minutes of running.”

 

And here is the response, and you can see it’s very step by step. It first computes ten minutes equal to one sixth of an hour. Then it computes the relative speed. It then uses the speed-distance formula. It writes the formula out for you and gives you the result, 1/3 Km. We’ve looked at how these models deal with mathematical reasoning.

 

Let’s look at some examples of logical reasoning. Here is a prompt, “Aubrey is my friend and Brett is my friend. Are Brett and Aubrey friends?” Well, the model is quite smart about this. Based on the given information it doesn’t know. Now, for all its abilities, the models may not get your math and logical reasoning correct at all points in time. Here is an example where the model gets things right. “There are two ducks in front of a duck and two ducks behind the duck. How many ducks are there?” The right answer is three ducks, and it gets this.

 

Now out of curiosity, I said, well, GPT-3.5 got this. What if I switch to GPT-4?Will it get the answer and give me an explanation as well? Let's check it out. So, I send the same prompt once again. But this model gets things wrong. It says there are five ducks and it doesn't give me any explanation either. Now, based on this information, you can’t say that GPT-4 is worse than GPT-3.5 for logical reasoning, because it gets some complex things right. “A man has 53 socks in a drawer. 21 identical blue, 15 identical black, and 17 identical red.” He wants to be 100% certain that he gets a pair of black socks. How many socks will he need to pull out? And you can see the model correctly tells us that he has to pull out 39 socks. And the model also gives us an explanation, a very good one, for why there are 39 socks that need to be pulled out.

 

After mathematical reasoning and logical reasoning, you can use these models for predictive reasoning as well. I’ll switch back to GPT-3.5 and here is a predictive reasoning question, “Mary gets a haircut whenever she goes out shopping during the day. Mary went shopping during the day yesterday. What can you deduce about Mary today?” You can see that the model is guarded in its response. It says Mary likely got her haircut yesterday, but it doesn't know anything about Mary today. Here is another example of a predictive reasoning task, “When it gets really hot in Bangalore, it rains. It’s really hot in Bangalore today so today evening it’s likely to? And the model says, rain.