検証

OpenAI API を使った AI システムの開発

Francesca Donadoni

Curriculum Manager, DataCamp

検証

複数の画面でコードをテストする開発者

OpenAI API を使った AI システムの開発

検証

起こり得るモデルのエラー:

  • 文脈の誤解
  • トレーニングデータにバイアスがある場合、その出力でバイアスを増幅する
  • 古い情報の出力
  • 有害または非倫理的なコンテンツを生成するよう操作される
  • 意図せず機密情報を開示する
OpenAI API を使った AI システムの開発

敵対的テスト

プログラマーがデータとモデルに敵対的入力を注入し、モデルがデータから推論している図

1 https://adversarial-robustness-toolbox.readthedocs.io/en/latest/ から改変
OpenAI API を使った AI システムの開発

敵対的テスト

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
OpenAI API を使った AI システムの開発

敵対的テスト

print(response.choices[0].message.content)
The sentiment of this movie review is negative.
OpenAI API を使った AI システムの開発

敵対的テスト

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.
OpenAI API を使った AI システムの開発

評価ライブラリとデータセット

モデルをテストするためにさまざまなデータセットを使用する評価ライブラリの例を示す図

1 https://github.com/openai/evals
OpenAI API を使った AI システムの開発

練習しましょう!

OpenAI API を使った AI システムの開発

Preparing Video For Download...