1 of 48

CHATGPT

Find more PowerPoint templates on prezentr.com!

2 of 48

Meeting Agenda

  1. What is ChatGPT
  2. How can I use ChatGPT
  3. Costs
  4. Applications
  5. Open points & Conclusions
  6. Question

Find more PowerPoint templates on prezentr.com!

3 of 48

What is ChatGPT?�

Find more PowerPoint templates on prezentr.com!

4 of 48

ChatGPT is a model specifically trained to interact in a conversional way

ChatGPT

Input prompt string: 

Detailed response:

Find more PowerPoint templates on prezentr.com!

5 of 48

ChatGPT is a model specifically trained to interact in a conversional way

ChatGPT

Input prompt string: 

Detailed response:

Tokens:

"Chri" "stop" "her"

Christopher

Find more PowerPoint templates on prezentr.com!

6 of 48

ChatGPT is a model specifically trained to interact in a conversional way

ChatGPT

Input prompt string: 

Detailed response:

Tokens:

"Chri" "stop" "her"

 

Find more PowerPoint templates on prezentr.com!

7 of 48

Examples

Writing email

Find more PowerPoint templates on prezentr.com!

8 of 48

Examples

Response

Writing email

Find more PowerPoint templates on prezentr.com!

9 of 48

Examples

Get assistance with coding and debugging

Find more PowerPoint templates on prezentr.com!

10 of 48

Examples

Response

Request

Get assistance with coding and debugging

Find more PowerPoint templates on prezentr.com!

11 of 48

Models

GPT3.5

GPT3

GPT4

GPT4

Find more PowerPoint templates on prezentr.com!

12 of 48

Models

GPT3.5

GPT3

GPT4

GPT4

GPT3

Find more PowerPoint templates on prezentr.com!

13 of 48

Models

GPT3.5

GPT3

GPT4

GPT4

GPT3

Find more PowerPoint templates on prezentr.com!

14 of 48

How can I use CHAT GPT?

Find more PowerPoint templates on prezentr.com!

15 of 48

Rest API Integration

  • Making request
  • Asks for available models
  • Perform fine tuning

In addition to the well-known demo portal chat.openai.com, there is a set of REST APIs for:

curl https://api.openai.com/v1/completions \

-H "Authorization: Bearer $OPENAI_API_KEY" \

-H "Content-Type: application/json" \

-d '{"prompt": YOUR_PROMPT, "model": FINE_TUNED_MODEL}'

curl https://api.openai.com/v1/completions \

-H "Content-Type: application/json" \

-H "Authorization: Bearer $OPENAI_API_KEY" \

-d '{

"model": "text-davinci-003",

"prompt": "Say this is a test",

"max_tokens": 7,

"temperature": 0

}'

curl https://api.openai.com/v1/models \

-H "Authorization: Bearer $OPENAI_API_KEY"

Find more PowerPoint templates on prezentr.com!

16 of 48

curl https://api.openai.com/v1/completions \

-H "Content-Type: application/json" \

-H "Authorization: Bearer $OPENAI_API_KEY" \

-d '{

"model": "text-davinci-003",

"prompt": "Say this is a test",

"max_tokens": 7,

"temperature": 0

}'

Completion API Parameters

The completion API, used to obtain answers to questions, has four fundamentals request params, in addition to the question itself:

  • Model
  • Prompt
  • Max_token
  • Temperature

Find more PowerPoint templates on prezentr.com!

17 of 48

Usage tests �

Find more PowerPoint templates on prezentr.com!

18 of 48

Examples Scenario

In order to learn more about the case study, we choose some arbitrary topics in the Lottomatica scratch&win reseller portal assistance KB:

  • Game account (conto gioco)
  • Extraordinary order
  • Welcome bonus

The tests were made with the following preconditions:

  • The model used is the latest GPT3.5 model (text-davinci-003)
  • All the questions were asked in Italian, in order to use the reseller portal KB
    • Done also to understand how it manages Italian language
  • Temperature disabled (zero)

Find more PowerPoint templates on prezentr.com!

19 of 48

API Example

{

"model": "text-davinci-003",

"prompt": "Dove trovo le informazioni del conto gioco?",

"temperature": 0,

"max_tokens": 50

}

