All benchmarks

  Paper (arXiv), Microsoft

A fine-tuned 3.8B Phi-3 beat GPT-4-turbo inside Microsoft’s supply chain

Microsoft researchers gave operators a natural-language interface to an internal Azure fulfilment app. Fine-tuned on 1,000 examples, Phi-3-mini was more accurate than GPT-4-turbo with 10 examples in its prompt, at about 1/220 of the cost per query.

Made by Beibin Li and four co-authors

arXiv preprint

Weights not publishedSource: arXiv 2405.20347

The result

  • Quality

    Overall accuracy (in- and out-of-domain queries). Small model: Phi-3 mini (3.8B), LoRA fine-tuned on 1,000 examples per task (mean of ten runs, ±0.33). Large model: GPT-4-turbo, 10 examples per task in the prompt.

    95.86%vs 88.22%

    Ahead by 7.64 points

    Phi-3-mini 3.8B95.86%
    GPT-4-turbo, 10 examples88.22%

    Overall accuracy · higher is better

  • Cost per call

    Per query as Table 2 reports it (0.19 and 42.32 cents), converted to US$. GPT models: average input and output tokens per query x OpenAI list prices as of May 2024 (GPT-4-turbo US$10 per million input and US$30 per million output tokens). Small models: hourly rent of a GPU VM / queries served per hour, batch size 1, assuming high utilisation (e.g. multi-LoRA serving); the GPU type, VM price and throughput aren’t given. Authors’ estimates, not bills. As reported: 0.19 cents per query (Phi-3 mini) vs 42.32 cents (GPT-4-turbo with 10 examples per task)

    222×cheaper

    Phi-3-mini 3.8BUS$0.0019on a rented GPU VM (type not named)
    GPT-4-turbo, 10 examplesUS$0.4232via OpenAI, at May 2024 list prices

    US$ per call · lower is better

The story

Asking a supply-chain app in plain English

Microsoft has an internal application that plans how racks of servers get from warehouses to Azure data centers: which supplier, which shipping method, and when. Planners used to take their questions to engineering teams. Five Microsoft authors built a language-model layer so planners can ask the application directly.

The model reads a question in English and writes a short Python snippet that calls the application’s APIs, of which there are more than forty, across about fifty task types in three groups: data extraction, plan generation and what-if analysis. It also has to recognise the 3 to 5% of production queries that have nothing to do with the application, such as a request to rewrite an email, and give a default answer.

Small models, trained on generated examples

Data

Generated task examples

1,000 per task, about fifty task types

Templates, textbook-style synthetic data and WizardLM-style prompt evolution; GPT-4 rewrote human-written questions in other styles, typos included

The test set isn’t described.

The team fine-tuned six open models on 1,000 examples per task. The examples were generated: from templates, in the textbook style of the Phi papers, and by WizardLM-style prompt evolution, with GPT-4 rewriting human-written questions in other styles, typos and distractions included. Each example holds the whole flow of handling a request, much like a chain of thought.

Small model

Phi-3 mini

3.8B · Microsoft

LoRA fine-tuned on 1,000 generated examples per task

Base
Phi-3 mini (which variant isn’t stated)

Training

LoRA, same settings for every model

Time
Capped at 100,000 gradient steps
Cost
On the order of US$10 for the 1,000-example setting (authors’ estimate)

Not stated: hardware.

Every model got the same LoRA recipe: effective batch size 16, AdamW at a constant learning rate of 0.0002, at most 1,024 input and 500 output tokens, and a cap of 100,000 gradient steps. Besides Phi-3 mini, the other five were Phi-2 (2.7B), Gemma (7B), Mistral v0.2 (7B), Gorilla OpenFunctions v2 (7B) and Llama 3 (8B). The authors put training on the order of US$10 for the 1,000-example setting; the GPU isn’t named.

GPT-4-turbo, given examples instead

Large model

GPT-4-turbo

Size not disclosed · OpenAI

Used as released, with 1 to 20 worked examples per task in the prompt (best at 10)

Base
General model; snapshot not stated

