Building General-Purpose LLMs: Architecture Choices, Domestic Accelerator Adaptation, and Agent Deployment
A practical guide to developing and deploying large language models, covering Decoder-only architecture selection, adapting training pipelines to domestic accelerators through a unified abstraction layer, choosing between 9B and 32B open-source models, and deploying LLM agents safely in production.
Building General-Purpose LLMs: From Architecture Selection to Accelerator Adaptation
Natural language processing (NLP) has undergone a paradigm shift on the road toward artificial general intelligence (AGI). Early teams relied mainly on knowledge graphs and rule-based systems for language understanding. These methods offered strong interpretability in specific vertical domains, but knowledge acquisition was costly, generalization was weak, and they struggled with open-domain conversations. With the rise of pre-trained language models, the research focus shifted to large-scale unsupervised learning.
If you are planning to develop or deploy a large language model, this article addresses three key questions: how to choose the underlying architecture, how to adapt to domestic (locally sourced) compute hardware, and how to land model scaling and agent solutions in production.
1. From Knowledge Graphs to LLMs: Technical Evolution and Architecture Selection
Most mainstream large language models today use the Transformer architecture with a Decoder-only design. This architecture generates text autoregressively, token by token, and performs strongly on in-context learning and logical reasoning. Decoder-only is one mainstream route, but Encoder-Decoder and hybrid architectures remain suitable for translation, summarization, and other tasks with well-defined input-output structures. Choose based on the task at hand rather than defaulting to a particular structure.
At the algorithm level, engineering teams should pay close attention to positional encoding, attention mechanisms, and activation functions. For long-context scenarios, techniques such as Rotary Position Embedding (RoPE) and ALiBi improve a model’s ability to handle context windows beyond the training length. Model capability gains depend primarily on three factors: compute, algorithms, and data. From early ten-billion-parameter models to today’s hundred-billion-parameter foundation models, how well these three elements work together determines the magnitude of the capability leap.
2. Adapting to Domestic Accelerators: Build the Abstraction Layer First
Over-reliance on a single compute ecosystem creates supply chain risk. Many teams therefore develop their own stacks from the pre-training framework down to low-level operators and gradually adapt them to domestic hardware. The core idea behind hardware adaptation is decoupling: separate the computation graph of the upper framework from the underlying hardware.
1. Build a Unified Abstraction Layer
Domestic compute architectures, such as supercomputing platforms and DCUs (Data Center Units — see vendor documentation for exact definitions and capabilities), differ from general-purpose GPUs in instruction sets and low-level operator libraries. If upper-layer code is tightly bound to one hardware type, migration costs become very high. A unified abstraction layer isolates device selection and operator implementation, so the upper layers only need to call a common interface.
The following code is for illustration only and cannot be run as-is. Before actual use, verify dependency versions, numerical precision alignment, and fallback strategies.
# Illustrative only: design sketch for heterogeneous compute backend adaptation, not runnableclass ComputeBackend:def __init__(self, device_type):self.device = device_typedef matmul(self, tensor_a, tensor_b):if self.device == "npu":return self._npu_custom_matmul(tensor_a, tensor_b)elif self.device == "dcu":return self._dcu_optimized_matmul(tensor_a, tensor_b)else:# Fall back to the generic implementation to guarantee correctnessreturn self._fallback_matmul(tensor_a, tensor_b)def _npu_custom_matmul(self, a, b):# Invoke the vendor's high-performance matrix multiplication operatorraise NotImplementedError
2. Post-Adaptation Checklist
After adaptation work is complete, verify each item below so the system doesn’t merely “run” in a demo scenario:
- Operator coverage: List every operator the model uses, and mark which ones have hardware implementations and which still fall back to generic paths.
- Precision alignment: With identical inputs, compare output errors between the domestic hardware and a reference hardware platform, and document acceptable thresholds.
- Version records: Pin the versions of drivers, compilers, communication libraries, and frameworks, and record them in deployment documentation.
- Fallback strategy: Define what happens when an operator fails, such as degrading to the generic implementation while logging the event.
- Performance baseline: Record throughput, latency, and memory usage as benchmarks for future optimization.
3. Communication Challenges in Distributed Training
Training hundred-billion-parameter models on multi-node clusters typically combines data parallelism, tensor parallelism, and pipeline parallelism — so-called 3D parallelism. The right combination depends on model size, cluster topology, and memory budget; there is no universal fixed configuration.
The topology of domestic interconnects may differ from general-purpose GPU clusters. Teams often need to redesign communication primitives to reduce network congestion caused by cross-node All-Reduce and All-Gather operations. Memory fragmentation management also needs hardware-specific tuning. These parameters should be determined through real measurements rather than copying values from other platforms.
3. Choosing Open-Source Models: 9B vs. 32B
Open source has been a major driver of LLM adoption. Many organizations release model families in multiple sizes, such as 32B (32 billion parameters) and 9B (9 billion parameters). Start by checking the license. Some model families use permissive licenses such as MIT that allow commercial use, but the specific terms are defined by the model card and license file — do not assume all open-source models share the same license.
A rough guide to size selection:
- 9B-class models suit local deployment on edge nodes or consumer-grade GPUs. With INT8 or INT4 quantization, they can deliver responsive natural language interaction at low cost, making them a good fit for individual developers.
- 32B-class models offer stronger reasoning and code generation, and work well as the foundation for enterprise private deployments supporting knowledge-base Q&A, document analysis, and other compute-intensive scenarios.
Also evaluate the precision loss introduced by quantization. Quantization reduces memory usage, but on complex reasoning tasks the accuracy drop can be significant — benchmark with your own business data before committing.
Multimodal Extension
Text-only models cannot fully understand the physical world. Vision-language models (VLMs) map image features into the language model’s feature space through a vision encoder, enabling joint image-text understanding. They can describe image content, perform simple reasoning, and help detect anomalies. However, such models still have limitations in fine-grained recognition, and critical judgments require human review.
4. Deploying LLM Agents: What to Watch For
The value of large language models shows up most clearly in industrial applications. Compared with chat-only models, agents can proactively execute tasks. The most common implementation today is the ReAct (Reasoning and Acting) framework: the LLM handles intent understanding, task decomposition, and step planning, while external tools — APIs, database retrieval, code interpreters — execute concrete actions. The system completes complex workflows through iterative “think, act, observe” loops, such as automatically writing and running data analysis code.
Three points deserve attention in production. First, tool permissions should follow the principle of least privilege; write operations and anything involving money require human confirmation. Second, log the inputs and outputs of every step to make debugging feasible. Third, set upper limits on loop counts and timeouts to prevent agents from getting stuck in ineffective loops.
Boundaries of Industry Applications
- Industrial manufacturing: Combined with industry knowledge bases, LLMs can help generate equipment troubleshooting guides and, using multimodal capabilities, analyze equipment operation images to support predictive maintenance.
- Finance and public sector: In strictly data-isolated environments, privately deployed models can assist with intelligent approval workflows, contract comparison, and compliance review, improving office efficiency.
- Biopharmaceuticals: Some organizations are scaling up model parameters to build vertical models for protein and enzyme design, aiming to understand the “grammar” of biomolecular sequences and assist drug discovery. This direction is still in early exploration, and results must be evaluated by domain experts.
Across all these scenarios, fault diagnosis, compliance conclusions, and medical-related outputs require expert review. Model output serves as a reference and cannot replace formal decisions in safety-critical or medical domains.
LLMs also have practical value in accessibility. Combining visual recognition with natural language generation, systems can render virtual avatars that convert speech or text into sign language in real time, helping reduce communication barriers for people with hearing impairments.
5. Conclusion
From knowledge graphs to large language models, underlying technical innovation forms the foundation of R&D work. Adapting to domestic accelerators, selecting open-source models, and deploying agents are the three critical steps toward production. Low-level operator optimization, co-design with chip vendors, and end-to-end multimodal integration are directions worth continued investment. These efforts must advance alongside ecosystem building and real-world deployment to form a complete value chain. Enterprises and developers should choose an LLM integration path that fits their own business needs.
