X11 Chapter | Academic Writing
Generative AI: Large Language Models (LLMs)
Learning objectives
After studying this chapter, students will be able to:
Explain what Generative AI is and how it differs from regular AI.
Explain the concept of a Large Language Model (LLM) in simple terms.
Understand how LLMs learn using large amounts of data.
Recognize the basic concepts of tokens and embeddings.
Understand the difference between the training and inference stages.
Recognize the importance of preparing good prompts.
Discover the main applications of LLMs.
Recognize limitations and issues such as hallucination, bias, and privacy.
Perform simple Generative AI tasks using Python or available AI tools.
Understand the need for responsibility and ethics when using AI.
Introduction
If you ask an AI chatbot,
"Prepare a short note about the major tourist attractions in Kerala."
It will prepare a note within a few seconds. Similarly, AI tools can be used today to write a story, prepare an email, write the code of a program, explain a topic in a simple way, prepare a film idea, and shorten a long note.
AI technologies that can create such new content are called Generative AI.
Generative AI has become familiar to ordinary users after 2022 with the popularity of AI applications like ChatGPT. But there are many technical concepts behind typing a question into a chatbot and getting an answer.
One of the important ones is the Large Language Model (LLM).
In this chapter, let's get acquainted with what LLM is and how it learns.
What is Generative AI?
AI, or Artificial Intelligence, is a broad field of technologies that provide computer systems with some of the capabilities associated with human intelligence.
AI is used in many ways, such as recognizing an image, understanding speech, finding patterns in data, and helping with decision-making.
Generative AI generally refers to AI systems that can generate new content.
They can generate the following types of content:
A simple example
If you ask an AI:
"Write an eight-line poem about rain."
The AI will create a new poem based on the given instructions.
This is the basic idea of Generative AI.
Remember
Generative AI doesn't always know everything like humans do. It uses patterns learned through training to create new output.
What are Large Language Models (LLMs)?
One of the main technologies used in generative AI for text generation is the Large Language Model, or LLM for short.
Let’s look at each word in the name.
Large – The model is trained using a very large amount of data.
Language – The main focus is on handling human language text.
Model – A computational system that has learned patterns from data.
So in simple terms:
An LLM is a large AI model that has been trained to understand and generate text by learning patterns in human language.
LLM technology is used behind many applications such as chatbots, writing assistants, and coding assistants.
How do LLMs learn?
Imagine a student learning a new language.
The student:
Learns new words.
Sees how words are used in sentences.
Reads several sentences.
Identifies patterns in the language.
Then tries to construct sentences of his own.
LLM training has some similarities to this. However, LLMs do not learn like humans.
A large amount of text data is fed to a model. The model is trained to find linguistic patterns in this data.
For example:
"The sun rises in the ___."
If the model sees the sentence "The sun rises in the ___."
then the model might learn that "east" is more likely to come next.
From these many examples, the model learns patterns in the language.
Importantly, an LLM does not learn like a human would memorize the pages of a book. During training, the model's parameters are adjusted based on the patterns in the data.
Tokens: Breaking down language into smaller pieces
Computers cannot directly process words and sentences that humans read. So the text is broken down into smaller pieces and fed to the model.
These smaller pieces are called tokens.
A token can be a whole word. Or it can be part of a word. Punctuation marks can also be considered tokens.
For example:
"Artificial Intelligence is useful."
The sentence can be broken down into multiple tokens according to the model's tokenizer.
Tokenization is the process of breaking down text into tokens.
Think
Is every word in a book a token?
Not necessarily. A word can be broken down into one or more tokens, depending on which tokenization method is used.
Embeddings: Words as Numbers
A computer cannot directly understand the meaning of the words "cat", "dog", and "school" in the same way that humans do.
AI systems convert text into numerical representations.
One important concept in this is embedding.
Embedding is the process of converting a word or token into a numerical representation that represents its semantic relationships.
For example, "cat" and "dog" have some similarities. Both are animals. The word "cat" may also have some contextual relationships with the word "mat".
Embeddings help the model handle such relationships.
Fact Box
Tokens help break text into smaller pieces.
Embeddings help the model convert the information in the tokens into a numerical representation that the model can calculate.
What is Training?
Training is a key step in building an LLM.
During training, a large amount of data is fed to the model. The model uses that data to learn patterns and adjust its internal parameters.
Let's look at a simple example.
"The capital of France is ___."
A large number of examples will help the model learn that "Paris" is a correct continuation.
The model is trained using a very large number of examples.
Training is a very computationally intensive process. Training large models requires a powerful computing infrastructure.
What is Inference?
After training is complete, inference is the process of generating output using the model.
For example, you ask:
"Explain photosynthesis in simple words."
The model accepts your prompt. It generates the appropriate output using the learned parameters.
This is inference.
Remember
Training = Learning
Inference = Generating output using the learned model
What is a Prompt?
A prompt is an instruction or input that we give to an AI model.
Example:
"Explain climate change in 100 words for a school student."
This is a prompt.
The clearer and more detailed the prompt, the more likely it is to improve the usefulness of the output.
Prompt Engineering
The process of creating clear and effective prompts to get the desired output from AI is called Prompt Engineering.
A typical prompt:
"Write about computers."
This is very general.
It can be written more specifically:
"Write a 150-word introduction to computers for Class XI students. Use simple English and include two real-life examples."
In the second prompt:
The target audience is specified.
The number of words required is specified.
The language is specified.
Examples are requested.
So this is a more helpful prompt to get the desired output.
Some ways to create a good prompt
1. Specify the task: Say directly what is required.
2. Provide context: Specify who the output is for.
3. Specify the format: You can say which of the following is required: Paragraph, table, list, etc.
4. Provide constraints: You can specify the word limit, language, difficulty level, etc.
5. Check the Output: Check the output provided by the AI before accepting it directly.
Applications of LLMs
LLMs are used in various fields today.
Education
Explaining a topic in a simple way
Helping to prepare textbooks
Creating practice questions
Helping with language learning
Software Development
Preparing code examples
Explaining code
Helping to find errors
Preparing documentation
Business
Preparing emails
Summarizing reports
Assisting in customer support
Preparing product descriptions
Content Creation
Article ideas
Summaries
Scripts
Brainstorming
Accessibility
LLMs are also helpful in some language-related tasks. For example, simplifying text, helping with translation, and reducing large text.
Real-Life Example: A Student and LLM
Mini is preparing a science project. The topic is "Water Conservation".
She asks the AI:
"Give me project ideas on the topic of water conservation."
The AI gives several ideas.
Mini chooses one idea from them. Then she asks:
"Explain this idea in a way that is suitable for a Class XI science project."
The AI gives a more detailed answer.
But Mini does not copy the information provided by the AI into the project without checking it. She checks the information using the textbook, sources suggested by the teacher, and reliable websites.
This is a good example of using AI responsibly as a learning assistant.
Limitations of LLMs
While LLMs are powerful tools, they do have limitations.
Hallucination
AI can sometimes confidently provide false information. Such false or unfounded output is commonly referred to as AI hallucination.
For example, an AI might say that a book, research paper, person, or event exists that does not actually exist.
Why does this happen?
LLMs typically generate text by predicting the "next most likely token." So the output is not necessarily fact-checked and verified like a human.
Rule of thumb:
Don't assume that the information provided by AI is correct. Check for important information.
Bias
If the training data contains some biases from human society, they can be reflected in the model output.
This is called bias.
For example, a model may produce output that suggests that a particular job is only suitable for a certain group of people.
So when examining AI output, you should pay attention to:
Is it fair to all groups?
Are there unnecessary stereotypes?
Is one group unfairly represented?
Privacy
Privacy is also important when using AI tools.
Avoid unnecessarily providing sensitive information to a chatbot, such as:
passwords
bank account information
personal identification information
confidential school/business documents
personal information about another person
It is a good idea to understand the privacy policy, data handling practices, and rules of your institution before using an AI tool.
Ethical Concerns
Generative AI requires technical expertise as well as responsibility.
Academic Integrity
Submitting an entire assignment created using AI as your own work may raise academic integrity concerns.
Check with your school/board to see if AI is being used in a permitted manner.
Copyright
Copying and using copyrighted content of others without permission can be problematic.
Misinformation
AI-generated content may not always be accurate. Therefore, important information should be verified.
Human Responsibility
AI is a tool. Humans are ultimately responsible for making decisions.
Did You Know?
Humans ask questions, but do AIs think?
It is not correct to directly compare the functioning of LLM with human thinking. LLMs learn patterns in language and generate output based on input.
Therefore, it is not necessary to assume that AIs think with consciousness, experience, and emotion like humans.
Classroom Activity: How to Write a Good Prompt
Activity
Consider the following prompt:
"Tell me about India."
This is a very general prompt.
Make it a better prompt.
Example
"Write a 200-word note on space research in India in simple language that Class XI students can understand. Include two important examples."
What you need to do?
Write a general prompt.
Rewrite the same prompt to be more specific.
Compare the output obtained using the two prompts.
Discuss which one is more useful.
Think & Discuss
Does adding more words make a better prompt, or does providing the necessary context make it better?
Python/AI Tool-Based Practical Activity
Activity: Asking Questions to an AI Model
Objective
Understand how the format of the prompt influences the output.
Requirements
Internet connection
A teacher-approved AI tool
Browser
If you have a Python environment, you can also use it
Step 1
Enter the following prompt in the AI tool:
"Explain artificial intelligence."
Observe the output.
Step 2
Now enter a more specific prompt:
"Explain what Artificial Intelligence is in 100 words in simple language that a Class XI student can understand. Give two real-life examples."
Compare the two outputs.
Step 3: Observation
Record the following:
Which output is more specific?
Which output is more relevant?
What is the additional information provided in the second prompt?
How can we check whether the facts provided by the AI are correct?
Python Extension Activity
Write a short program using Python.
Accept a question from the user and display it on the screen.
question = input("Enter the question to ask the AI: ")
print("Your question:", question)
Think about it: What additional components would be needed to send this question to a real AI service?
Case Study 1: Project Work Using AI
Aby was preparing his Computer Science project. To save time, he prepared the entire project report using an AI tool.
The report looked great, but when the teacher checked some of the references, he found that some of them did not exist.
Let’s discuss
What was Aby’s main mistake?
How could AI-generated information be verified?
How can AI be used responsibly in project work?
If the school requires the use of AI, does it need to be disclosed?
Case Study 2: Personal Information
A student was using an AI tool for his school project. He copied an entire confidential document he received as part of the project into the chatbot.
Let's discuss
What is the privacy issue here?
What should you do if the document contains personal information?
What should you check before using an AI tool?
Case Study 3: AI Hallucination
A student asked an AI about a specific historical event for a history project. The AI gave a very detailed answer. It included some dates and names of people.
The student incorporated it directly into the project. Later, when he checked the textbook, he found that some of the information was incorrect.
Let's discuss
Which AI limitation is this?
How can we cross-check the information provided by the AI?
Should we assume that the AI is correct because it gave such a confident answer?
Summary
In this chapter, we have been introduced to Generative AI and Large Language Models.
Generative AI is generally referred to as AI systems that can generate new content such as text, images, audio, video, and code.
LLMs are AI models that have been trained to process text by learning patterns in human language.
LLMs are trained using large amounts of data.
Text is divided into small pieces that the model can process. These are tokens.
Embeddings are a concept that helps the model process tokens as numerical representations.
During training, the model learns.
During inference, the learned model is used to generate output.
The prompt is the instruction or input given to the AI.
Prompt engineering is the method of creating a good prompt.
LLMs are used in fields such as education, software development, business, and content creation.
LLMs have limitations such as hallucination.
Ethical concerns such as bias, privacy, copyright, and academic integrity should be considered.
AI output should be fact-checked on important issues.
AI is not a replacement for human responsibility; it is a supporting tool.
Key Terms
Artificial Intelligence (AI): The field of technologies that enable computer systems to perform some of the functions associated with human intelligence.
Generative AI: AI systems that can generate new content.
Large Language Model (LLM): An AI model trained to process and generate text by learning patterns in human language.
Token: A small portion of text that an AI model handles.
Tokenization: The process of dividing text into tokens.
Embedding: A method of representing text or tokens as a numerical representation.
Training: The process of teaching an AI model using data.
Inference: The process of generating output from a trained model.
Prompt: An instruction or input given to an AI model.
Prompt Engineering: The process of effectively crafting prompts to produce a desired output.
Hallucination: A situation where an AI model produces factually incorrect or unfounded information as output.
Bias: An output or pattern that shows an unfair tendency in favor or against one group.
Privacy: Security and control of personal and confidential information.
Back Exercises
Objective Questions
1. Fill in the blanks
a) AI that can generate new content is called __________ AI.
b) __________ is an abbreviation for Large Language Model.
c) Small parts of text are called __________.
d) The stage where the AI model learns is __________.
e) The stage where the trained model generates output based on the user prompt is __________.
2. Choose the correct answer
1. Which of the following is an example of Generative AI?
a) Calculator
b) Text generation system
c) Digital clock
d) Keyboard
2. One of the main functions of LLM is:
a) Print only images
b) Process and generate text using patterns in language
c) Control the electricity of the computer
d) Build a keyboard
3. What is Prompt engineering mainly used for?
a) To repair a computer
b) To prepare good AI instructions
c) To increase internet speed
d) To upgrade hardware
4. AI hallucination is:
a) AI shutdown
b) AI generating false information
c) Computer virus
d) Internet failure
5. Which of the following is sensitive information?
a) A general historical information
b) A public news article
c) Password
d) A dictionary definition
Short Answer Questions
What is Generative AI? Give two examples.
What is meant by LLM?
What are Tokens? Why are they needed?
Explain the concept of Embeddings in simple terms.
Write two differences between training and inference.
What is Prompt engineering?
Write two characteristics of a good prompt.
What is AI hallucination? Give an example.
Why is privacy important when using AI?
Why is fact-checking necessary when using AI-generated content?
Competency-Based Questions
Question 1
Jane is writing an article for a school magazine on the topic of "Climate Change." She simply asked the AI tool:
"Write about climate change."
The output she received was very generic.
a) What is the main limitation of the prompt?
b) Create a more effective prompt for Jane.
c) What should be done before publishing the information provided by the AI in the magazine?
Question 2
A student uses an AI tool to find answers to a Mathematics homework. It is later discovered that one of the answers provided by the AI is incorrect.
a) Write a reason why the AI output is not always correct.
b) Write two steps that the student should take to verify the AI answer.
c) How can academic integrity be maintained when using AI for homework?
Question 3
A member of a school club asks an AI tool to create a contact list by entering the names and phone numbers of club members.
a) What is the main ethical concern that arises in this situation?
b) What should be considered before providing personal information to AI tools?
c) Suggest an alternative to perform this task safely.
Think and Discuss
"AI should support student learning. Not replace student learning." Do you agree with this statement? Explain why.
If an AI tool confidently provides incorrect information, can it be said to be more reliable than a human?
How can providing more context in the prompt improve output?
Where does human responsibility begin when using AI-generated content?
Extension Activity
Choose a school subject of your choice.
Examples:
Physics
Chemistry
Biology
Mathematics
History
Computer Science
Create three different prompts to ask the AI about that subject.
Prompt 1
A very general question.
Prompt 2
A question with more context.
Prompt 3
A detailed prompt that specifies class level, word limit, format, and examples.
Compare the three outputs and note the following:
Which prompt gave the most clear output?
Which output is the most relevant?
Why do you think that happened?
Choose a factual claim made by the AI. Verify it with a textbook or a reliable source.
Let's learn, but after checking
Generative AI is a technology that will greatly help our learning and creative activities. But it is not right to assume that every answer given by AI is correct.
A good AI user is not someone who knows how to just ask AI for a good prompt. He is someone who knows how to question, check, and correct the answer received when necessary.
So, three words to remember when using Generative AI:
Ask. Check. Think.