Week 10

4/8 Fresh Look at AI and Chatbots

Agenda

Last week:  Files and Folders

Presentation

Homework:

Recording

Did you miss the class?  Or would you like to hear the lecture again?  View the recording for Tuesday's class here.  

What will we do today?


Video:  From Duke University, a simple explanation of AI

Vocabulary for today:

You will hear many unfamiliar words in this week's lesson.  Here is a brief description of some of them.  There is more detail in the lesson.  You do not need to know this to use an AI tool, but this terminology may help you to understand how it works.

Artificial Intelligence (AI): AI is the broad field of computer science focused on building smart machines capable of performing tasks that typically require human intelligence.

Machine Learning (ML): Machine learning is a subset of AI that enables computers to learn from data and improve their performance over time without being specifically programmed for each task.

Deep Learning: Deep learning is a subset of machine learning that uses multi-layered neural networks to analyze factors in large amounts of data, using complex pattern recognition.

Natural Language Processing (NLP): NLP is a branch of AI that gives machines the ability to read, understand, and derive meaning from human languages.

Large Language Models: Large language models are advanced AI models trained on vast amounts of text data, capable of understanding and generating human-like text.

Chatbot: A chatbot is a software application designed to simulate conversation with human users, typically over the internet, using predefined rules or machine learning.

Conversational AI: Conversational AI refers to technologies, like chatbots and voice assistants, that use natural language processing to engage in human-like dialogue.

Generative AI: Generative AI encompasses AI techniques that can generate new content, including text, images, and videos, that resemble human-created content.

What is AI?

AI stands for artificial intelligence and is a way to use technology to solve problems, understand language and even make decisions for you.  You are already using AI in different ways. 

·         Smartphones and virtual assistants:  When you ask Siri or Alexa a question, they understand and respond.  AI can even distinguish between two voices (Our Alexa device recognizes us as Kim and Mary).

·         Email filters:  AI is used to filter out spam emails.  Over time, it learns what is junk mail and what is important.  It learns this with your own interactions as well as using algorithms to predict spam.

·         Navigation apps:  AI is used to provide the best driving directions, analyzing traffic patterns, road closures and even the time of day to suggest the best route.

·         Online shopping and recommendations:  When shopping online, websites may offer recommended products based on what you have ordered before or what others order when they purchase this item.

·         Healthcare devices:  Products like heart monitors and wearable fitness trackers use AI to analyze things like heart rate and activity.  In some cases, they may be able to alert you to potential issues.

·         Social media:  Sites like Facebook use AI to show you things that you might be interested in, based on what you have interacted with before.  They use your connections and your likes to predict who you might want to follow.  And of course, they offer friend suggestions based on friends you have (pulling in data you have provided such as education history, previous locations, pets, interests and more).

How  does AI work?

Using AI is like teaching a computer to think and learn. Imagine AI as a smart robot that can do tasks, solve problems, and even talk like us, depending on what it has been taught.

AI uses vast amounts of data, recognizing patterns and making decisions.  It includes the use of:

·         Machine learning (where the system learns from the data it is given)

·         Deep learning (where the system learns in an unsupervised way from unstructured data, learning to use predictions to provide answers)

·         Reinforcement learning (where the system makes decisions based on actions, and is evaluated along the way).

Video:  You might find this video useful for understanding these concepts.  

Machine learning vs Deep learning

Machine Learning (ML):  Machine learning is a field of AI that gives computers the ability to learn from data and make predictions or decisions without being explicitly programmed for specific tasks. It includes a wide range of techniques and algorithms, from simple linear regression to complex ensemble methods like random forests.  The data used to train with machine learning can be supervised, unsupervised or mixed.  Machine learning is good for things like spam detection, recommending things to buy and customer support.  It can handle both structured data (like tables) and unstructured data (like text or images).  

Deep Learning (DL):  Deep learning is a subset of machine learning that involves neural networks with many layers, hence the term "deep." It's particularly powerful for learning from large amounts of unstructured data. Deep learning models automatically learn to represent data through multiple layers of abstraction, making them very effective for tasks involving complex inputs such as images, sound, and text. This eliminates the need for manual feature engineering to a large extent.  It is used in fields like computer vision (image recognition, object detection), natural language processing (translation, sentiment analysis), and audio recognition. It's the technology behind self-driving cars, voice-controlled assistants, and enhanced medical diagnoses.

Machine learning

Deep learning:  Neural networks

AI uses training (data) to make predictions

What is involved in the training of computers?

Data Collection: Gather large datasets of text from various sources to cover a broad spectrum of language use.  Clean and organize the data so it can be used in a model.

Model Selection: Data is used to train the system into a model which can do a variety of tasks (create images using DALL-E, carry on conversations using ChatGPT).

