[agenticwork]
← blog

Open Source AI in 2025: PyTorch, Hugging Face, and the New Stack

Open source has won the AI infrastructure layer. This is not a prediction or an aspiration — it is the observed state of the industry. The models that organizations train, the frameworks they train them with, the tools they use for inference, and the platforms they deploy on are overwhelmingly open source. The proprietary layer sits on top, in the application logic and the fine-tuned models. But the infrastructure stack that makes it all possible is open.

Understanding this stack is essential for engineering leaders making technology decisions. The choices you make about frameworks, model serving, and orchestration today will determine your flexibility, your costs, and your ability to adapt as the landscape continues to evolve.

PyTorch: The Training Standard

PyTorch has become the dominant framework for AI model training. TheLinux Foundation's 2024 report on generative AI found that PyTorch leads model training adoption at 63%, with over 3,500 individual contributors across its ecosystem. It became a Linux Foundation project in September 2022, moving governance away from Meta (its original developer) to a neutral foundation — a critical factor for organizations concerned about single-vendor dependency.

PyTorch's dominance in training comes from several factors:

  • Eager execution by default: PyTorch uses an imperative programming model where operations execute immediately. This makes debugging intuitive — you can set breakpoints, print intermediate values, and use standard Python debugging tools. For research teams iterating rapidly on model architectures, this is a significant productivity advantage.
  • Research-to-production pipeline: PyTorch 2.0 introduced torch.compile, which adds graph-mode optimization on top of the eager execution model. This closed the historical gap with TensorFlow on production performance while maintaining the developer experience that made PyTorch popular for research.
  • Ecosystem breadth: Nearly every new model architecture is released with a PyTorch implementation first. When a new research paper drops with code, it is almost certainly PyTorch. This creates a gravitational pull that reinforces adoption.

TensorFlow's Role

TensorFlow has not disappeared. It retains a significant presence in production serving environments, particularly through TensorFlow Serving and TensorFlow Lite for edge deployment. Organizations with existing TensorFlow pipelines are not rushing to migrate — working production systems do not get rewritten for framework preferences. But new projects overwhelmingly start with PyTorch, and the research community has largely converged on it as the default.

Hugging Face: The Model Hub

If PyTorch is the language of model training, Hugging Face is the distribution network. Hugging Face Hub hosts over one million models and has become the default destination for releasing model weights, both from research labs and from organizations fine-tuning models for specific use cases.

Hugging Face's significance goes beyond hosting:

  • Transformers library: The transformers library provides a uniform API for loading and running thousands of model architectures. A consistent interface across models from different providers reduces the switching cost between models to a configuration change.
  • Standardized model formats: The Safetensors format, developed by Hugging Face, has become the standard for distributing model weights safely. GGUF format, used by llama.cpp and compatible tools, provides an alternative optimized for CPU inference.
  • Dataset hosting: Beyond models, Hugging Face hosts datasets used for training and evaluation. This co-location of models and data simplifies the reproducibility pipeline.

For enterprise teams, Hugging Face's role as a neutral hub means model selection is not constrained to a single vendor's offerings. You can evaluate models from Meta (Llama), Mistral, Google (Gemma), Microsoft (Phi), and hundreds of community fine-tunes through a consistent interface. This is the model portability that prevents vendor lock-in at the most fundamental level.

Inference: vLLM and SGLang

The inference layer has seen the most dramatic open source innovation in the past two years. Serving large language models efficiently is a distinct engineering challenge from training them — it requires optimizing for latency, throughput, and memory utilization simultaneously.

vLLM

vLLM, developed at UC Berkeley, introduced PagedAttention — a memory management technique inspired by virtual memory in operating systems. Instead of allocating contiguous memory blocks for each request's key-value cache, PagedAttention uses non-contiguous blocks that can be allocated and freed dynamically. This eliminates the memory fragmentation that previously limited batch sizes and throughput.

