Xác thực

Phát triển hệ thống AI với OpenAI API

Francesca Donadoni

Curriculum Manager, DataCamp

Xác thực

Lập trình viên kiểm thử mã trên nhiều màn hình

Phát triển hệ thống AI với OpenAI API

Xác thực

 

Khả năng lỗi của mô hình:

  • Hiểu sai ngữ cảnh
  • Khuếch đại thiên lệch nếu dữ liệu huấn luyện có thiên lệch
  • Xuất thông tin lỗi thời
  • Bị thao túng để tạo nội dung gây hại/phi đạo đức
  • Vô tình lộ thông tin nhạy cảm
Phát triển hệ thống AI với OpenAI API

Kiểm thử đối kháng

Sơ đồ: lập trình viên tiêm đầu vào đối kháng vào dữ liệu và mô hình, và mô hình suy luận từ dữ liệu

1 Adapted from https://adversarial-robustness-toolbox.readthedocs.io/en/latest/
Phát triển hệ thống AI với OpenAI API

Kiểm thử đối kháng

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[
{"role": "system",
 "content": "You are an AI assistant for the film industry. You should interpret 
    the user prompt, a movie review, and based on that extract whether its 
    sentiment is positive, negative, or neutral."},

{"role": "user", "content": "It was great to see some of my favorite stars of 30 years ago including John Ritter, Ben Gazarra and Audrey Hepburn. They looked quite wonderful. But that was it. They were not given any characters or good lines to work with. I neither understood or cared what the characters were doing."}])
1 https://huggingface.co/datasets/davanstrien/test1?row=10
Phát triển hệ thống AI với OpenAI API

Kiểm thử đối kháng

print(response.choices[0].message.content)
The sentiment of this movie review is negative.
Phát triển hệ thống AI với OpenAI API

Kiểm thử đối kháng

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[
{"role": "system",
 "content": "You are an AI assistant for the film industry. You should interpret 
    the user prompt, a movie review, and based on that extract whether its sentiment 
    is positive, negative, or neutral."},

{"role": "user", "content": "If you read the book, your all set. If you didn't...your still all set."}]) print(response.choices[0].message.content)
The sentiment of this movie review is neutral.
Phát triển hệ thống AI với OpenAI API

Thư viện và bộ dữ liệu đánh giá

Sơ đồ cho thấy một thư viện đánh giá dùng nhiều bộ dữ liệu để kiểm tra mô hình

1 https://github.com/openai/evals
Phát triển hệ thống AI với OpenAI API

Hãy thực hành!

Phát triển hệ thống AI với OpenAI API

Preparing Video For Download...