Open-Source LLM V1 Architecture: Dense Baseline Reproduction and Data Engineering Practices
This article reviews the engineering approach behind the first generation of an open-source general-purpose LLM, released in January 2024 with 7B and 67B parameter sizes in both base and chat variants. It covers the rationale for reproducing a proven dense decoder architecture, the attention design differences between MHA and GQA, a three-stage data pipeline built on 2 trillion bilingual tokens, two-stage alignment with SFT and DPO, bilingual evaluation methodology, and open-source operating practices. Readers will find a reusable checklist for building a reproducible model development path.
1. Introduction: Why the First Generation Deserves Its Own Review
In the evolution of general-purpose LLMs, the first generation is often overshadowed by later releases, yet it sets the direction for the entire technology stack. As the first release in an open-source series, this general language model was published in January 2024, with its technical report made public in early January of the same year. It offered two parameter sizes, 7B and 67B, in both base and chat forms. Its positioning was not “the strongest” but “the foundation”: validating that the technical route was viable, building up data engineering capability, and establishing a starting point for open-source and open-platform operations.
From an engineering perspective, a project like this has three core questions. First, can a proven dense architecture be reproduced at a controllable cost? Second, can higher-quality training data deliver a relative advantage at the same parameter scale? Third, can a reusable post-training pipeline turn a base model that “continues text” into a usable product that “holds a conversation”? This article follows those three threads.
2. R&D Background: A Pragmatic Path from Reproduction to Improvement
The initial development took a “reproduce first, then optimize” route. Reproduction here did not mean copying a structure blindly. It meant adopting the industry-recognized dense decoder architecture as a reliable baseline, shifting uncertainty away from “whether the structure works” toward “whether the data and training details are right.” The value of this strategy is controlled risk: the architecture already had extensive public validation, so the team could concentrate engineering resources on the biggest variable, data.
On that basis, the team aimed to pull ahead by building a better training set. This was an important judgment: once model structures converge, corpus quality, deduplication thoroughness, Chinese-English ratio, and cleaning rules become the main sources of performance differences. Several researchers were also involved in the language model series early on and went on to lead vision-language projects, which shows the first generation served the dual incubation role of a language foundation and a multimodal extension.
3. Architecture: Dense Baseline with Scale-Dependent Attention Design
The first generation kept the mature dense decoder structure but applied scale-dependent differentiation in the attention mechanism:
- The 7B model uses multi-head attention (MHA). The structure is intuitive and simple to implement, with better cost-efficiency for training and inference at small scale.
- The 67B model switches to grouped-query attention (GQA), letting multiple query heads share one set of key-value heads. This compresses the memory footprint of the key-value cache and lowers the cost of long-context and high-concurrency inference.
The tradeoff reflects clear engineering logic. MHA’s key-value cache grows linearly with the number of heads, so memory and bandwidth pressure becomes more visible as parameter count and context length increase. GQA trades a very small amount of expressive power for inference-side scalability. The conceptual structural difference is shown below (illustrative only, not a specific implementation):
# Conceptual illustration: difference in KV head count between MHA and GQAn_query_heads = 32 # number of query headsn_kv_heads_mha = 32 # MHA: KV heads map one-to-one to query headsn_kv_heads_gqa = 8 # GQA: multiple query heads share one KV headkv_cache_mha = layers * n_kv_heads_mha * head_dim * seq_lenkv_cache_gqa = layers * n_kv_heads_gqa * head_dim * seq_len# kv_cache_gqa is significantly smaller than kv_cache_mha, friendlier for long context and batched inference
Engineering note: GQA is not a free lunch. Too few groups weaken expressive power; too many degrade it toward MHA and reduce the memory savings. In practice, the group count should be balanced against the target context length, concurrency, and memory budget, and validated with ablations on small models first.
4. Data Engineering: A Three-Stage Pipeline Sets the Capability Ceiling
The original work reports a pretraining corpus of 2 trillion tokens covering both Chinese and English, built through three stages: deduplication, filtering, and shuffling. The deduplication stage removed 89.8% of duplicate documents. That number is worth unpacking: a near-90% duplication rate indicates that template pages, mirror sites, protocol headers, and copyright notices are extremely common in unprocessed web-scale data. Without thorough deduplication, the model wastes capacity memorizing repeated fragments and the risk of data contamination and evaluation leakage rises sharply.
A practical three-stage pipeline typically includes:
- Deduplication: exact document-level deduplication (hash fingerprints) first, then near-duplicate paragraph-level deduplication (for example, similarity bucketing based on MinHash/SimHash), and finally cleanup of template residue across documents.
- Filtering: rule-based filtering (length, symbol ratio, language-identification confidence) plus quality-score filtering (perplexity or classifier scores) plus safety filtering (harmful content, private information).
- Shuffling: globally shuffling document order to avoid late-training bias from consecutive same-source data, while keeping the Chinese-English ratio stable throughout training.
# Conceptual illustration: three-stage data pipelinedocs = load_raw_corpus()docs = exact_dedup(docs) # exact deduplicationdocs = near_dedup(docs, threshold=0.8) # near deduplicationdocs = rule_filter(docs, min_len=64) # rule-based filteringdocs = quality_filter(docs, score=0.5) # quality filteringdocs = shuffle(docs, seed=42) # global shuffling
Note that the deduplication threshold and the quality-score threshold are strongly coupled. Loose deduplication leaves noise behind; overly strict deduplication may wrongly remove high-quality long documents. It is advisable to keep a sampling audit step, manually spot-checking filtered samples to avoid rule drift.
5. Post-Training: Two-Stage Alignment with SFT and DPO
A base model only performs next-token prediction. Turning it into a usable chat model requires two alignment stages:
- Supervised fine-tuning (SFT): high-quality instruction-response pairs teach the model to follow instructions and maintain format and tone.
- Direct preference optimization (DPO): paired preference data of “better response / worse response” directly optimizes the preference probability ratio, removing the training and inference overhead of a separate reward model. The pipeline is shorter and more stable.
The practical focus is data structure and mixture. The SFT stage should cover multiple task types (question answering, summarization, code, translation, role play) while capping the share of any single task, avoiding lopsided capability. In the DPO stage, preference pairs must genuinely reflect human preference differences; excessive noise degrades alignment. A minimal DPO training loop looks like this:
for batch in preference_loader: # batch contains prompt, chosen, rejectedloss = dpo_loss(model, batch, beta=0.1)loss.backward()optimizer.step()optimizer.zero_grad()# beta controls deviation from the reference model; too large is overly conservative, too small drifts
6. Evaluation: How to Verify a Bilingual Relative Advantage
For evaluation, the first generation used Chinese and English benchmarks for comparison, and the results showed the 67B version holding a clear advantage over other 70B-class baselines of similar scale on both Chinese and English evaluations. The methodological value here exceeds the conclusion itself. First, comparison at the same parameter scale strips out the scale dividend and highlights the contribution of data quality. Second, dual-track Chinese-English evaluation avoids single-language overfitting and is closer to real business scenarios. Third, base and chat models should be evaluated separately: the former for language modeling and knowledge coverage, the latter for instruction following and safety.
A recommended evaluation matrix includes language modeling perplexity, commonsense and academic knowledge, code and math reasoning, long-context understanding, multi-turn dialogue consistency, and safety-compliance red-teaming. Evaluation sets must be checked for leakage against the training corpus, otherwise an apparent advantage may come from memorization rather than generalization.
7. Operating Model: Open Source as the Starting Point of an Ecosystem
The first generation was released as open source, becoming the starting point for the open-source ecosystem and open-platform strategy. The benefits of open source run both ways: external developers can reproduce, fine-tune, and redistribute, forming a feedback loop, while the internal team can discover data gaps and alignment weaknesses in real usage. The accompanying engineering recommendations are to define the model license and commercial boundaries clearly, provide a clear model card and evaluation report, document reproducible training and inference configurations, and offer unified invocation and management capabilities on the open platform (such as model hosting, elastic compute, logging services, and monitoring and alerting, which are common cloud capabilities), lowering the barrier to use.
8. A Reusable Practice Checklist
- Architecture: use MHA at small scale to reduce complexity; switch to GQA at large scale to control the key-value cache and inference cost.
- Data: build deduplication in three layers (exact, near-duplicate, template residue); bake filtering and shuffling into the pipeline and keep an audit.
- Training: reproduce the baseline before tuning; control the Chinese-English ratio and data-order randomness throughout training.
- Alignment: SFT sets the capability boundary, DPO adjusts the preference direction; watch beta and preference data quality.
- Evaluation: same-scale comparison plus dual-track Chinese-English plus leakage detection plus safety red-teaming.
- Delivery: base and chat forms together, with an open-source license, model card, and open-platform hosting capabilities.
9. Conclusion
The significance of the first open-source general LLM does not lie in leading on any single metric. It lies in chaining “architecture reproduction, data engineering, alignment training, and open-source operations” into a replicable, iterable path. Later version iterations all add to this path. For teams preparing to build their own model, the most pragmatic lesson is: make the data pipeline solid before pursuing structural innovation, and validate hypotheses with small-scale ablations before committing large-scale compute.
