The evolution of PyTorch from Facebook AI to the foundation of Llama 4

PyTorch has evolved from a 2016 research tool into the dominant framework powering Llama 4. The article details the Llama 4 release, including the Maverick model which uses a Mixture of Experts architecture to activate 17 billion parameters…

The evolution of PyTorch from Facebook AI to the foundation of Llama 4

Facebook AI released PyTorch in 2016 to provide a Pythonic tool for researchers. It uses dynamic computation graphs to allow models to build and adapt as code runs. This design made it a favorite for developers who want to inspect tensors at any point. In September 2022, the project moved to the Linux Foundation under the PyTorch Foundation. Founding members include AMD, Amazon Web Services, Google Cloud, Meta, Microsoft Azure, and NVIDIA. The community includes over 2400 contributors and 18,000 organizations.

Evaluating Framework Dominance in Research and Production

PyTorch commands 25% of the market share, while TensorFlow holds 37% of the market. The research community favors PyTorch, as it powers 85% of deep learning papers and hosts 228,000 models on the Hugging Face Hub, whereas TensorFlow only hosts 15,000 models. Statistics from 2026 show that 66% of machine learning practitioners use PyTorch, while 49% use TensorFlow. TensorFlow remains the leader for mobile and edge deployment through LiteRT. PyTorch leads the research community and NLP tasks because the Hugging Face Transformers library started as a PyTorch-only framework.

TensorFlow was launched by Google Brain in 2015. It originally relied on static graphs but moved to eager execution in version 2.x. TensorFlow has Keras integrated to make building models fast. PyTorch is often preferred for its NumPy-like syntax. You should choose PyTorch if your team prefers a Python-first workflow.

The Successive Iterations of Llama

The Llama model series began in February 2023 with Llama 1. This first iteration included sizes of 7B, 13B, 33B, and 65B. It used 1.4T tokens from public sources like Wikipedia and GitHub. Llama 2 followed in July 2023 with 7B, 13B, and 70B parameters. It introduced RLHF to create safer and smarter outputs. Llama 3 launched in April 2024 with 8B, 70B, and 405B sizes. It trained on 15T tokens and reached 128K context.

Llama 4 arrived on April 5, 2025. This release includes three distinct variants: Scout, Maverick, and Behemoth. The models use a Mixture of Experts architecture to improve efficiency. This design activates only a fraction of the model’s parameters for each token. This allows the models to scale in capacity without a proportional increase in compute requirements.

Structural Changes in Llama 4

Llama 4 uses early fusion to process information. This design integrates text and vision tokens into the same model backbone from the start. This unified input stream allows the model to develop joint representations across modalities. Llama 4 also includes a vision encoder derived from MetaCLIP. This encoder is trained with a frozen LLM backbone. This ensures visual inputs embed into a shared latent space.

The architecture uses a Mixture of Experts design to handle diverse inputs. For the Maverick model, the architecture includes 128 routed experts and one shared expert. Because the model uses a Mixture of Experts architecture, Llama 4 Maverick activates only 17 billion parameters from a total of 400 billion parameters for every single token processed. This allows for higher quality per FLOP when the training compute budget is fixed.

Specification of Llama 4 Models

The Llama 4 family provides different scales for different needs. Scout focuses on long-context reasoning, while Maverick targets high performance. Behemoth is a larger model intended for complex reasoning tasks.

Model Variant Total Parameters Active Parameters Context Window
Scout 109B 17B 10M tokens
Maverick 400B 17B 1M tokens
Behemoth 2T 288B Not specified

The Scout model uses the iRoPE architecture to reach its context window. This architecture uses interleaved attention layers that do not use positional embeddings. This is combined with standard Rotary Position Embeddings used in other layers.

Meta AI Infrastructure and Strategic Expansion

Meta reorganized its AI efforts around Meta Superintelligence Labs in 2025. The company invested $13.80 billion in Scale AI in 2025. The Associated Press reported a $14.3 billion deal for a 49 percent stake in Scale AI. Alexandr Wang joined Meta through this deal. Meta’s 2025 annual report records $69.69 billion in purchases of property and equipment. This includes infrastructure for all Meta services. Meta also reached an agreement with AMD for up to six gigawatts of GPU capacity.

Llama 4 uses 30T tokens for training. This training involves massive datasets including Meta-owned data from Instagram. The company uses these resources to power assistants across WhatsApp, Instagram, Facebook, Messenger, and Threads.

Communication Strategies for Distributed Training

Training large models requires efficient parallelism. For the 17B dense model, DP-out is faster than PP-out when the oversubscription ratio exceeds 1:4. In scenarios where the oversubscription ratio reaches 1:16, the DP-out method provides a 28.47% speedup for the 17B dense model compared to the PP-out method. The volume of data for DP-out grows linearly with the number of experts, but the volume for PP-out remains static.

For the 40B MoE model, PP-out scales better as the number of experts and oversubscription ratio increase. At a 1:16 ratio with 128 experts, PP-out is 49.4% faster than DP-out. This happens because PP communication volume remains constant as the number of experts increases. Does the increasing number of experts in MoE models eventually offset the communication delays inherent in large-scale distributed training?

The communication frequency of PP-out is higher because it requires pair-to-pair activation and gradient communication for each model chunk. In a 100K GPU simulation, PP-out is comparable or worse than DP-out. The iteration time for both models increases as latency across the datacenter building increases.

Framework Selection for Modern Engineering

PyTorch works best for developers who need a Python-first workflow. The framework provides the velocity required for modern generative AI tasks. TensorFlow is a stable asset for maintaining existing TFX pipelines or mobile deployments. The choice depends on whether a team needs research flexibility or enterprise stability.

airtrain.ai
airtrain.ai

The airtrain.ai newsroom covers AI research, models and the tools built on them.

More on this topic

Stay ahead of AI

Get the week's most important AI stories delivered to your inbox every Monday.

No spam. Unsubscribe anytime.

More Stories