A Complete Guide to Local AI Deployment, Model Optimization and High-Performance Inference
About This Book
Chapter 1: What Is Inkling 2 Mini?
- The Thinking Machines Lab
- Architecture at a Glance
- Capabilities and Benchmark Performance
- Known Limitations and Failure Modes
- Why Inkling 2 Mini Matters for Local Deployment
- Distribution Channels and File Sizes
- What to Expect from This Book
Chapter 2: The Looped Transformer Architecture
- Standard Decoder-Only Transformers: A Recap
- The Three-Part Structure: Prelude, Core, Coda
- The Loop Mechanism in Detail
- Mixture-of-Experts: Routing, Experts and Sparsity
- Attention: Hybrid Local and Global
- The Vision Encoder
- Architecture Summary and Implications
Chapter 3: Numerical Precision and the NVFP4 Story
- Why Precision Matters
- Modern Low-Bit Formats
- End-to-End 4-Bit Training
- Quantization-Aware Training vs. Post-Training Quantization
- Implications for Local Inference
Chapter 4: Tokenization, Positional Encoding and the Vision Encoder
- Text Tokenization
- Positional Encoding for Million-Token Contexts
- The Vision Encoder
- Input Processing Pipeline Summary
Chapter 5: The Memory Wall and Why It Matters
- The Memory Wall Explained
- Memory Bandwidth and Decode Speed
- VRAM vs. System RAM vs. Unified Memory
- The PCIe Bottleneck
- Memory Hierarchy
- Calculating Memory Requirements for Inkling 2 Mini
- Bandwidth-Limited Throughput Estimation
- Key Takeaways
Chapter 6: CPU Inference: What You Can and Cannot Do
- How CPU Inference Works
- CPU Instruction Sets
- Threading and Core Count
- Weight Repacking
- Page Cache, mmap and Model Loading
- Measured CPU Performance Data
- When CPU Is the Right Choice
- Practical CPU-Only Setup
- Key Takeaways
Chapter 7: GPU Acceleration: NVIDIA, AMD, Intel and Apple Silicon
- Why GPUs Are Good at LLM Inference
- NVIDIA: CUDA and the Blackwell Generation
- AMD: ROCm and Vulkan
- Intel: Arc and oneAPI
- Apple Silicon: Unified Memory and Metal
- DGX Spark and Dedicated Local AI Hardware
- Matching Hardware to Budget and Use Case
Chapter 8: Building Your Machine: Configurations for Every Budget
- General Principles for AI-Optimized Hardware
- Configuration 1: Entry-Level ($400–$700)
- Configuration 2: Budget Gaming/AI ($800–$1,200)
- Configuration 3: Mid-Range ($2,500–$3,700)
- Configuration 4: High-End / Enthusiast ($3,000–$10,000)
- Configuration 5: Mini PC / Compact Build
- Laptop Recommendations
- Upgrade Path
- Key Takeaways
Chapter 9: Model Formats: Safetensors, GGUF and Beyond
- Why There Are So Many Formats
- Safetensors: The Native Format
- GGUF: The Local Inference Format
- MLX Format: Apple Silicon
- Ollama Format
- Conversion Between Formats
- Choosing the Right Format
Chapter 10: llama.cpp: The Universal Local Inference Engine
- Why llama.cpp?
- Building llama.cpp
- Downloading the Model
- Running the Inference Server
- Using the Web UI
- Using the OpenAI-Compatible API
- Command-Line Chat
- DSpark Speculative Decoding
- Performance Tuning
- Common Errors and Solutions
Chapter 11: Ollama: One-Command Local Inference
- What Is Ollama?
- Installing Ollama
- Pulling and Running Inkling 2 Mini
- Using the Ollama API
- Configuring Ollama
- Ollama vs. llama.cpp
- Platform Limitations
- Key Takeaways
Chapter 12: vLLM and SGLang: High-Performance Serving
- vLLM: The Open-Source Serving Engine
- vLLM Requirements for Inkling 2 Mini
- Installing vLLM
- Running Inkling 2 Mini with vLLM
- Using the vLLM API
- vLLM Performance Characteristics
- SGLang: The Alternative Serving Framework
- Installing SGLang
- Running Inkling 2 Mini with SGLang
- SGLang-Specific Features for Inkling 2 Mini
- Using the SGLang API
- vLLM vs. SGLang: Which Should You Use?
- When to Use vLLM/SGLang vs. llama.cpp
Chapter 13: Apple Silicon: MLX, Ollama and LM Studio
- Why Apple Silicon Is Special for Local LLMs
- Which Mac Can Run Inkling 2 Mini?
- The MLX Framework
- Ollama on macOS
- LM Studio on macOS
- Metal Performance Considerations
- Benchmark Summary: Apple Silicon Performance
- Summary
Chapter 14: LM Studio, Unsloth Desktop and Other GUI Tools
- LM Studio
- Unsloth Desktop
- Llama App (Mobile)
- Other Tools Worth Mentioning
- Choosing the Right Tool
- GUI vs. Command Line: When to Use Each
- Summary
Chapter 15: Installation and Deployment by Operating System
- Prerequisites
- Linux: Complete Setup
- Windows: Complete Setup
- macOS: Complete Setup
- Model Download and Caching Strategies
- Troubleshooting Installation
- Summary
Chapter 16: Building a Local AI Assistant
- Project Overview
- Project Structure
- Step 1: Dependencies
- Step 2: Configuration
- Step 3: System Prompts
- Step 4: The Assistant Application
- Step 5: Running the Assistant
- Using Different Prompts and Reasoning Levels
- How the Streaming Works
- Conversation History and Context Management
- Extending the Assistant
- Summary
Chapter 17: Retrieval-Augmented Generation with Inkling 2 Mini
- Why RAG Matters for Local Models
- Project Overview
- Step 1: Dependencies
- Step 2: The Embedding Model
- Step 3: The RAG Application
- Step 4: Preparing Documents
- Step 5: Running the RAG System
- How RAG Works: The Details
- Tuning the RAG System
- Scaling Up
- Summary
Chapter 18: Local Inference Services and API Integration
- llama-server as a Production Service
- API Authentication and Network Security
- OpenAI SDK Integration
- Function Calling and Tool Use
- Structured Output and JSON Mode
- Load Management and Concurrent Requests
- Summary
Chapter 19: Advanced Inference Optimization
- DSpark Speculative Decoding
- Flash Attention and Banded Attention
- KV Cache Quantization
- Context Length Optimization
- Batch Sizing
- Asynchronous Execution and Model Loading
- Power and Thermal Management
- Profiling Your Deployment
- Optimization Checklist
- Summary
Chapter 20: Benchmarking, Troubleshooting and Security
- Benchmarking Methodology
- Troubleshooting
- Security
- Summary
Conclusion
- The Central Thesis, Proven
- What You Learned
- A Roadmap for Your Local AI Journey
- The Bigger Picture
References
- Primary Sources: Thinking Machines Lab
- Model Distributions and Quantizations
- Inference Frameworks
- Hardware and GPU Documentation
- Format Specifications
- Benchmark and Performance Sources
- Quantization Quality Analysis
- General References
- Trademarks and Licensing