First-Generation Open-Source LLM: Architecture Design and Pre-Training Practices Explained
This article breaks down the key technical decisions behind a first-generation open-source large language model series released in early 2024 with 7B and 67B variants. It covers the choice of a dense Transformer architecture, differentiated attention designs (MHA vs. GQA), a three-stage data pipeline that processed 2 trillion tokens with 89.8% deduplication, a two-stage alignment strategy combining SFT and DPO, and practical inference cost optimizations such as quantization, dynamic batching, speculative sampling, and PagedAttention. Readers will gain actionable insights into building or customizing their own base models.
Introduction: The Value and Challenges of Base Models
In the evolution of large language models (LLMs), the first generation of a base model often sets the technical direction and capability ceiling for the entire series. In early 2024, an open-source LLM series was released in two parameter sizes—7B and 67B—with both base and chat variants, distributed under a fully open-source license. This strategy lowered the barrier to entry for the research community and enterprises, while the open ecosystem in turn fed back into model iteration.
This article uses the first generation of that series as a case study to dissect its key technical decisions: model architecture, pre-training data construction, post-training alignment methods, and inference cost optimization. These lessons are directly relevant to any team planning to build or deeply customize its own LLM.
1. Architecture: A Pragmatic Return to the Dense Transformer
At a time when Mixture-of-Experts (MoE) architectures were becoming the mainstream choice for very large models, the first-generation model opted for the relatively conservative dense Transformer architecture. This was not a sign of technical backwardness, but a deliberate trade-off across training stability, inference efficiency, and deployment friendliness.
1.1 Advantages of the Dense Architecture
In a dense architecture, every token activates all parameters at every layer, resulting in a simple computation path and predictable memory access patterns. For models at the 7B and 67B scale, a dense design can achieve high training throughput without introducing complex routing logic or load-balancing strategies. By contrast, MoE activates only a subset of experts during inference, but training is more sensitive to imbalanced expert assignment and communication overhead. Choosing a dense architecture was essentially an optimal balance between engineering complexity and model capacity—trading less “magic” for a more stable convergence curve.
1.2 Differentiated Attention Design
Attention is the core of the Transformer. The first-generation model adopted different attention implementations for different parameter scales:
- 7B model: Uses standard Multi-Head Attention (MHA). Given the smaller parameter count, the KV cache overhead of MHA is acceptable, and the implementation is simple, which facilitates debugging and rapid iteration.
- 67B model: Replaces MHA with Grouped-Query Attention (GQA). GQA divides query heads into groups, with each group sharing a single set of key-value heads. For example, with 32 query heads and 8 groups, there are only 8 key-value heads. This reduces KV cache memory usage by roughly 4x, significantly easing GPU memory pressure during per-token inference and enabling longer context inputs and higher concurrent throughput.
This “scale determines the solution” approach reflects a deep understanding of real deployment bottlenecks: small models prioritize flexibility, large models prioritize cost efficiency—rather than blindly applying the newest technique everywhere.
2. Data Engineering: Three-Stage Purification of Two Trillion Tokens
The capability ceiling of a language model is largely determined by the quality and scale of its pre-training data. The first-generation model used roughly 2 trillion tokens of Chinese-English bilingual data, processed through a three-stage pipeline: deduplication → filtering → shuffling. Notably, the deduplication stage removed 89.8% of duplicate documents—an aggressive but necessary step.
2.1 Deduplication: Removing Redundancy to Increase Information Density
Web text data contains massive amounts of duplication, including reposts, templated pages, and near-identical passages. Without deduplication, the model repeatedly learns similar patterns, wasting compute and encouraging repetition during generation while degrading generalization. Common deduplication methods include:
- MinHash and LSH: Shingle documents into n-gram sets, compute Jaccard similarity via MinHash, and accelerate similar-pair lookup with Locality-Sensitive Hashing (LSH).
- Suffix arrays / SimHash: Used to find exact or near-duplicate documents.
The team reported that deduplication eliminated 89.8% of duplicate documents, indicating enormous redundancy in the raw corpus. The lesson: the “raw size” of a dataset is not its “effective size.” Aggressive deduplication allows a model to learn richer semantics from fewer tokens.
2.2 Filtering: Quality Grading and Sensitive Content Removal
The filtering stage typically includes:
- Rule-based filtering: Removing passages with excessive HTML tags, garbled characters, or non-natural-language symbols.
- Classifier-based filtering: Training a quality classifier (e.g., a fast TextCNN) to score documents and discard low-scoring ones.
- Semantic deduplication: Using an embedding model to vectorize documents and remove highly similar samples.
In addition, personally identifiable information, violent content, and illegal material must be filtered out to meet safety and compliance requirements. The goal is to retain high-quality, high-information-entropy text—books, papers, technical documentation, news reports—rather than casually aggregated short social media posts.
2.3 Shuffling: Randomizing Order for Training Stability
When building the final training set, all documents are mixed and their order shuffled. This serves two purposes:
- Preventing order bias: If data is arranged by source or time, the model may learn spurious correlations.
- Stabilizing gradient updates: A shuffled data stream keeps each batch’s distribution relatively uniform, avoiding optimization instability caused by abrupt local distribution shifts.
Note that shuffling should happen at the document level, not the line level, to preserve long-range dependencies. Sampling ratios across sources can also be tuned to control language balance—for example, a 7:3 or 6:4 Chinese-to-English ratio.
3. Post-Training Alignment: Two-Stage Synergy of SFT and DPO
Pre-training gives a model language generation ability, but making it “obedient, reliable, and useful” requires post-training. The first-generation model combined Supervised Fine-Tuning (SFT) with Direct Preference Optimization (DPO).
3.1 SFT: Teaching the Model to Follow Instructions
The SFT stage uses human-annotated, high-quality instruction-response pairs for supervised learning. The goal is to teach the model to understand user intent and respond in the expected format. Examples include:
- Explicit instructions: “Explain quantum entanglement in one sentence.”
- Multi-turn dialogue: Requiring the model to maintain coherence across context.
- Complex tasks: Code generation, mathematical reasoning, summarization, and more.
Data quality matters far more than quantity in SFT. A few thousand to tens of thousands of high-quality annotated examples can significantly change a model’s behavioral style. The key is covering diverse instruction types and difficulty levels to avoid overfitting to a specific template.
3.2 DPO: Preference Alignment Without an Explicit Reward Model
Traditional RLHF (Reinforcement Learning from Human Feedback) requires training a reward model and then optimizing the policy with algorithms like PPO—a complex and unstable pipeline. DPO takes a different path: it derives a closed-form solution for the optimal policy directly from preference pairs (preferred vs. rejected responses), bypassing both reward model training and RL sampling.
The core idea of DPO is to update the policy by maximizing the log-likelihood margin between preferred and non-preferred samples. Its loss function simplifies to:
loss = -log σ( β * (log πθ(y_w | x) - log πθ(y_l | x)) )
Here, πθ is the current policy, y_w and y_l are the human-preferred and non-preferred responses, and β is a temperature coefficient. DPO offers stable training, low memory footprint, and results that match PPO in most scenarios.
The first-generation model applies SFT first to establish basic instruction following, then uses DPO to refine the preference distribution so outputs better align with human values. This “teach first, then optimize” pipeline has become the mainstream post-training paradigm in the open-source community.
4. Inference Cost Optimization: From Algorithms to Engineering
For deployment, the 67B model’s GQA design is key to reducing KV cache overhead. Beyond that, several general optimization techniques are worth adopting:
- Quantization: Reducing weights from FP16 to INT8 or INT4. Algorithms such as GPT-Q or AWQ can compress model size to one-quarter with almost no accuracy loss.
- Batching: Dynamic batching merges multiple requests into a single batch during serving, improving GPU utilization.
- Speculative sampling: A small model (e.g., 7B) generates candidate sequences that the large model (67B) verifies in one pass, achieving 2–3x speedups.
- PagedAttention: Manages the KV cache through a virtual-memory-like mechanism, reducing memory fragmentation waste.
Together, these techniques form the foundation of an efficient inference system. For enterprise users, the same model weights can cost several times more or less to serve depending on deployment optimizations. By choosing GQA, the first-generation model reserved ample headroom for downstream deployment optimization at the architecture level itself.
5. Implications for Industry: Positioning and Evolution of Open-Source Base Models
The release of this model series exemplifies the “ecosystem through open source” path. Its key technical moves can be summarized as:
- Replicate proven routes rather than innovate blindly: Building on LLaMA-like architectures prioritizes training stability and community compatibility.
- Data engineering is the deepest moat: The 89.8% deduplication rate shows that data cleaning can deliver more value than architectural tweaks.
- Post-training determines product experience: The SFT + DPO combination achieves solid instruction following and safety at controllable cost.
- Match scale to scenario: The 7B model suits edge inference and rapid deployment, while the 67B model fits high-precision cloud workloads—the two complement each other.
Going forward, base models will evolve toward longer contexts, multimodal fusion, and more efficient MoE designs. But the fundamentals remain unchanged: the coordinated optimization of architecture, data, and alignment will always be the core triangle for improving model capability.
Conclusion
The release of this first-generation open-source LLM marked the transition of general-purpose language model technology from research to large-scale industrial application. Reviewing its architecture choices, data cleaning, post-training alignment, and inference optimization reveals that a successful base model is not the product of a single brilliant algorithm, but the crystallization of a series of pragmatic engineering decisions. For developers and technical teams, understanding these underlying principles matters more than blindly chasing parameter counts. In future model development, only by putting data quality first and rationally balancing compute resources against performance targets can we build AI infrastructure that is truly reliable, efficient, and extensible.
