# Trade-offs — designpattern.fyi

> Fundamental trade-offs across the tech stack - from distributed systems to ML, LLMs, cloud, AI infrastructure, and frameworks

- **Section**: Trade-offs
- **Canonical URL**: https://designpattern.fyi/trade_offs/

---

## Patterns in this Category


### [ACID vs BASE](https://designpattern.fyi/trade_offs/acid-vs-base/)
- **Summary**: Strong consistency (ACID) or high availability (BASE) — the database design spectrum.
- **Subcategory**: Distributed Systems


### [Alignment Tax](https://designpattern.fyi/trade_offs/alignment-tax/)
- **Summary**: The performance cost of making models safer and more aligned with human values. RLHF and safety training reduce raw capability.
- **Subcategory**: LLMs


### [Batch Size Trade-offs in Training](https://designpattern.fyi/trade_offs/batch-size-tradeoffs/)
- **Summary**: Larger batch sizes improve GPU utilization but can harm generalization. GPU utilization, gradient noise, convergence speed, and generalization trade-offs.
- **Subcategory**: AI Infrastructure


### [Batch vs. Online Learning](https://designpattern.fyi/trade_offs/batch-vs-online-learning/)
- **Summary**: Train on fixed historical dataset (batch) or update continuously as new data arrives (online). Latency to adapt, compute cost, stability, and infrastructure complexity trade-offs.
- **Subcategory**: Machine Learning


### [Bias-Variance Tradeoff](https://designpattern.fyi/trade_offs/bias-variance-tradeoff/)
- **Summary**: Model complexity as a dial between underfitting (high bias) and overfitting (high variance). The CAP equivalent of ML.
- **Subcategory**: Machine Learning


### [CAP Theorem](https://designpattern.fyi/trade_offs/cap-theorem/)
- **Summary**: Consistency, Availability, Partition Tolerance — pick two. The fundamental trade-off of distributed systems.
- **Subcategory**: Distributed Systems


### [Context Window vs. Speed vs. Cost](https://designpattern.fyi/trade_offs/context-window-vs-speed-cost/)
- **Summary**: Longer context enables richer reasoning but increases memory, latency, and cost quadratically for dense attention. Architectural solutions include Flash Attention, RAG, and KV …
- **Subcategory**: LLMs


### [Context-Length Wall](https://designpattern.fyi/trade_offs/context-length-wall/)
- **Summary**: The O(n^2) computational scaling of transformer attention limits context length. Longer context = exponentially more compute. Hardware constraints vs. information needs.
- **Subcategory**: LLMs


### [Data Parallelism vs. Model Parallelism vs. Pipeline Parallelism](https://designpattern.fyi/trade_offs/data-model-pipeline-parallelism/)
- **Summary**: How do you distribute a model across multiple GPUs/nodes? Different strategies for different model sizes and hardware constraints. Data, tensor, pipeline, sequence, and expert …
- **Subcategory**: AI Infrastructure


### [Exploration vs. Exploitation (Reinforcement Learning)](https://designpattern.fyi/trade_offs/exploration-vs-exploitation/)
- **Summary**: Balance trying new actions (exploration) against selecting known-good actions (exploitation). ε-Greedy, UCB, Thompson Sampling, and Boltzmann exploration strategies.
- **Subcategory**: Machine Learning


### [GPU vs. TPU vs. CPU for AI Workloads](https://designpattern.fyi/trade_offs/gpu-vs-tpu-vs-cpu/)
- **Summary**: Hardware choice depends on workload type, framework, scale, and cost. GPU (A100/H100), TPU (v4/v5), CPU (for small models), and custom ASIC trade-offs.
- **Subcategory**: AI Infrastructure


### [HHH Trilemma](https://designpattern.fyi/trade_offs/hhh-trilemma/)
- **Summary**: Helpful, Honest, Harmless — pick two. The fundamental tension in AI alignment. Making models more helpful can reduce honesty. Making them harmless can reduce helpfulness.
- **Subcategory**: LLMs


