Local Private Deployment and Heterogeneous Fine-Tuning of Large Language Models in Public Health

    This article explores the local private deployment and fine-tuning of Large Language Models (LLMs) in the public health sector, addressing the dual challenges of data security and high computing costs. It details an architecture combining general GPUs with dedicated AI accelerators, the use of middleware for heterogeneous scheduling, and compliance measures for physical network isolation. Furthermore, it demonstrates how Parameter-Efficient Fine-Tuning (PEFT) techniques like QLoRA, combined with memory optimization strategies, enable the fine-tuning of multi-billion-parameter models in low-computing-power environments.

    Local Private Deployment and Heterogeneous Fine-Tuning of Large Language Models in Public Health

    1. Introduction: The Dual Dilemma of AI Transformation in Public Health

    As artificial intelligence continues to advance in healthcare and public health, there is an increasing demand to introduce Large Language Models (LLMs) to assist with epidemiological investigations, outbreak trend forecasting, medical literature mining, and public health knowledge Q&A. However, public health agencies, such as Centers for Disease Control and Prevention (CDC), face two core contradictions when practically deploying LLMs: data security barriers and high computing costs.

    On one hand, public health systems have accumulated decades of sensitive data covering citizens’ full life cycles. Under strict data security and personal information protection regulations, this highly private data is prohibited from being uploaded to public clouds or transmitted across borders; it must remain in a closed local loop. This directly rules out the lightweight integration path of relying on public cloud LLM APIs. On the other hand, current mainstream open-source LLMs often have parameter scales ranging from 10 billion to over 70 billion. Traditional full-parameter fine-tuning typically requires 8 to 16 high-end general GPUs (such as the 80GB VRAM versions), pushing hardware investments into the hundreds of thousands of dollars. For the vast majority of grassroots public health agencies, such exorbitant computing infrastructure costs are unaffordable.

    In this context, exploring a hybrid deployment and fine-tuning architecture that meets the compliance requirements of physical intranet isolation while significantly reducing hardware costs has become a critical topic in public health informatization.

    2. Heterogeneous Mixed Computing Power Architecture Design

    To break the high-cost barrier of general GPUs, the industry is exploring heterogeneous computing architectures. The core idea of this architecture is to introduce dedicated AI accelerator cards to work collaboratively with general GPUs, supported by underlying middleware technology, to achieve optimal allocation of computing resources.

    1. Hardware Layer: Collaboration Between General and Dedicated Processors

    In a typical mixed computing deployment, a combination of “a few general GPUs + dedicated AI accelerator cards” can be adopted (for example, 2 general GPUs paired with 2 AI accelerators). General GPUs, leveraging their mature ecosystems (like CUDA) and high-bandwidth memory, handle complex control flows in model inference, KV Cache management, and some flexible tensor operations. Dedicated AI accelerators, relying on computing units customized for matrix operations (such as NPU/TPU architectures), undertake large-scale, compute-intensive General Matrix Multiply (GEMM) tasks.

    2. Middleware Layer: Heterogeneous Adaptation and Scheduling

    Directly invoking heterogeneous hardware poses significant software development challenges. Therefore, middleware technology is introduced as a bridge between the hardware and the upper-layer model frameworks. The role of the middleware is mainly reflected in two aspects:

    • Shielding Hardware Differences: By providing a unified operator interface specification, it abstracts the drivers and instruction sets of different chip vendors at the bottom layer, allowing mainstream deep learning frameworks (like PyTorch) to run in heterogeneous environments without heavily modifying the source code.
    • Dynamic Computing Power Scheduling: The middleware monitors the load and VRAM utilization of each computing node in real-time. Through fine-grained, stream-level or operator-level scheduling strategies, it dynamically maps different nodes in the computational graph to the most suitable hardware, maximizing the overall throughput of the heterogeneous cluster.

    3. Local Private Deployment and Compliance System

    Deploying LLM services within the intranet of a public health agency is not just a physical relocation; it is the implementation of a complete data security governance system.

    1. Intranet Physical Isolation and Network Topology

    The deployment adopts a strict physical isolation design. Model training and inference servers are deployed in an isolated subnet within the core data area, physically disconnected from the external internet and external government networks. Through internal core switches, only specific business system terminals are allowed to access the LLM API interfaces via intranet IPs.

    2. Data Flow and Privacy Protection

    In the data processing pipeline, the principle of “data is usable but not visible” is strictly followed. Original database tables, such as epidemiological survey data and infectious disease reporting data, enter the desensitization module via the intranet data bus for hashing of strong identifiers like names and ID numbers. Intermediate logs and gradient information generated during model fine-tuning and inference are stored in local encrypted storage arrays, prohibiting any form of external transmission, ensuring full lifecycle data compliance.

    4. LLM Fine-Tuning Practices for Low-Computing-Power Environments

    Fine-tuning a multi-billion-parameter LLM for the public health domain under restricted computing resources (e.g., only 4 heterogeneous accelerator cards) requires abandoning the full-parameter fine-tuning route in favor of Parameter-Efficient Fine-Tuning (PEFT) techniques.

    1. PEFT Technology and QLoRA Application

    PEFT drastically reduces VRAM requirements by freezing the majority of the pre-trained model’s weights and only updating a minimal number of additional parameters. Among these, QLoRA (Quantized Low-Rank Adaptation) is currently one of the most effective strategies. It quantizes pre-trained weights to 4-bit integers for storage, dequantizes them to BF16 during forward and backward propagation, and injects low-rank adapters into each layer of the Transformer.

    Below is a typical QLoRA fine-tuning configuration example (based on general PEFT library concepts):

    1. from peft import LoraConfig, get_peft_model, prepare_model_for_kbit_training
    2. # 1. Prepare the model: enable gradient checkpointing and support quantized training
    3. model = prepare_model_for_kbit_training(model)
    4. # 2. Configure LoRA parameters
    5. lora_config = LoraConfig(
    6. r=16, # Rank of the LoRA matrices
    7. lora_alpha=32,
    8. target_modules=["q_proj", "k_proj", "v_proj", "o_proj"], # Inject into attention mechanism layers
    9. lora_dropout=0.05,
    10. bias="none",
    11. task_type="CAUSAL_LM"
    12. )
    13. # 3. Wrap the model
    14. model = get_peft_model(model, lora_config)

    2. Mixed Precision and Memory Optimization

    In a heterogeneous hardware environment, combined with the state sharding technology in the ZeRO (Zero Redundancy Optimizer) strategy, optimizer states and gradients are partitioned across different accelerator cards. Simultaneously, gradient checkpointing is used to trade time for space by discarding some intermediate activations during the forward pass and recomputing them during the backward pass. This combination makes it possible to fine-tune models at the 13 billion or even 70 billion parameter level in a 4-card mixed computing environment.

    5. Cost-Benefit Analysis and Industry Implications

    Compared to the traditional approach of using 8 to 16 high-end general GPUs, the solution utilizing 2 general GPUs paired with 2 dedicated AI accelerators, with heterogeneous scheduling at the middleware layer, achieves a significant reduction in hardware procurement costs. This reduction allows grassroots public health agencies at the regional and county levels to build their own LLM computing infrastructure.

    Furthermore, in terms of application value, domain-specific LLMs fine-tuned on local epidemiological data far exceed general models in accuracy for professional terminology understanding and infectious disease rule interpretation. They can not only assist grassroots public health personnel in quickly generating draft epidemiological reports but also serve as intelligent Q&A engines for internal knowledge bases, substantially improving the response efficiency of public health emergency handling.

    6. Conclusion

    In the public health sector, where data security red lines cannot be crossed, the deployment of LLMs cannot simply copy the public cloud models of the internet industry. Local private deployment and PEFT fine-tuning based on a heterogeneous mixed computing architecture provide a feasible path for high-sensitivity data environments, balancing compliance, performance, and cost. As the ecosystem for domestic AI accelerator cards continues to improve and middleware adaptation technologies mature, more vertical industries will be able to embrace LLM technology at a lower threshold in the future, accelerating the industry’s intelligent evolution.