{

"id": "cmpl-6cgwK4r0KBSEitz1mMnlXukh0RlfH",

"object": "text_completion",

"created": 1674679544,

"model": "text-davinci-003",

"choices": [

{

"text": "\n\nLe informazioni del conto gioco possono essere trovate nella sezione \"Il mio conto\" del sito web del tuo operatore di gioco. Qui",

"index": 0,

"logprobs": null,

"finish_reason": "length"

}

],

"usage": {

"prompt_tokens": 16,

"completion_tokens": 50,

"total_tokens": 66

}}

Message truncated for reaching the requested length

CHATGPT

Find more PowerPoint templates on prezentr.com!

20 of 48

API Example

{

"model": "text-davinci-003",

"prompt": "Dove trovo le informazioni del conto gioco?",

"temperature": 0,

"max_tokens": 100

}

{

"id": "cmpl-6cgwK4r0KBSEitz1mMnlXukh0RlfH",

"object": "text_completion",

"created": 1674679544,

"model": "text-davinci-003",

"choices": [

{

"text": "\n\nLe informazioni del conto gioco possono essere trovate nella sezione \"Il mio conto\" del sito web del tuo operatore di gioco. Qui troverai informazioni sui tuoi depositi, prelievi, bonus, puntate, vincite e altro ancora.",

"index": 0,

"logprobs": null,

"finish_reason": "stop"

}],

"usage": {

"prompt_tokens": 16,

"completion_tokens": 83,

"total_tokens": 99

}}

API returned complete model output

CHATGPT

Find more PowerPoint templates on prezentr.com!

21 of 48

Request Injection Example

{"model": "text-davinci-003",

"prompt": "Lottomatica mette a disposizione dei suoi nuovi iscritti 1.000€ di Bonus Benvenuto Casinò.Da desktop, dal proprio smartphone o dal proprio tablet, la procedura di registrazione da eseguire online prevede l’inserimento dei propri dati anagrafici e il completamento, attraverso upload, dei documenti richiesti. Una volta ottenuta la validazione della documentazione, il conto gioco è aperto e validato. Per aderire all’iniziativa sarà necessario effettuare una ricarica di almeno 20€ entro 7 giorni dalla registrazione, utilizzando una delle modalità indicate di seguito e validare il conto gioco. Per il calcolo del bonus verranno prese in considerazione esclusivamente le giocate Slot e Soft Games avviate e contabilizzate dal giorno della prima ricarica fino al 15° giorno dalla prima ricarica stessa. Il Bonus Benvenuto Casinò prevede l’accredito di un bonus massimo del 100% del valore della prima ricarica e fino a 1.000€. … \n Quanto bisogna depositorare per ottenre il bonus di benvenuto?",

"temperature": 0,

"max_tokens": 500}

{"id": "cmpl-6chAo10Dq2El1rTDxue3wgNPuViQ7",

"object": "text_completion",

"created": 1674680442,

"model": "text-davinci-003",

"choices": [{

"text": "\n\nPer ottenere il Bonus Benvenuto Casinò è necessario effettuare una ricarica di almeno 20€ entro 7 giorni dalla registrazione, utilizzando una delle modalità indicate.",

"index": 0,

"logprobs": null,

"finish_reason": "stop"

}],

"usage": {

"prompt_tokens": 1247,

"completion_tokens": 60,

"total_tokens": 1307

}}

CHATGPT

Find more PowerPoint templates on prezentr.com!

22 of 48

Fine Tuning�

Find more PowerPoint templates on prezentr.com!

23 of 48

Fine Tuning For Custom Model

Fine tuning allows us to obtain a custom model trained with dedicated data.

Advantages:

  • Higher quality results than prompt design
  • Ability to train on more examples than can fit in a prompt
  • Token savings due to shorter prompts
  • Potentially a lower latency requests

High level steps:

  • Prepare and upload training data
  • Train a new fine-tuned model
  • Use your fine-tuned model

Find more PowerPoint templates on prezentr.com!

24 of 48

Dataset Preparation & Costs

{"prompt": "<prompt text>", "completion": "<ideal generated text>"}

{"prompt": "<prompt text>", "completion": "<ideal generated text>"}