### [Horizontal vs. Vertical Scaling](https://designpattern.fyi/trade_offs/horizontal-vs-vertical-scaling/)
- **Summary**: Bigger machines (vertical) vs. more machines (horizontal). Complexity, cost, failure impact, speed, and limits trade-offs for scaling strategies.
- **Subcategory**: Cloud Infrastructure


### [JAX vs. PyTorch](https://designpattern.fyi/trade_offs/jax-vs-pytorch/)
- **Summary**: JAX&#39;s functional purity and XLA compilation enable performance but give up the imperative escape hatches that make PyTorch feel like Python.
- **Subcategory**: Frameworks


### [LangChain vs. LlamaIndex vs. Custom Pipelines](https://designpattern.fyi/trade_offs/langchain-vs-llamaindex-vs-custom/)
- **Summary**: Abstraction and speed-to-prototype vs. control, debuggability, and production fit. High-level frameworks vs. custom API calls with vector stores.
- **Subcategory**: Frameworks


### [Latency vs. Throughput](https://designpattern.fyi/trade_offs/latency-vs-throughput/)
- **Summary**: Optimizing for one often degrades the other. High throughput often requires batching (increases latency). Low latency requires immediate processing (underutilizes hardware).
- **Subcategory**: Cloud Infrastructure


### [Model Complexity vs. Interpretability](https://designpattern.fyi/trade_offs/model-complexity-vs-interpretability/)
- **Summary**: More complex models are generally more accurate but harder to understand and audit. Linear models vs. tree ensembles vs. neural networks and post-hoc interpretation methods.
- **Subcategory**: Machine Learning


### [Model Size vs. Inference Cost (Scaling Laws)](https://designpattern.fyi/trade_offs/model-size-vs-inference-cost/)
- **Summary**: Larger models are more capable but more expensive to serve. Chinchilla scaling laws, quantization, speculative decoding, knowledge distillation, and MoE architectures.
- **Subcategory**: LLMs


### [Multi-Cloud vs. Single-Cloud](https://designpattern.fyi/trade_offs/multi-cloud-vs-single-cloud/)
- **Summary**: Resilience and vendor flexibility vs. operational complexity and cost. Operational complexity, vendor lock-in, negotiating leverage, latency, data egress costs, and disaster …
- **Subcategory**: Cloud Infrastructure


### [PACELC Theorem](https://designpattern.fyi/trade_offs/pacelc-theorem/)
- **Summary**: CAP extended — if Partition (P), trade off Availability (A) vs Consistency (C); Else (E), trade off Latency (L) vs Consistency (C).
- **Subcategory**: Distributed Systems


### [Parametric Memory vs. Retrieval-Augmented Generation (RAG)](https://designpattern.fyi/trade_offs/parametric-vs-rag/)
- **Summary**: Should knowledge live in model weights (parametric) or be retrieved at inference time (RAG)? Knowledge freshness, latency, cost, hallucination risk, and scalability trade-offs.
- **Subcategory**: LLMs


### [Precision-Recall Tradeoff](https://designpattern.fyi/trade_offs/precision-recall-tradeoff/)
- **Summary**: The trilemma encoded in a 2x2 confusion matrix. Improve precision, reduce recall (and vice versa). Choose based on false positive vs. false negative costs.
- **Subcategory**: Machine Learning


### [Quantization Trade-offs](https://designpattern.fyi/trade_offs/quantization-tradeoffs/)
- **Summary**: Reduce numerical precision to shrink memory and increase speed, at the cost of accuracy. FP32, BF16, FP16, FP8, INT8, INT4, and 1-bit quantization trade-offs.
- **Subcategory**: AI Infrastructure


