Deploy, Run and Master Unfiltered LLMs in the Cloud
Introduction
- The Alignment Tax
- Why Self-Host?
- What This Book Will Teach You
- Who Should Read This
Chapter 1: Inside the LLM: Foundational Architecture
- Attention Is All You Need: The Transformer Core
- Autoregressive Generation and Autoregressive Loss
- Parameters, Layers and Compute Budget
- Tokens, Tokenization and Why They Matter
- Context Windows and Memory
Chapter 2: The Model Zoo: Families, Sizes and Tradeoffs
- The Llama Lineage: Meta and Its Forks
- Mistral, Mixtral and Sparse MoE Architectures
- Qwen and the Chinese Model Renaissance
- DeepSeek and Open Weights for Reasoning
- Smaller Models and Efficiency Champions
- Choosing a Model Family for Your Use Case
Chapter 3: Alignment, Refusal and Safety: How It Works
- Supervised Fine-Tuning and Instruction Tuning
- Reinforcement Learning from Human Feedback
- Direct Preference Optimization and Alignment Loss
- The Anatomy of Refusal: How Models Learn to Say No
- Alignment Tax and Capability Degradation
- Measuring Refusal Rates and Overrefusal
Chapter 4: Uncensored, Abliterated and Unaligned Models
- Base Versus Instruct Versus Uncensored
- Fine-Tuning for Refusal Removal
- What “Uncensored” Means in Practice
- License Implications and Permissiveness
- Ethical and Legal Considerations
- Finding the Right Level of Uncensorship
Chapter 5: Abliteration: The Science and Practice
- The Concept of Activation Steering
- Finding Refusal Directions in Weight Space
- Gradient Abliteration Explained
- Implementing Abliteration: Step by Step
- Limitations, Fail Modes and Safety
- Evaluating Abliterated Models
Chapter 6: Model Formats, Precision and Quantization
- Full Precision: FP32, FP16 and BF16
- The Rise of FP8 and Mixed Precision
- Integer Quantization: INT8 and INT4 Fundamentals
- GGUF and the llama.cpp Ecosystem
- GPTQ, AWQ and EXL2 for GPU Deployment
- bitsandbytes and 4-bit Loading
- Choosing the Right Format for Your Hardware
Chapter 7: Hugging Face: Discovery, Downloads and Model Cards
- Navigating the Hub for Uncensored Models
- Reading Between the Lines of Model Cards
- Tags, Metrics and Quality Signals
- Licensed, Permissive and Restricted Weights
- Download Strategies: Git, CLI and Direct Links
- Verifying Model Integrity and Safety
Chapter 8: The GPU Hardware Landscape
- NVIDIA Architecture Generations and Tensor Cores
- Consumer GPUs: RTX 4090 and RTX 5090
- Datacenter Workhorses: T4, A10, L4, L40S
- Flagship GPUs: A100, H100 and H200
- The Blackwell Era: B200 and GB200
- Hardware Selection by Model Size and Workload
Chapter 9: Cloud GPU Providers: A Comprehensive Comparison
- Pricelist and Availability Comparison
- Security and Privacy Models
- Storage, Networking and Persistence
- Reliability and Community Trust
- Acceptable Use Policies and Model Restrictions
- Decision Matrix: Which Provider for What Workload
Chapter 10: Deploying on RunPod: Secure Cloud and Serverless
- Account Setup and Template Selection
- Choosing Your GPU and Configuring Storage
- Launching a Container with vLLM or Ollama
- Exposing Your Endpoint with Port Configuration
- Persistent Storage and Model Caching
- Serverless Inference for Cost Efficiency
Chapter 11: Deploying on Vast.ai: Market-Driven GPU Access
- Understanding the Marketplace Model
- Evaluating Hosts and Instance Quality
- Provisioning and Connecting to an Instance
- Deploying Models with Prebuilt and Custom Templates
- Network Security and SSH Configuration
- Cost Control and Instance Management
Chapter 12: Deploying on CoreWeave and AWS
- CoreWeave: The Specialized GPU Cloud
- CoreWeave Account Setup and Instance Deployment
- AWS EC2 GPU Instances: p5, p4, g5 and g6 Families
- Configuring AWS Instances and Installing Drivers
- Managing AWS GPU Costs and Spot Instances
- Choosing Between CoreWeave and AWS
Chapter 13: Deploying on GCP, Azure, Lambda and Paperspace
- GCP GPU Instances: A2, A3 and L2 Families
- Azure GPU VMs: NV, ND and NC Series
- Lambda Cloud: High-Density Direct-Connect GPUs
- Paperspace and Gradient: Notebooks and GPU Instances
- Cross-Provider Cost and Performance Comparison
- Multi-Provider Strategies for Availability
Chapter 14: Inference Frameworks: The Engine Room
- Hugging Face Transformers and Accelerate
- vLLM: PagedAttention and Continuous Batching
- SGLang: Structured Generation and RadixAttention
- llama.cpp: CPU and Quantized GPU Inference
- Ollama: Simplicity and Model Management
- Text Generation Inference and ExLlamaV2
- Framework Selection Matrix
Chapter 15: End-to-End Deployment: Building Your Inference Stack
- Architecture Overview and Component Selection
- Provisioning Your GPU Instance
- Installing the Stack: Drivers, Python, Framework
- Loading the Model and Starting Inference
- Exposing the API: Nginx, TLS and Auth
- Connecting Clients and Verifying Performance
Chapter 16: Building OpenAI-Compatible APIs and Chat Interfaces
- OpenAI-Compatible API Endpoints
- vLLM and Ollama OpenAI Compatibility
- Open WebUI and Frontend Integration
- Connecting Local Applications via API
- Automation and Workflow Integration
- Multi-Model Routers and Load Distribution
Chapter 17: Advanced Inference Optimization
- Multi-GPU and Distributed Inference
- Tensor Parallelism and Pipeline Parallelism
- KV-Cache Management and Prefilling
- Continuous Batching and Request Scheduling
- Speculative Decoding and Draft Models
- FlashAttention and Memory-Optimized Kernels
Chapter 18: Custom Uncensored Models: Fine-Tuning and Modification
- Dataset Preparation for Uncensored Alignment
- LoRA and QLoRA Fine-Tuning
- Merging LoRA Adapters and Merging Models
- Applying Abliteration to Your Model
- Evaluating Refusal Behavior Changes
- Saving, Versioning and Deploying Custom Checkpoints
Chapter 19: Benchmarking, Metrics and Performance Tuning
- Key Metrics: TPS, TTFT, Throughput and Latency
- Reproducible Benchmarking Scripts
- Profiling VRAM and GPU Utilization
- Tuning Parameters for Speed and Quality
- Cost Per Token and Operational Economics
- Comparative Benchmarking Across Frameworks
Chapter 20: Production Deployment: Scaling, Security and Operations
- Production Architecture Patterns
- Autoscaling and Load Balancing
- Monitoring, Logging and Observability
- Security Hardening and Network Isolation
- Secrets Management and Access Control
- Backups, Snapshots and Disaster Recovery