{"prompt": "<prompt text>", "completion": "<ideal generated text>"}

...

Data to train the model must be a JSONL document, where each line it is a training example that consist of a single “prompt” and its associated output “completion” .

Effort estimation for dataset preparation for A4 pages documents:

Type

Complexity

Effort per Page

QA style with no image

Easy

1/2 day

QA style with image or easy plain text no QA style without image

Medium/Easy

1 day

Easy plain text with images

Medium

1-1,5 days

Complex text (bulletted list, subparagraph, URLs references, ecc.), without images

Medium/Hard

1,5-2 days

Complex text (bulletted list, subparagraph, URLs references, ecc.), with images

Hard

Min 2 days

Find more PowerPoint templates on prezentr.com!

25 of 48

Embeddings�

Find more PowerPoint templates on prezentr.com!

26 of 48

ChatGPT Embeddings

Embeddings allow to transform a phrase, paragraph or an entire text in a float vector that represents the informations as a point in a new vector space and this allow to measure the relatedness of text strings.

  • Search 
  • Clustering 
  • Recommendations 
  • Anomaly detection 
  • Diversity measurement 
  • Classification 

Embeddings are commonly used for:

Find more PowerPoint templates on prezentr.com!

27 of 48

ChatGPT Embeddings

NO DATASET CREATION

FAST UPDATE

Encoder

Vector Space

Context Vector

Query Vector

Step 1

Step 2

New Request

ChatGPT

Query

Request Injection

Answer

New Request

LENGTH / TIME

SOCIAL BIAS

Normandy knowledge

Normandy knowledge

query

Where is Normandy?

query

Where is Normandy?

Find more PowerPoint templates on prezentr.com!

28 of 48

ChatGPT Embeddings

NO DATASET CREATION

FAST UPDATE

LENGTH / TIME

SOCIAL BIAS

Find more PowerPoint templates on prezentr.com!

29 of 48

ChatGPT Embeddings

NO DATASET CREATION

FAST UPDATE

LENGTH / TIME

SOCIAL BIAS

Find more PowerPoint templates on prezentr.com!

30 of 48

ChatGPT Embeddings

NO DATASET CREATION

FAST UPDATE

LENGTH / TIME

SOCIAL BIAS

Find more PowerPoint templates on prezentr.com!

31 of 48

ChatGPT Embeddings

NO DATASET CREATION

FAST UPDATE

LENGTH / TIME

SOCIAL BIAS

Find more PowerPoint templates on prezentr.com!

32 of 48

ChatGPT Embeddings

NO DATASET CREATION

FAST UPDATE

LENGTH / TIME

SOCIAL BIAS

Find more PowerPoint templates on prezentr.com!

33 of 48

Costs�

Completions

Fine-tuning

Embedding

MODEL​

USAGE​

Ada

$0.0004 / 1K tokens

Babbage

$0.0005 / 1K tokens

Curie

$0.0020 / 1K tokens

Davinci

$0.0200 / 1K tokens

GPT-3.5-turbo

$0.0020 / 1K tokens

Text-davinci-003

$0.0200 / 1K tokens

GPT-4-8K

$0.0300 / 1K tokens

GPT-4-32K

$0.0600 / 1K tokens

Find more PowerPoint templates on prezentr.com!

34 of 48

Pricing comparison

Fine-tuning

Embedding

Completions

 

MODEL​

USAGE​

Ada

$0.0004 / 1K tokens

MODEL​

USAGE​

Ada

$0.0004 / 1K tokens

Babbage

$0.0005 / 1K tokens

Curie

$0.0020 / 1K tokens

Davinci

$0.0200 / 1K tokens

GPT-3.5-turbo

$0.0020 / 1K tokens

Text-davinci-003

$0.0200 / 1K tokens

GPT-4-8K

$0.0300 / 1K tokens

GPT-4-32K

$0.0600 / 1K tokens

e.g:

Model: Davinci

N° Tokens: 2k

Cost = 2 ∗ 0.02 = 0.04$

Usage tokens = Request + Response

Find more PowerPoint templates on prezentr.com!

35 of 48

Pricing comparison

Completions

Embedding

Fine-tuning