### [Reserved vs. On-Demand Instances](https://designpattern.fyi/trade_offs/reserved-vs-on-demand/)
- **Summary**: Commit to 1-3 year terms for up to 75% savings vs. pay-as-you-go. Trade flexibility for predictable cost savings.
- **Subcategory**: Cloud Infrastructure


### [Serverless vs. Container-Based Compute](https://designpattern.fyi/trade_offs/serverless-vs-containers/)
- **Summary**: Developer simplicity and auto-scaling vs. control and performance. Cold starts, execution limits, GPU support, cost model, and operational overhead trade-offs.
- **Subcategory**: Cloud Infrastructure


### [Sharding Strategies](https://designpattern.fyi/trade_offs/sharding-strategies/)
- **Summary**: How you partition data across nodes determines hotspot risk, query complexity, and rebalancing cost. Range, hash, directory, consistent hashing, and geo sharding.
- **Subcategory**: Distributed Systems


### [Spot vs. On-Demand Instances](https://designpattern.fyi/trade_offs/spot-vs-on-demand/)
- **Summary**: Up to 90% cost savings with spot instances, but they can be revoked with 2-minute notice. Trade reliability for cost or vice versa.
- **Subcategory**: Cloud Infrastructure


### [Static vs. Dynamic Computation Graphs](https://designpattern.fyi/trade_offs/static-vs-dynamic-graphs/)
- **Summary**: Define-and-run (static) vs. define-by-run (dynamic). Performance vs. flexibility trade-off in neural network execution models.
- **Subcategory**: Frameworks


### [Strong vs. Eventual Consistency](https://designpattern.fyi/trade_offs/strong-vs-eventual-consistency/)
- **Summary**: How up-to-date must a read be relative to the last successful write? Linearizability vs. causal vs. eventual consistency models.
- **Subcategory**: Distributed Systems


### [Synchronous vs. Asynchronous Replication](https://designpattern.fyi/trade_offs/sync-vs-async-replication/)
- **Summary**: Wait for replicas to acknowledge writes before confirming to client (sync) or acknowledge immediately and replicate in background (async). Durability vs. latency trade-off.
- **Subcategory**: Distributed Systems


### [Temperature and Sampling Trade-offs](https://designpattern.fyi/trade_offs/temperature-sampling-tradeoffs/)
- **Summary**: How deterministic vs. creative should generation be? Temperature, top-p (nucleus), top-K, and repetition penalty parameters control randomness vs. determinism.
- **Subcategory**: LLMs


### [TensorFlow vs. PyTorch](https://designpattern.fyi/trade_offs/tensorflow-vs-pytorch/)
- **Summary**: TensorFlow offers production deployment and ecosystem maturity. PyTorch offers research agility and community momentum. Choose based on use case and team expertise.
- **Subcategory**: Frameworks


### [Throughput vs. Latency Optimization](https://designpattern.fyi/trade_offs/throughput-vs-latency/)
- **Summary**: Batch processing maximizes throughput but increases latency. Real-time serving minimizes latency but reduces throughput. Different infrastructure for different SLAs.
- **Subcategory**: AI Infrastructure


### [Training vs. Inference Optimization](https://designpattern.fyi/trade_offs/training-vs-inference-optimization/)
- **Summary**: Training and inference optimization are almost orthogonal problems — different hardware, precision, batch sizes — yet most teams treat them as one thing.
- **Subcategory**: AI Infrastructure


### [Underfitting vs. Overfitting — Regularization Spectrum](https://designpattern.fyi/trade_offs/underfitting-vs-overfitting/)
- **Summary**: How much should the model constrain itself to avoid memorizing noise? L1, L2, dropout, batch normalization, early stopping, and data augmentation as regularization levers.
- **Subcategory**: Machine Learning



---

## Machine-Readable Resources
- **JSON Feed**: https://www.designpattern.fyi/api/patterns.json
- **OpenAPI 3.1**: https://www.designpattern.fyi/api/openapi.json
- **llms.txt**: https://www.designpattern.fyi/llms.txt
