Summer Course Material
Summer Course Material
Summer Course Material
https://medium.com/@vimal.parakhiya/decoding-large-language-models-a-deep-dive-into-the-self-attention-mechanism-967d6207d4ae
There are 6 key parts:
https://www.techopedia.com/12-practical-large-language-model-llm-applications
1.Text Generation
• Creating articles, stories, or any written content.
2.Translation
• Translating text from one language to another
3.Summarisation
• Condensing long articles or papers into shorter summaries
• Generating a summary based on multiple data sources
4.Sentimental Analysis
• Analysing the sentiment of text, like determining if a review is positive or negative
5.Chatbots
• Building intelligent chatbots that can hold conversations with humans
Monica
• Go to Monica and Choose a Chatbot
https://monica.im/zh_TW
Prompt Engineering
• To develop and optimise prompts to efficiently use language models (LMs) for a wide
variety of applications and research topics
https://promptingguide.azurewebsites.net/
1.Text Summarization
• Summarize articles and concepts into quick and easy-to-read summaries
2. Information Extraction
• Perform natural language generation, classification and a range of other natural language
processing (NLP) tasks, e.g. extract information from a given paragraph
3. Question Answering
• A more structured prompt - combining instructions, context, input, and output indicators
to get improved results
4. Text Classification
• Elements used in the prompt: input data / examples
5. Conversation (Role Prompting)
• Instructing the LLM system on how to behave, its intent, and its identity
• This is particularly useful when you are building conversational systems like customer
service chatbots
6. Code Generation
• Notice that you didn't even need to specify the language to use
• If you are trying to debug a code, the LLM system will automatically switch to the
corresponding programming language
• A great example of such application is Copilot
7. Reasoning
• One of the most difficult tasks for LLM
• One of the most interesting areas due to the types of complex applications that can
emerge from LLMs
• Basic examples: show arithmetic capabilities
AI Content Detectors
• Analysing the content's linguistic and structural features (semantic meaning, sentence
structure, language choices, etc)
• Comparing the text to existing datasets of content created by artificial intelligence or
humans to differentiate between the two.
https://www.cnet.com/tech/services-and-software/chatgpt-detectors-are-biased-and-easy-to-fool-research-shows/
AI Detectors - Gimmick or Gambit?
• Detectors sometimes suggest that human-generated contents are produced by AI
• E.g. OpenAI tested well-known, human-written texts such as Shakespeare's literature and
the Declaration of Independence in their content detector, but they were labeled as AI-
generated by the detector
• News:
https://www.cnet.com/tech/services-and-software/chatgpt-detectors-are-biased-and-easy-to-fool-research-shows/
If you have not downloaded Anaconda Distribution, please
download it during the break!
Online Python
• If you have not installed Python on your computer, you may go to Online Python by
visiting the link below
https://www.online-python.com/
Python Interpreter
https://www.w3schools.com/python/python_intro.asp
Hello, Python!
• Let's begin with the classic "Hello, World!" program
• Open your Python environment and type:
print("Hello, World!")
• This line introduces you to the print function, which displays text on screen
Variable and Types
• In Python, you can store information in variables without declaring their type. For
instance:
name = "Alice"
age = 25
height = 5.9
• Here, name is a string, age is an integer, and height is a float (decimal number)
Basic Operations
• Python allows easy manipulation of numbers and strings
• Example:
a=5
b=3
#Arithmetic
sum_result = a + b
difference_result = a - b
product_result = a*b
quotient_result = a/b
#String Concatenation
greeting = "Hello, "
name = "World!"
full_greeting = greeting + name
Control Flow
(If Statements and Loops)
• Make decisions with if statements and repeat actions with loops: x = 10
#Conditional statement
if x > 5:
print("x is greater than 5")
else:
print("x is not greater than 5")
#For loop
for i in range(5):
print(i)
Functions
• Functions help organize your code
• Example:
#Function definition
def greet(name):
return "Hello, " + name + "!"
#Function call
message = greet("Bob")
print(message)
Challenge - Sum and Min
• Write a program to use a while loop to read the numbers from the user repeatedly until
he/she inputs 0, then report the sum of these numbers and the minimum value among
them
• Note: You don’t need to store all the numbers
• If you are unable to get the desired output, you may ask Monica for debug
Sample Code
num = int(input())
total = num
minimum = num
while num != 0:
num = int(input())
total += num
if num != 0 and num < minimum:
minimum = num
#install OpenCV
pip install opencv-python
#import libraries
import
# Load cv2
the image
import
image =numpy as np
cv2.imread('image.jpg')
https://medium.com/jimmy-wang/opencv-%E5%9F%BA%E7%A4%8E%E6%95%99%E5%AD%B8%E7%AD%86%E8%A8%98-with-python-d780f571a57a
# Convert the image to grayscale
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
#import libraries
import cv2
import numpy as np
https://medium.com/jimmy-wang/opencv-%E5%9F%BA%E7%A4%8E%E6%95%99%E5%AD%B8%E7%AD%86%E8%A8%98-with-python-d780f571a57a
# Convert the image to grayscale
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)