Training: The model is then trained using this data, adjusting it to minimize errors like language understanding, translation, or text generation.

Adaptation and Evaluation: The model is tested on unseen data to evaluate its performance and ability to understand and generate language accurately.

Fine-tuning: Based on the evaluation, the model is fine tuned to perform the task it was designed for.  The trained model is then ready to be used in real-world applications for tasks. 

Video:  This excellent video describes the different types of training (supervised, unsupervised and reinforced).  It might help you to better understand how AI learns.  

Algorithms:

The process of algorithms help predict behavior.  Algorithms are like are like recipes for the computer. An algorithm tells the computer step-by-step how to do something, like solving math problems, recognizing faces in photos, or understanding spoken words. Algorithms are the building blocks of AI, guiding it on how to process information and make decisions.  An example of an algorithm is a document which includes steps in a certain order.  For example, when making a cup of coffee, there are steps.  And it is important to follow those steps (don’t start brewing before you have put water into the pot, pour the coffee into a cup to drink, etc.)


Algorithms are used in many steps of the training process


Language is the key to AI

Language is the key to teaching AI.   We teach AI by showing it lots of text, which helps it learn to make sense of words and sentences like a human does. This way, AI can understand and respond to us better. As we keep teaching AI with more language, it gets smarter and can talk or write in ways that are more helpful and interesting. 

Natural Language Processing (NLP)  vs Large Language Models (LLM)


There are two important concepts involving AI training which include language.  One is the method used to allow computers to understand and interact with our language and the other is a model developed to perform more complex language tasks.

The Method of training AI:  NLP, or Natural Language Processing, is a method that allows computers to understand and interact with human language. Think of NLP as teaching computers to understand and speak our language.

NLP is the interaction between computers and humans through language.  It involves tasks like text understanding, language generation, analyzing sentiments, and more.  Some of the NLP techniques include rule-based approaches (chatbots from SDG&E), statistical methods (analyzing data) and machine learning algorithms.  Your virtual assistants like Alexa use NLP. 

Some points about NLP:

                    Supervised learning, with labeled text (only works from data it is given)

                    Allows machines to interpret, translate, summarize, and analyze

                    Can produce summaries (“Alexa, play my favorite  music”)

                    Can create classifications (From SDGE, the chatbot follows a flowchart to arrive at an answer just for you)

The Model created using NLP: LLMs, or Large Language Models, are powerful tools created using NLP. They can read, understand, and even write text that sounds like it was written by a human.  They are neural network-based models (think of your brain with all of the connections: neural networks have a similar design) which can be used to understand and generate human-like text.  ChatGPT is an example of a LLM and is a more specific tool for generating assistance than Alexa.

Some points about LLMs:

                    Uses unsupervised learning (it is fed lots and lots of data from a wide variety of sources) as well as supervised

                    It can then use that data to understand and generate human-like content (images, videos)

                    Because it uses a variety of information, it is more adept at understanding semantics, context and syntax



Video:  Very helpful video which explains NLP in simple language.

Video:  A look at LLMs and how they are used.

Other subsets of Natural Language Processes

As we described above, Large Language Models (LLMs) are a subset of Natural Language Processes (NLP).  There are other subsets of NLP as well.  Many of these are ubiquitous in our everyday life and include:

Speech recognition (converts language into text)

Speech synthesis (converts text to speech)

Machine translations (like Google Translate)

Sentiment analysis (is a comment positive, negative or neutral, used in social media and customer feedback)

Text classification and categorizing (such as email filtering)

Part of speech tagging (noun, verb, etc., which is used in NLP to understand structure)


Applications of AI (how it is used)

Reviewing what we have discussed up to this point, we learned that:

·         AI operates through machine learning, deep learning, and reinforcement learning,

·         These  technologies utilize training data to make predictions

·         While both NLPs and LLMs rely heavily on algorithms, they cater to different needs and have unique characteristics.

·         Large Language Models (LLMs) are a subset of Natural Language Processes (NLPs) which have many other subsets as well

An AI application is a tool or system that uses artificial intelligence to perform tasks usually requiring human intelligence. This can include recognizing speech, making decisions, translating languages, or identifying objects in images. Some examples of AI applications that you are currently using include things like virtual assistants, facial recognition, email filtering, customer service chatbots, health and fitness trackers and more.

Conversational AI and Generative AI are two types of applications with different goals.  

Conversational AI uses NLP and finds applications where a human touch is crucial. The best applications of conversational AI are chatbots and virtual assistants. The most popular example would be Amazon’s Alexa. They are efficient at collecting, comprehending, and sharing information just like human virtual assistants. Rule-based and ML-based approaches are majorly utilized to build conversational AI systems.