Usage tokens = Request + Response

MODEL​

USAGE​

Ada

$0.0004 / 1K tokens

Babbage

$0.0005 / 1K tokens

Curie

$0.0020 / 1K tokens

Davinci

$0.0200 / 1K tokens

GPT-3.5-turbo

$0.0020 / 1K tokens

GPT-4-8K

$0.0300 / 1K tokens

GPT-4-32K

$0.0600 / 1K tokens

MODEL​

TRAINING​

USAGE​

Ada

$0.0004 / 1K tokens

$0.0016 / 1K tokens

Babbage

$0.0006 / 1K tokens

$0.0024 / 1K tokens

Curie

$0.0030 / 1K tokens

$0.0120 / 1K tokens

Davinci

$0.0300 / 1K tokens

$0.1200 / 1K tokens

MODEL​

USAGE​

Ada

$0.0004 / 1K tokens

Cost = Request Embedding Ada + Request Completion Davinci

Find more PowerPoint templates on prezentr.com!

36 of 48

Pricing comparison

Completions

Fine-tuning

Embedding

Cost_total_training = (Tokens_dataset ∗ N_epochs ) ∗ Model_training_cost

e.g., Davinci training:

1k Tokens_dataset

4 Epochs

Cost_total_training = 4 ∗ 1 ∗ 0.03 = 0.12$

MODEL​

USAGE​

Ada

$0.0004 / 1K tokens

MODEL​

TRAINING​

USAGE​

Ada

$0.0004 / 1K tokens

$0.0016 / 1K tokens

Babbage

$0.0006 / 1K tokens

$0.0024 / 1K tokens

Curie

$0.0030 / 1K tokens

$0.0120 / 1K tokens

Davinci

$0.0300 / 1K tokens

$0.1200 / 1K tokens

Find more PowerPoint templates on prezentr.com!

37 of 48

Applications�

MODEL​

TRAINING​

USAGE​

Ada

$0.0004 / 1K tokens

$0.0016 / 1K tokens

Babbage

$0.0006 / 1K tokens

$0.0024 / 1K tokens

Curie

$0.0030 / 1K tokens

$0.0120 / 1K tokens

Davinci

$0.0300 / 1K tokens

$0.1200 / 1K tokens

CHATBOT

CODE DEVELOPMENT

TEST AUTOMATION

Find more PowerPoint templates on prezentr.com!

38 of 48

Applications

Chatbot

Code Development

Test Automation

Find more PowerPoint templates on prezentr.com!

39 of 48

Chatbot

CODE DEVELOPMENT

TEST AUTOMATION

Chatbot development platform

ChatGPT API

Dataset

Train – Test - Evaluate

Find more PowerPoint templates on prezentr.com!

40 of 48

Applications

Chatbot

Code Development

Test Automation

Find more PowerPoint templates on prezentr.com!

41 of 48

Code Development

CHATBOT

TEST AUTOMATION

Environment and ChatGPT library

Provide a prompt

Analyze and Evaluate

Requests to the GPT-3.5 Turbo

Find more PowerPoint templates on prezentr.com!

42 of 48

Applications

Chatbot

Code Development

Test Automation

Find more PowerPoint templates on prezentr.com!

43 of 48

CHATBOT

CODE DEVELOPMENT

Test Automation

Test automation framework

Make requests to the ChatGPT

Evaluate results and make changes

Unit - Integration - API – Mobile - End To End Testing

Find more PowerPoint templates on prezentr.com!

44 of 48

Open points & Conclusions

Find more PowerPoint templates on prezentr.com!

45 of 48

Conclusions

Open points

Incorrect answers

Input sensitive

Roles Management

Privacy

(Italy case)

ChatGPT is a powerful model for implementing natural language bots and more.

Find more PowerPoint templates on prezentr.com!

46 of 48

Conclusions

ChatGPT is a powerful model for implementing natural language bots and more.

Open points

Incorrect answers

Input sensitive

Roles Management

Privacy

(Italy case)

Find more PowerPoint templates on prezentr.com!

47 of 48

Thanks for the attention

Find more PowerPoint templates on prezentr.com!

48 of 48

Questions ?

Find more PowerPoint templates on prezentr.com!