Code Llama 34B Instruct on NVIDIA L40S
Can the NVIDIA L40S run Code Llama 34B Instruct?
Yes, it runs great
Runs great. At Q4_K_M it needs about 25.2 GB of 48.0 GB usable, with an estimated speed of 31.4 tok/s.
- Best quant
Q4_K_M- Generation speed
- 31.4 tok/s
- Prompt processing
- 1,955 tok/s
- First token (1K prompt)
- 0.5 s
- Largest safe context
- 16K
Best app to run it on the NVIDIA L40S
On Linux
- The full model fits in GPU memory at 8-bit, so it can batch many requests: best for serving a team or an app.
vllm serve meta-llama/CodeLlama-34b-Instruct-hfOn Windows
- One command with Ollama’s own build of this model.
- Serves an OpenAI-compatible API that other apps and coding tools can use.
ollama run codellama:34b-instruct-q4_K_MDownload Code Llama 34B Instruct
Recommended for the NVIDIA L40S: Q4_K_M. Every other quantization has its own download link in the table below.
Quickest · Ollama
One command downloads a ready-to-run version and starts a chat.
ollama run codellama:34b-instruct-q4_K_MQuantized files · GGUF
Works in LM Studio, llama.cpp, Jan and Ollama. No sign-in needed.
Download the Q4_K_M file (opens in a new tab)
huggingface.co/TheBloke/CodeLlama-34B-Instruct-GGUF (opens in a new tab)
ollama run hf.co/TheBloke/CodeLlama-34B-Instruct-GGUF:Q4_K_MOriginal weights · Hugging Face
Full-precision files from Meta, for fine-tuning, vLLM, Transformers.
huggingface.co/meta-llama/CodeLlama-34b-Instruct-hf (opens in a new tab)
Official repo · GitHub
Reference code, inference scripts and docs from Meta. The weights themselves download from Hugging Face.
github.com/meta-llama/codellama (opens in a new tab)
git clone https://github.com/meta-llama/codellamaHow it’s rated
Match score
To order lists, each result also gets a match score out of 100 from four parts. It favors the most capable model that still runs well.
| Model quality | 16.2 / 45 | |
|---|---|---|
| Memory fit | 25.0 / 25 | |
| Speed | 13.3 / 15 | |
| Memory use | 12.1 / 15 | |
| Match score | 66.7 / 100 |
Every quantization on the NVIDIA L40S
| Quant | Memory needed | Available | Speed | Runs | Quality | Download |
|---|---|---|---|---|---|---|
Q2_K | 18.1 GB | 48.0 GB | 51.6 tok/s | Runs great | 26Basic quality (D) · 26 of 100: how capable the model is at Q2_K, whatever it runs on. Match score 60/100 (quality, fit, speed and memory use) sets the ranking. | GGUF (opens in a new tab) |
Q3_K_M | 21.1 GB | 48.0 GB | 40.6 tok/s | Runs great | 31Basic quality (D) · 31 of 100: how capable the model is at Q3_K_M, whatever it runs on. Match score 64/100 (quality, fit, speed and memory use) sets the ranking. | GGUF (opens in a new tab) |
Q4_K_M | 25.2 GB | 48.0 GB | 31.4 tok/s | Runs great | 36Basic quality (D) · 36 of 100: how capable the model is at Q4_K_M, whatever it runs on. Match score 66/100 (quality, fit, speed and memory use) sets the ranking. | GGUF (opens in a new tab) |
Q5_K_M | 28.6 GB | 48.0 GB | 26.0 tok/s | Runs well | 36Basic quality (D) · 36 of 100: how capable the model is at Q5_K_M, whatever it runs on. Match score 67/100 (quality, fit, speed and memory use) sets the ranking. | GGUF (opens in a new tab) |
Q6_K | 32.3 GB | 48.0 GB | 21.8 tok/s | Runs well | 37Basic quality (D) · 37 of 100: how capable the model is at Q6_K, whatever it runs on. Match score 68/100 (quality, fit, speed and memory use) sets the ranking. | GGUF (opens in a new tab) |
Q8_0 | 40.4 GB | 48.0 GB | 16.0 tok/s | Runs well | 38Basic quality (D) · 38 of 100: how capable the model is at Q8_0, whatever it runs on. Match score 66/100 (quality, fit, speed and memory use) sets the ranking. | GGUF (opens in a new tab) |
F16 | 72.1 GB | 48.0 GB | — | Won't run | 38Basic quality (D) · 38 of 100: how capable the model is at F16, whatever it runs on. Match score 5/100 (quality, fit, speed and memory use) sets the ranking. | Original weights (opens in a new tab) |
Memory figures assume 8K of context. Longer conversations or documents grow the KV cache.
Other hardware that runs it
-
36Basic quality (D) · 36 of 100: how capable the model is at Q4_K_M, whatever it runs on. Match score 71/100 (quality, fit, speed and memory use) sets the ranking.
NVIDIA GeForce RTX 5090
-
36Basic quality (D) · 36 of 100: how capable the model is at Q4_K_M, whatever it runs on. Match score 69/100 (quality, fit, speed and memory use) sets the ranking.
NVIDIA GeForce RTX 4090
-
31Basic quality (D) · 31 of 100: how capable the model is at Q3_K_M, whatever it runs on. Match score 69/100 (quality, fit, speed and memory use) sets the ranking.
NVIDIA GeForce RTX 3090
-
31Basic quality (D) · 31 of 100: how capable the model is at Q3_K_M, whatever it runs on. Match score 69/100 (quality, fit, speed and memory use) sets the ranking.
AMD Radeon RX 7900 XTX
-
37Basic quality (D) · 37 of 100: how capable the model is at Q6_K, whatever it runs on. Match score 65/100 (quality, fit, speed and memory use) sets the ranking.
NVIDIA RTX PRO 6000 Blackwell
-
36Basic quality (D) · 36 of 100: how capable the model is at Q4_K_M, whatever it runs on. Match score 63/100 (quality, fit, speed and memory use) sets the ranking.
Apple M4 Max (64 GB)
Quick answers
How much memory does Code Llama 34B Instruct need on the NVIDIA L40S 48GB?
At Q4_K_M it needs about 25.2 GB. The NVIDIA L40S 48GB has 48.0 GB usable.
How fast is Code Llama 34B Instruct on the NVIDIA L40S 48GB?
About 31.4 tok/s at Q4_K_M, an estimate from the hardware’s memory bandwidth and the size of the model.
Which quantization of Code Llama 34B Instruct should I use on the NVIDIA L40S 48GB?
Q4_K_M. Of the versions that fit, it is the one that runs best; when two run equally well, the check prefers the higher-rated one.
Estimates come from published hardware specs and our open formulas, not from running the model on your machine. Real speed varies with runtime, drivers and settings. Numbers marked “Measured” come from a linked benchmark.