Self-Hosting DeepSeek-R1 Models on AWS: A Cost-Benefit Analysis

liftoff · Tech · 2025 · source Agentic: no · promotional bias: low · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: self-hosted LLM inference for internal coding assistance

Liftoff evaluated whether self-hosted DeepSeek-R1 models on AWS could replace paid AI coding assistants for internal engineers while maintaining response quality, stability, and cost efficiency.

Constraints:

Architecture

Liftoff deployed DeepSeek-R1 model variants on AWS EC2 G5 GPU instances using Docker, NVIDIA Container Toolkit, Ollama, and OpenWeb UI. The team benchmarked 1.5B, 7B, 8B, and 16B models for throughput, quality, stability, cost, context-length behavior, and concurrency before concluding that SaaS LLM offerings still delivered better value for their scale.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  A["Internal engineers"] --> B["OpenWeb UI"]
  B --> C["Ollama runtime"]
  C --> F["DeepSeek-R1 model variants"]
  D["Docker and NVIDIA Container Toolkit"] --> C
  D --> E["AWS EC2 G5 GPU instances"]
  E --> F
  F --> G["Benchmarking harness"]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Internal engineers Users testing whether self-hosted DeepSeek can replace paid coding assistants. OpenWeb UI
OpenWeb UI ChatGPT-like frontend for internal testing. Internal engineers, Ollama runtime
Ollama runtime Loads and serves DeepSeek-R1 model variants locally. OpenWeb UI, DeepSeek-R1 model variants
Docker and NVIDIA Container Toolkit Provides consistent containerized environments with GPU access. Ollama runtime, AWS EC2 G5 GPU instances
AWS EC2 G5 GPU instances GPU-backed compute layer for DeepSeek inference experiments. Docker and NVIDIA Container Toolkit, DeepSeek-R1 model variants
DeepSeek-R1 model variants 1.5B, 7B, 8B, and 16B model sizes evaluated for quality, throughput, and cost. Ollama runtime, AWS EC2 G5 GPU instances, Benchmarking harness
Benchmarking harness Measures throughput, response quality, long-context degradation, crashes, and cost tradeoffs. DeepSeek-R1 model variants

Data flow

Engineers access OpenWeb UI as a ChatGPT-like frontend; Ollama loads DeepSeek-R1 variants inside Docker containers with NVIDIA GPU access on EC2 G5 instances; benchmarking exercises different model sizes and contexts; tuning changes such as quantization, batch size, sequence length, and context windows attempt to stabilize throughput; the results feed a cost-benefit decision against paid SaaS coding assistants.

3 supporting quotes
“Docker & NVIDIA Container Toolkit: The backbone of our deployment. It ensured consistent environments with GPU access”article, stated
“Ollama + OpenWeb UI: Ollama made local model loading dead simple, and OpenWeb UI gave us a clean, ChatGPT-like frontend”article, stated
“We benchmarked four DeepSeek-R1 model sizes: DeepSeek-R1 1.5B, 7B,8B, 16B.”article, stated

Why this architecture

Liftoff chose a lean EC2/Ollama/OpenWeb UI stack because it was fast to iterate and gave control over privacy, model size, and GPU tuning; benchmarking then showed that the operational costs and instability outweighed those benefits at their startup scale.

3 supporting quotes
“We kept things lean, practical, and fast to iterate.”article, stated
“While self-hosting gives you unmatched control, privacy, and flexibility, the cost-benefit trade-off just doesn’t land in your favor — yet.”article, stated
“Until infra costs drop or usage scales dramatically, self-hosting simply doesn’t add up.”article, stated

Models used: DeepSeek-R1 1.5B · DeepSeek-R1 7B · DeepSeek-R1 8B · DeepSeek-R1 16B

Scale

Alternatives considered (roads not taken)

Use smaller 1.5B models

Rejected because: They were efficient but did not meet production-grade response quality.

“Smaller models (1.5B) were highly efficient in terms of tokens/sec and cost, but their response quality fell short”article, stated

Use 7B or 8B models

Rejected because: They improved response quality but still did not fully replace commercial LLMs.