The practical impact is significant: vLLM achieves 2-4x higher throughput than naive serving approaches. It supports continuous batching (new requests can join an ongoing batch), tensor parallelism (distributing a model across multiple GPUs), and a wide range of model architectures. It deploys as a standard container image compatible with any Kubernetes cluster.

SGLang

SGLang, also from UC Berkeley, takes a different approach with its RadixAttention system. It uses a radix tree to cache and reuse key-value pairs from shared prefixes across requests. For agentic AI workloads where many requests share the same system prompt, tool definitions, and context — which can represent thousands of tokens — prefix caching reduces redundant computation dramatically.

SGLang also introduces a structured generation runtime that enforces output schemas at the decoding level. For agentic systems where model output must conform to specific formats (tool call schemas, JSON structures, function parameters), this eliminates an entire category of parsing errors.

The Orchestration Layer

Above the model and inference layers sits the orchestration layer that manages how models are used in production workflows. This is where the open source landscape is most fragmented and where the choices have the greatest architectural impact.

Frameworks like LangChain and LlamaIndex provide building blocks for RAG pipelines and chain-of-thought workflows. CrewAI and AutoGen offer multi-agent orchestration patterns. Each makes different tradeoffs around abstraction level, flexibility, and ease of use.

The challenge with most orchestration frameworks is that they focus on the happy path — getting a demo working — without addressing the production requirements that determine whether a system actually ships: credential management, audit trails, human approval workflows, sandboxed execution, and multi-model routing.

Our Platform: Open Source With Production Defaults

Our platform is built on the conviction that the orchestration layer for enterprise AI should not be proprietary, with an open-source release of its core components planned. It sits on top of the open source stack described above: models from Hugging Face, served by vLLM or SGLang, running on Kubernetes.

What distinguishes our platform from other open source orchestration tools is the breadth of the platform and the focus on production requirements from day one:

  • SmartModelRouter: Routes requests across 15+ model providers (cloud APIs and self-hosted) based on task requirements, cost policies, and latency targets. The Intelligence Slider (0-100) lets teams tune the cost-vs-quality tradeoff per workflow, and automatic failover means a provider outage never halts production.
  • MCP Workshop: Create, test, and deploy MCP (Model Context Protocol) servers with hot-reload during development and zero-downtime deployment to production. This is the tool integration layer — build connectors to your internal systems in hours, test them interactively, and ship them without service interruption.
  • agenticode-cli: A command-line interface for CI/CD pipelines and script-based MCP development. Automate agent deployment, run evaluation suites, and manage MCP servers from your terminal or CI pipeline. Composable, and designed for the same developer workflows the rest of this stack supports.
  • Sandboxed tool execution: Every tool call runs in an isolated Kubernetes container with scoped credentials and network policies.
  • Full audit trail: Every agent action, approval decision, and tool execution is logged with cryptographic hashing in an immutable, tamper-evident record.

The Open Source Advantage

The convergence of open source tools at every layer of the AI stack represents a structural shift in the power dynamics of enterprise AI adoption. Organizations are not beholden to a single vendor for any critical component: not for training, not for model weights, not for inference, and not for orchestration.

This matters for three practical reasons:

  1. Cost control: Open source inference on your own hardware eliminates per-token pricing. At production scale, this is the difference between AI as a cost center and AI as a cost-effective capability.
  2. Flexibility: When a better model, a faster inference engine, or a more capable orchestration pattern emerges, you can adopt it without rearchitecting your system.
  3. Transparency: For regulated industries, the ability to inspect, audit, and understand every component of your AI stack is not a nice-to-have. It is a compliance requirement that proprietary black-box services cannot fully satisfy.

The open source AI stack in 2025 is not experimental. It is the foundation that production AI systems are built on. The organizations that understand this stack — its components, its interfaces, and its tradeoffs — are the ones making the best decisions about where to invest and how to build.

Sources