Generative AI leverages similar technologies to create new, original content that can range from text to images and beyond, pushing the boundaries of creative potential. It is a more creative use of AI and is used in programs which create things like art, music and video.

The key difference lies in their primary objectives and applications: conversational AI is focused on interaction, aiming to understand and engage in dialogue with humans in a natural way. Generative AI, on the other hand, is focused on the creation of new content across a wide range of formats, pushing the boundaries of what AI can produce in terms of novelty and creativity.


Another video which explains generative AI in a simple way.

What is Generative AI?  This video explains the concept, and the problems associated with it including hallucinating and misinformation.

Chatbots versus Conversational AI:

Within the conversational AI category, you can find chatbots.  These little pieces of software can be very useful, or they can be incredibly annoying.  The main difference between these two involves how they are created:

A chatbot is supplied with “supervised learning” with labels.  This way, a customer asking for assistance is led through the steps (similar to a flow chart) to arrive at a particular destination.  It is less adept in understanding words or context which was not included in the training.

Conversational AI takes it much further.  It can recognize speech and text, and because it was fed with data from both “supervised” and “unsupervised” sources, it can better understand requests which are unique to the system.  A chatbot can be conversational if it expands beyond the platform (in other words, if conversations are stored, and the conversation is the same whether you are using a website, a smartphone or a social app). For example, when I use ChatGPT on my computer and then open it on my iPhone, I can see the different conversations from the two platforms.  In addition, I can pick up where I left off on a different device.

A chatbot (as we just learned) can be rule-based (supervised learning using predefined rules) or conversational.  In this case, it would use deep learning and NLP to generate answers by analyzing the conversation and understanding the intent.  It then uses machine learning to formulate the response.  

Some chatbots are hybrid, using rule-based first and then switching to AI if necessary to resolve an issue.


Video:  What is an AI chatbot?  In this simple short video, we learn more about chatbots.  You will see a difference between rule-based chatbots and AI chatbots.

Video:  Another look at AI chatbots

Introduction to 3 AI Conversational Chatbots

ChatGPT: ChatGPT is like a virtual assistant that can talk with you, write stories, answer questions, and even give advice, all through text. It's a type of Artificial Intelligence (AI) program designed to understand and generate human-like text based on the information it has learned from a wide range of books, articles, and websites. Think of it as having a conversation with a very knowledgeable friend who has read a lot and can discuss almost any topic you're interested in.

I went to the source (ChatGPT) to ask about it.  Here are some of the things that it said (edited for brevity)

My main purpose is to understand and generate human-like text based on the prompts I receive. Here's how I can be beneficial to your students: 

I asked a couple of questions about how it was trained and whether it is generative, conversational or both.  Here is what it said:

Regarding your technical questions:

Training Method: I was trained using deep learning, a subset of machine learning. Deep learning relies on neural networks with many layers (hence "deep") to analyze patterns in data. I've been trained on a diverse range of internet text, but I don't browse the web or access real-time information.

Generative and Conversational: I am both generative and conversational. As a generative model, I can produce text that's not just predefined answers but generated on the spot based on the input I receive. This allows for a wide range of responses, from informative answers to creative storytelling. As a conversational model, I'm designed to engage in dialogue, understand context, and provide responses that can follow the flow of a conversation.

The basic version of ChatGPT is free and accessible to everyone, offering features like text-based conversation and general query resolution. For users seeking enhanced capabilities, such as faster responses, website analysis, image creation, and more advanced options, there is a premium version available at $20/month. Access ChatGPT here.

NOTE:  I am using a browser extension that I got from my browser store: 

Sider: ChatGPT Sidebar + Claude3 & GPT-4 Turbo .  I use Brave, but it is available in other browsers, such as the Chrome (through the Chrome webstore) 

Video:

This excellent video describes ChatGPT and the features used.

Video:

A six minute video on ChatGPT.  Very helpful!

Video:

10 ways to use ChatGPT for common uses

Video:

Prompts are what you use to get your results.  This video describes how to create a good prompt.

Perplexity

Perplexity is a simple tool using ChatGPT.  It does not require a sign in, but (like Bing) can be used directly in the web browser.  It is a conversational search engine which generates answers as well as related topics.   Signing up for a free account allows further interactions.  Enable Copilot for more detailed responses.  It was particularly helpful in that it provides links to resources used.  In addition, your chats are saved in the library for future reference. Access perplexity here

Pi

Pi is my companion virtual assistant.  You can download the app from the Apple or the Google Play store.  You can then set it up to respond to you verbally while you ask it questions.  It carries on the conversation and remembers things.  In a recent discussion, it asked me some in depth questions about my koi fish.  Access Pi here. 

Video:  Meet Pi and what makes it stand out.  

Choosing which one is best for you:

