ApX logoApX logo
CalculatorCoursesPricing

Phi-3-small

Open Source
Open Weights

Parameters

7B

Context Length

8K

Modality

Text

Architecture

Dense

KV Cache Rate

128 KB/tok

License

MIT License

Release Date

22 Apr 2024

Knowledge Cutoff

Oct 2023

API Pricing (per 1M)

Input: $0.15 · Output: $0.60

Hardware & System Requirements

Precision

Context

Workload Memory: 6.76 GB

vLLM

INT4 · 8K context · 1 user

Base Weights: 3.26 GB

KV Cache: 1.00 GB

Runtime & Graphs: 2.50 GB

Minimum Required Hardware

1x NVIDIA L4 24GB

vLLM

6.8 / 21.6 GB

1x RTX 3060 12GB

llama.cpp

6.8 / 11.2 GB

Apple M4 24GB

llama.cpp

6.8 / 18.0 GB

Determine requirements for concurrent users or multi-node clusters:

Runtime compatibility

Verified on hardware and checkpoint files.

Checkpoint format

FP16

CUDA

>= 11.8

PyTorch

>= 2.1

Transformers

>= 4.38.1

ArchitecturePrecisionAttention kernel

Blackwell, Hopper

Native FP16

FlashAttention-3

Ada Lovelace, Ampere

Native FP16

FlashAttention-2

Additional required packages

Install alongside standard runtime libraries:

pip install einops flash_attn

Architecture Diagram

Input TokensToken EmbeddingPosition: RoPEHidden: 4.1k · Context: 8K · Vocab: 100.4kx 32 layersNormPre-AttentionGrouped-Query Attention32Q / 8KV headsHead dim: 128+NormPre-FFNFeed-Forward NetworkGated GELUIntermediate: 14.3k+Final NormOutput Logits

Evaluation Benchmarks

Rank

#254

BenchmarkScoreRank

General Text

Text Arena

1171.19

#190

Rankings

Overall Rank

#254

Coding Rank

-

About Phi-3-small

Phi-3-small is a 7B parameter small language model from Microsoft engineered for commercial reasoning, mathematics, and code generation. It utilizes blocksparse attention and LongRope technology to support contexts up to 128K tokens.

Specifications

Attention

Attention Structure

Grouped-Query Attention

Attention Heads

32

Key-Value Heads

8

Position Embedding

ROPE

RoPE Theta

1,000,000

Activation Function

Gated GELU

Dimensions

Base Precision

FP16

Hidden Dimension Size

4,096

Number of Layers

32

FFN Intermediate Size (Dense)

14,336

Tokenizer

Vocabulary Size

100,352

About Phi-3

Microsoft's Phi-3 models are small language models designed for efficient operation on resource-constrained devices. They utilize a transformer decoder architecture and are trained on extensively filtered, high-quality data, including synthetic compositions. This approach enables a compact yet capable model family.


Other Phi-3 Models