The GPT models were not fine-tuned; they got examples in the prompt instead. GPT-3.5-turbo was tried with 1 to 3 examples per task (5 no longer fit), GPT-4-turbo with 1, 2, 3, 5, 10, 15 and 20. GPT-4-turbo did best with 10, at 88.22% overall accuracy, and slipped with more: 87.99% at 15 and 85.17% at 20.

Evaluation

Test set
Not described: size, source and whether queries are real or generated aren’t stated
Metric
Overall accuracy: share of all queries, in- and out-of-domain, with the right output
Items
Not reported; small models: mean and spread over ten runs
How it was compared
GPT-4-turbo got 1 to 20 worked examples per task; the fine-tunes got only the query. Same queries and metrics for all; temperature not stated.

Fine-tuned Phi-3 mini reached 95.86%, plus or minus 0.33 over ten runs, and Mistral v0.2 95.47%. The paper doesn’t describe the test queries or say how a ‘right output’ was checked.

Why the cost gap is so wide

Most of the difference is prompt length. With one example GPT-4-turbo read about 4,300 input tokens per query, 8,500 with two and 12,400 with three; the fine-tuned Phi-3 read about 19, because it had learned the tasks. The authors priced the GPT models at OpenAI’s May 2024 list prices and the small models at a GPU VM’s hourly rent divided by queries served per hour, assuming a busy GPU. That comes to 0.19 cents a query for Phi-3 mini against 42.32 cents for GPT-4-turbo with 10 examples. Phi-3 typically answered in a few seconds, GPT-4-turbo in one to two minutes.

All the numbers

Show all numbersHide all numbersEvery model · Cost, latency and energy · The full table · How the cost was computed

Every model on the headline test

Cost, latency and energy, as reported

Cost · per 1,000 queries
US$ 1.90a rented GPU VM, type not disclosed; assumes a busy GPU
US$ 423.20OpenAI API list price (May 2024), hardware not disclosed
Latency · per query
a few seconds
1–2 minutes
Energy
Not reported

The full table

ModelAccuracyCost per queryPer 1,000
Phi-3-mini 3.8B, fine-tuned95.86% ± 0.330.19¢US$ 1.90
Mistral 7B v0.2, fine-tuned95.47% ± 0.260.29¢US$ 2.90
Llama 3 8B, fine-tuned94.59% ± 0.710.28¢US$ 2.80
GPT-4-turbo, 10 examples88.22%42.32¢US$ 423.20
GPT-4-turbo, 1 example75.88%4.52¢US$ 45.20
GPT-3.5-turbo, 1 example71.01%0.23¢US$ 2.30

How the cost was computed

GPT models: the tokens actually used × OpenAI’s list price in May 2024 (GPT-4-turbo: US$10 per million input tokens, US$30 per million output). Small models: the hourly rent of a GPU VM ÷ queries served per hour, assuming high utilisation (for example, many adapters sharing one GPU). The paper doesn’t name the GPU. The per-1,000 column is the paper’s per-query cost × 1,000.

Worth knowing

  • One internal application. The authors themselves call it a single case study.
  • The small models’ cost assumes a busy GPU; at low traffic a dedicated GPU sits idle and the cost per query goes up.
  • GPT-4 helped create the training data (it rewrote the questions), so the small models learned partly from GPT-4 outputs.
  • GPT-4-turbo’s cost grows with every example added to the prompt.
1 more caveat
  • The authors work for the company that makes Phi-3. Models are from 2024.

Weights on Hugging Face

Weights not published

The fine-tuned models belong to an internal Microsoft application and were not released. Public base models of the same families (the paper doesn’t say which exact checkpoint):

GPT-4-turbo and GPT-3.5-turbo: closed, no weights.

Sources

  1. Li, Zhang, Bubeck, Pathuri, Menache (Microsoft), ‘Small Language Models for Application Interactions: A Case Study’, arXiv 2405.20347v1, 23 May 2024Primary (paper, preprint)
1 more source behind this page
  1. arXiv 2405.20347v1
Share this benchmark

Drawing the image…

Post text