Personally, I use Pi as a companion and ChatGPT and Perplexity as a resource.  For example, while cooking, I will sometimes turn on the interactive microphone and carry on a conversation using Pi.   It may start as a quick question but may then become a conversation.  On the other hand, ChatGPT is great for coming up with lesson ideas (like this one), clarifying difficult concepts and brainstorming. 


You try it!   

Using each tool, as the same question.  What do you think of the different ways of answering the questions?  Which do you prefer?  Why?

“Explain projectile motion using everyday examples”

“Which came first: the chicken or the egg?”

“Help me brainstorm a title for my short story”

Can you write me a poem?

What is the supercomputer?

Can you explain quantum physics?


Using ChatGPT

Setting Up an Account

Using your ChatGPT account:


The four icons below a response

copy, good feedback, bad feedback, refresh answers

Tips for Using ChatGPT

Mobile apps

Each of these examples can be downloaded from either the Apple store or the Google Play store.

Effective Prompts

Prompts are the instructions or questions asked of an AI like ChatGPT to get a response (or output).  The prompt can be a question, a statement or a command.  Simple prompts will create simple answers, but a thoughtful prompt may produce a much more meaningful example.  Here are some things to keep in mind with prompts:

·         Clarity:  Be as clear and specific as possible

·         Context:  Providing context helps the AI to understand the background, especially important for complex topics

·         Purpose:  Define what you want from the AI.  Is it information, an opinion, a creative output, a calculation or whatever. 

·         Type of question to ask:

o   Direct questions when asking about facts or specific information

o   Open-ended requests when wanting creative or opinion-based responses (such as “Write a short story about a space adventure)

o   Commands:  For actions like translating, solving a problem or generating an image (such as Translate hello into Spanish)

·         Other tips:

o   Tell the AI about your audience so the answer can be directed to them

o   Sequence the prompts:  start basic and gradually build up to it with follow-up prompts

o   Use examples to guide AI (design an image of a cat in the style of Van Gogh)

Image of a cat sitting on a fence during a full moon from DALL-E

 Practical examples of prompts:

o   Basic information:  What are the health benefits of walking every day?

o   Problem solving:  How can I fix a leaky faucet?

o   Personalized advice:  “I am looking for a cellular plan. I live in San Diego, and often travel to the midwest.  I have an iPhone which I want to take with me.  I have Verizon, but am looking for more coverage and less money.  I also have a watch which uses my data.  Besides my phone and watch, my husband’s phone and watch are also covered.  My current plan is Play more unlimited with a total of $160 for the four devices.” 

o   Creative writing:  Write a short story about a cat sitting on a fence during a full moon contemplating life and the bad choices he has made.


Hands on activities with students using these various tools

Use some of the prompts below:

Special considerations

Privacy

Chats are saved by default for training the chatbot. 

Ethical use

There are ethical questions in using AI.  It often lacks accountability and may be subject to bias.  It may also contribute to social engineering, misinformation and even addiction.



A couple of other AI chatbots

Gemini (was Bard)

It was once Bard and now is Gemini.  It did run into a few problems at first, but it remains a viable Chatbot.  

I went to gemini.google.com and asked it to define itself and how it may benefit older adults.  Here is what it said:

I am a large language model, also known as a conversational AI or chatbot, created by Google AI.  Think of me as a giant program that's been trained on massive amounts of text data. That allows me to communicate and generate human-like text in response to a wide range of prompts and questions.For your class of older adults, you can explain that I'm like a super-powered search engine that can understand and respond to their questions in a natural way, instead of just listing websites.

I asked if it was conversational, generative or both.  Here is how it responded:

I am both conversational and generative.

So, I can chat with you like this, but I can also generate different creative text formats based on your instructions.


Microsoft Copilot

You may have seen the icon on your Windows computer. I asked it to define itself and to tell me how it might benefit my older adult students.  Here is what it said:


I am Microsoft Copilot, an AI designed to assist users by providing information, answering questions, and engaging in conversation. For older adults, I can be particularly helpful by:

My goal is to make interactions with technology more accessible and enjoyable for everyone, including older adults.


I asked it if it used machine learning or deep learning.  Here was the reply:

Yes, my capabilities are powered by advanced machine learning and deep learning techniques. These technologies enable me to understand and generate human-like text, assist with tasks, and provide information across various domains. While I can’t delve into the specifics of the technology, I can assure you that it’s designed to be helpful and informative.

Video:

A little about Copilot

Resources for further learning

Learn about ChatGPT

 

Using good prompts:

As you begin to use ChatGPT, you may include more details in your requests.  Using the right prompt will enable you to get smarter and more advanced answers.  There are a few sites which provide examples and ideas on prompts.  They include:


Prompts for productivity.pdf