Skip to content
Updated minutes ago
Meta

Code Llama 7B

Meta · dense · 7B parameters · 16,384 context

Quality
39.0

Parameters

7B

Context Window

16K tokens

Architecture

Dense

Best GPU

A10G

Cheapest API

$0.20/M

Quality Score

39/100

Intelligence Brief

Code Llama 7B is a 7B parameter DENSE model from Meta, featuring Multi-Head Attention (MHA) with 32 layers and 4,096 hidden dimensions. With a 16,384 token context window, it supports code, math. On standardized benchmarks, it achieves MMLU 42, HumanEval 31, GSM8K 28. The most cost-effective API deployment is via together at $0.20/M output tokens. For self-hosted inference, A10G delivers optimal throughput at $285/month.

Architecture Details

TypeDENSE
Total Parameters7B
Active Parameters7B
Layers32
Hidden Dimension4,096
Attention Heads32
KV Heads32
Head Dimension128
Vocab Size32,016

Memory Requirements

BF16 Weights

14.0 GB

FP8 Weights

7.0 GB

INT4 Weights

3.5 GB

KV-Cache per Token524288 bytes
Activation Estimate1.00 GB

GPU Compatibility Matrix

Code Llama 7B is compatible with 95% of GPU configurations across 41 GPUs at 3 precision levels.

BF16 (Full)
FP8 (Half)
INT4 (Quarter)
Blackwell(7 GPUs)
B200 NVL (pair)360GB
B300288GB
B100 SXM192GB
GB200 NVL72 (per GPU)192GB
Hopper(7 GPUs)
H100 NVL 94GB (per GPU pair)188GB
H200 SXM141GB
H2096GB
GH20096GB
Ada Lovelace(11 GPUs)
L40S48GB
L4048GB
RTX 6000 Ada48GB
L2048GB
Ampere(16 GPUs)
A100 80GB SXM80GB
A100 80GB PCIe80GB
A1664GB
RTX A600048GB
Legend:No fitVery tightTightModerateGoodExcellent

GPU Recommendations

A10Goptimal

BF16 · 1 GPU · vllm

100/100

score

Throughput

231.4 tok/s

Latency (ITL)

4.3ms

Est. TTFT

1ms

Cost/Month

$285

Cost/M Tokens

$0.47

Use this config →
A30optimal

BF16 · 1 GPU · vllm

100/100

score

Throughput

359.9 tok/s

Latency (ITL)

2.8ms

Est. TTFT

0ms

Cost/Month

$332

Cost/M Tokens

$0.35

Use this config →
RTX 4090optimal

BF16 · 1 GPU · vllm

100/100

score

Throughput

388.8 tok/s

Latency (ITL)

2.6ms

Est. TTFT

0ms

Cost/Month

$370

Cost/M Tokens

$0.36

Use this config →

Deployment Options

API

API Deployment

together

$0.20/M

output tokens

Self-Hosted

Single GPU

A10G

$285/mo

Min VRAM: 7 GB

Scale

Multi-GPU

RTX 3080 x2

452.6 tok/s

TP· $266/mo

API Pricing Comparison

ProviderInput $/MOutput $/MBadges
together$0.20$0.20
Cheapest

Cost Analysis

ProviderInput $/MOutput $/M~Monthly Cost
togetherBest Value$0.20$0.20$2

Cost per 1,000 Requests

Short (500 tok)

$0.14

via together

Medium (2K tok)

$0.56

via together

Long (8K tok)

$2.00

via together

Performance Estimates

Throughput by GPU

A10G
231.4 tok/s
A30
359.9 tok/s
RTX 4090
388.8 tok/s

VRAM Breakdown (A10G, BF16)

Weights
KV
Act
Weights 14.0 GBKV-Cache 8.6 GBActivations 8.0 GBOverhead 1.1 GB

Precision Impact

bf16

14.0 GB

weights/GPU

~231.4 tok/s

fp8

7.0 GB

weights/GPU

int4

3.5 GB

weights/GPU

Quality Benchmarks

Bottom 25%
3th percentile across all models
MMLU
42.0
Bottom 25% (2th pctile)
HumanEval
31.0
Bottom 25% (13th pctile)
GSM8K
28.0
Bottom 25% (2th pctile)
MT-Bench
60.0
Bottom 25% (0th pctile)

Capabilities

Features

Tool Use Vision Code Math Reasoning Multilingual Structured Output

Supported Frameworks

vllmsglangtgitensorrt-llmollama

Supported Precisions

BF16 (default)FP8INT4

Where to Deploy Code Llama 7B

Similar Models

Code Llama 13B

13B params · dense

Quality: 44

from $0.22/M

Larger modelCompare →
Smaller context, Higher qualityCompare →

Command R 7B

7B params · dense

Quality: 68

from $0.15/M

Larger context, Higher qualityCompare →

Falcon 7B

7B params · dense

Quality: 37

from $0.15/M

Smaller contextCompare →
Larger context, Higher qualityCompare →

Frequently Asked Questions

How much VRAM does Code Llama 7B need for inference?

Code Llama 7B requires approximately 14.0 GB of VRAM at BF16 precision, 7.0 GB at FP8, or 3.5 GB at INT4 quantization. Additional VRAM is needed for KV-cache (524288 bytes per token) and activations (~1.00 GB).

What is the best GPU for Code Llama 7B?

The top recommended GPU for Code Llama 7B is the A10G using BF16 precision. It achieves approximately 231.4 tokens/sec at an estimated cost of $285/month ($0.47/M tokens). Score: 100/100.

How much does Code Llama 7B inference cost?

Code Llama 7B API inference starts from $0.20/M input tokens and $0.20/M output tokens. Self-hosted inference costs depend on your GPU configuration — use our ROI calculator for a detailed breakdown.