Architecture and Training Practices of a First-Generation Open-Source Large Language Model

    This article examines the architecture design and training practices of a first-generation general-purpose open-source large language model. It covers model positioning, dense architecture and attention mechanism choices across different parameter scales, pre-training data construction (deduplication, filtering, and mixing), pre-training and post-training workflows, differences between base and chat models, evaluation methodology, production deployment considerations, and directions for future evolution. Readers will gain a practical understanding of how data quality, training stability, and inference efficiency together determine a model's real-world value.

    1. Project Positioning and Background

    A first-generation general-purpose open-source large language model (LLM) typically serves two purposes. First, it validates the complete technical pipeline of a foundation model, from data construction through pre-training to post-training. Second, it establishes the engineering foundation for subsequent models that are larger in scale and more complex in structure. In practice, early-stage models do not necessarily rely on extremely sophisticated network architectures. Performance gains often come from combined improvements in data quality, training stability, inference efficiency, and post-training methods.

    Such models are usually released in two forms: a base model and a chat model. The base model is better suited for continued pre-training, domain adaptation, and downstream task development. The chat model builds on the base model with instruction understanding, dialogue organization, and preference alignment capabilities, making it suitable for question answering, content generation, summarization, and coding assistance. Offering both versions addresses researchers’ needs for further development as well as end users’ needs for direct use.

    Early development typically starts by replicating a proven dense language model pipeline. The value of this approach is not merely copying an existing solution, but first establishing reliable baselines for training, evaluation, and deployment, and then optimizing around data quality, attention structure, and post-training strategy. For a model development team, this is a low-risk, highly verifiable engineering path.

    2. Model Scale and Overall Architecture

    A first-generation model family usually includes a small-scale and a large-scale version, for example at the level of several billion and tens of billions of parameters. These versions differ not only in parameter count; they also adopt different designs in attention mechanisms, memory footprint, parallelism strategies, and inference cost.

    The model body uses a dense architecture: every input token participates in the same feed-forward network and attention computation as it passes through the layers. Compared with sparsely activated structures, dense architectures are more straightforward to implement and train, benefit from a mature engineering ecosystem, and are easier to distribute and reproduce. The downside is clear: as parameter count and context length grow, compute and memory requirements rise rapidly, so optimization is needed at both the model structure and inference system levels.

    For attention, the small-scale model typically uses multi-head attention (MHA), which allows different heads to focus on semantics, syntax, position, and contextual relationships—a core component of modern language models. The large-scale model can adopt grouped-query attention (GQA), where multiple query heads share a smaller set of key and value heads, reducing the size of the key-value cache. This preserves strong expressiveness while lowering memory usage and memory bandwidth pressure during long-text generation.

    Note that GQA mainly improves inference-stage efficiency; it does not reduce computation proportionally in every phase. Its benefits depend on batch size, context length, hardware bandwidth, and the inference framework implementation. In real deployments, it should be evaluated together with quantization, batching, cache management, and parallelism strategies.

    3. Building the Pre-training Dataset

    The capability ceiling of an LLM is closely tied to training data quality. A first-generation model is typically pre-trained on a large-scale bilingual (Chinese and English) corpus at the trillion-token scale. More important than simply increasing data volume is establishing a stable data governance pipeline that prevents duplicates, noise, and low-quality content from flooding the training set.

    A typical data processing pipeline consists of three stages: deduplication, filtering, and shuffling.

    3.1 Deduplication

    Web corpora contain large amounts of reposted, mirrored, templated pages and repeated passages. Without deduplication, the model may over-optimize on repeated samples, reducing effective knowledge density while increasing training cost. Deduplication can be performed at the document, paragraph, and short-span levels.

    Document-level deduplication detects identical or highly similar pages; paragraph-level deduplication removes content repeated across documents; local-span deduplication identifies news templates, disclaimers, and bulk-generated text. A high-quality deduplication pipeline should also avoid over-deletion: different versions of articles on the same topic are not necessarily equivalent, and common terminology in technical documentation should not be mistakenly flagged as duplicate content.

    3.2 Content Filtering

    Filtering removes obvious spam, garbled text, ad-stacked pages, overly short texts, and malformed content. For mixed Chinese-English data, language identification is also needed to control the proportion and quality of each language.

    Filtering rules should not be overly aggressive. Excessive filtering may mistakenly remove colloquial expressions, code, mathematical text, and specialized domain material, weakening the model’s adaptability to real tasks. In practice, systems typically combine rule-based filtering, quality scoring, and sampled human review into a multi-layer quality control mechanism.

    3.3 Shuffling and Data Mixture

    Shuffling reduces the influence of sample ordering on training and prevents local overfitting caused by long runs of a single data type. For bilingual data, sampling ratios must be designed according to target users, task coverage, and resource quality.

    A sound data mixture considers not only language proportions but also encyclopedic knowledge, technical material, literary text, Q&A content, code, and structured information. Each category serves a different function: knowledge data improves factual coverage, technical data strengthens professional expression, Q&A data improves instruction understanding, and high-quality long text helps build coherent long-context modeling ability.

    4. Pre-training and Post-training Workflow

    The goal of pre-training is to teach the model vocabulary, syntax, semantics, factual associations, and long-range dependencies. Training typically uses an autoregressive objective—predicting the next token given the preceding context. By continuously reducing prediction loss, the model gradually develops general language modeling capability.

    Large-scale pre-training requires close attention to the following issues:

    • Whether the learning rate schedule (warmup and decay) is stable;
    • Whether samples of different lengths are sampled appropriately;
    • Whether mixed-precision training encounters numerical overflow;
    • Whether gradient synchronization in distributed training is stable;
    • Whether checkpoint saving and recovery mechanisms are reliable;
    • Whether the training data contains leakage, duplication, or abnormal clustering.

    After the base model completes pre-training, post-training makes it more suitable for human interaction. Supervised fine-tuning (SFT) typically uses human-curated or automatically filtered instruction-response data to teach the model task formats, answer structures, and basic behavioral norms. Compared with continued pre-training, SFT uses a much smaller dataset but has a significant impact on output style.

    On top of SFT, preference optimization further adjusts model outputs toward quality, safety, accuracy, and helpfulness. Preference data generally consists of multiple candidate responses with relative rankings; training reinforces high-quality responses and suppresses low-quality ones, making the model more inclined to produce clear, complete, instruction-following content.

    However, post-training cannot compensate for all deficiencies in base data and pre-training. If the base model has limited knowledge coverage, weak reasoning ability, or an imbalanced language distribution, adding more instruction data often only improves surface-level expression. Pre-training quality and post-training strategy should therefore be treated as interdependent parts of a whole.

    5. Differences Between Base and Chat Models

    A base model mainly learns “how to continue text.” It is highly general-purpose but may not reliably follow complex instructions. When a user asks a question directly, the base model may continue the input’s style rather than produce a structured answer.

    A chat model, having undergone instruction tuning and preference optimization, typically offers the following improvements:

    1. It can recognize the intent behind a question and organize an answer;
    2. It more easily follows format, role, and length requirements;
    3. It maintains better coherence across multi-turn context;
    4. It reduces irrelevant content and repetitive expression;
    5. It behaves more consistently in refusals, risk warnings, and expressions of uncertainty.

    In enterprise applications, base models are suited to domain-specific continued training, retrieval-augmented generation, and customized development, while chat models are better for direct integration into Q&A assistants, knowledge services, content moderation, and office automation systems. The choice depends on controllability requirements, development cost, and application goals.

    6. Evaluation Framework and Performance Analysis

    Model evaluation should not rely on a single score. It should cover language understanding, knowledge Q&A, mathematical reasoning, code generation, long-text processing, and dialogue quality. For a bilingual Chinese-English model, comprehension, generation, and instruction-following should be assessed separately in both languages.

    Evaluation should follow these principles:

    • Distinguish base models from chat models to ensure comparable results;
    • Control prompts, sampling parameters, and context length;
    • Separate public test sets from internal test sets;
    • Track average scores as well as extreme errors and stability;
    • Use human review to complement automatic metrics;
    • Prevent overlap between training and test data from inflating results.

    If an early-stage model shows clear improvements over models of the same or similar scale on Chinese and English tasks, it usually indicates highly effective data governance and training strategy. But evaluation advantages do not mean superiority in every scenario. Real-world selection must also consider inference speed, memory requirements, deployment complexity, output stability, and adaptability to business data.

    7. Key Considerations for Production Deployment

    In production, model quality is only part of the selection criteria. Deployment teams must also evaluate weight loading time, per-request latency, concurrency capacity, context length, and memory usage. Quantization can reduce resource consumption for large models, but it may affect precision, long-context capability, and performance on certain tasks, so targeted validation is necessary.

    GQA reduces key-value cache pressure, making it especially suitable for long-context and high-concurrency scenarios. However, with very long inputs, the cache can still become the dominant resource cost. Engineering strategies such as request batching, prefix caching, continuous (dynamic) batching, and context truncation can improve overall throughput.

    Production systems should also include logging, monitoring, and alerting, continuously recording request latency, error rates, output length, resource utilization, and the proportion of abnormal responses. For knowledge Q&A applications, retrieval-augmented generation, source attribution, and human review workflows are recommended to reduce the risk of outdated or inaccurate outputs.

    8. Technical Value and Future Evolution

    The core value of a first-generation general-purpose open-source LLM lies not only in releasing models of several parameter scales, but in establishing a reusable development methodology: start from a mature dense architecture, build on large-scale high-quality data, improve interaction through supervised fine-tuning and preference optimization, and reduce deployment cost through attention structure optimization.

    This technical route points the way for subsequent model evolution. Future improvements will typically focus on higher-quality data governance, longer context modeling, stronger reasoning, lower inference cost, and multimodal expansion. Regardless of how model scale changes, data quality, training stability, evaluation fairness, and engineering deployability remain the key factors determining a model’s practical value.