“Mid-tier models (7B, 8B) delivered noticeably better responses, but still didn’t reach the quality bar”article, stated

Use the 16B model for higher capability

Rejected because: It introduced slower throughput, high operational cost, low concurrency, and memory instability.

“The 16B model, while more capable, introduced major trade-offs: slower throughput, high operational costs, and low concurrency.”article, stated

Self-host instead of using SaaS LLM offerings

Rejected because: For small-to-medium startup scale, SaaS delivered better value after hidden operating costs.

“For startups operating at a small-to-medium scale, today’s SaaS LLM offerings deliver far better value for money.”article, stated

Patterns

eval-driven-development (evaluation)

The deployment decision was driven by benchmarking model sizes against throughput, quality, cost, concurrency, long-context behavior, and stability.

“We benchmarked four DeepSeek-R1 model sizes: DeepSeek-R1 1.5B, 7B,8B, 16B. Our benchmarking revealed crucial insights:”article, stated
“Performance tuning complexity: Although the models were pretrained, getting optimal throughput still required significant tuning.”article, stated

Tradeoffs

Self-host DeepSeek-R1 for control and privacy.

Chose AWS EC2 GPU instances with Ollama/OpenWeb UI over paid SaaS coding assistants.

Rationale: Self-hosting offered control, privacy, and flexibility, but the cost-benefit did not justify it at the tested scale.

“While self-hosting gives you unmatched control, privacy, and flexibility, the cost-benefit trade-off just doesn’t land in your favor”article, stated

Use mid-sized or larger models for quality.

Chose 7B, 8B, and 16B variants during benchmarking over only the efficient 1.5B model.

Rationale: Smaller models were efficient but quality was insufficient; larger models improved quality but increased cost and stability risks.

“Smaller models (1.5B) were highly efficient in terms of tokens/sec and cost, but their response quality fell short”article, stated

Gotchas (what bit them)

The 16B model was unstable under load.

Root cause: GPU memory limits required aggressive quantization and small batch sizes, and stability still was not guaranteed.

Resolution: Treat larger-model self-hosting as requiring meticulous GPU memory management and testing.

“The 16B model routinely crashed under load until we applied aggressive quantization techniques and heavily reduced batch sizes.”article, stated

Long context degraded generation speed and could crash the service.

Root cause: 8B and 16B models strained the GPU-backed EC2 setup as prompt context increased.

Resolution: Tune batch size, sequence length, and context window, but accept that this added unpredictable latency and runtime risk.

“As the prompt context increased — especially with 8B and 16B models — we observed token generation speeds dropping below 30 tokens/sec.”article, stated
“Small tweaks to batch_size, sequence length, or context window sometimes introduced unpredictable latency or runtime crashes.”article, stated

Cost analysis changed when hidden operations work was included.

Root cause: Setup, DevOps overhead, and maintenance widened the gap against SaaS LLM offerings.

Resolution: Treat self-hosting as an infrastructure product, not just a cheaper model endpoint.

“* Hidden operational costs (setup, DevOps overhead, maintenance) further widened the gap.”article, stated

Evaluation

Liftoff benchmarked DeepSeek-R1 model sizes for tokens/sec, cost, response quality, concurrency, context-length degradation, and crash behavior against the practical alternative of SaaS LLM coding assistants.

Metrics: tokens per second · response quality · operational cost · concurrency · crash/stability behavior · context-length degradation

“We benchmarked four DeepSeek-R1 model sizes: DeepSeek-R1 1.5B, 7B,8B, 16B. Our benchmarking revealed crucial insights:”article, stated
“while self-hosting is technically possible, it comes with major infrastructure and optimization demands”article, stated

Outcomes

Even under 100 internal users pushed the limits of reliable GPU-backed EC2 deployment for 8B and 16B reasoning models.

“just supporting under 100 internal users — not a massive workload by any means. Even so, infrastructure costs and engineering time quickly added up.”article, stated
“the 8B and 16B models already pushed the limits of what we could reliably run on GPU-backed EC2 instances.”article, stated