Local Private Deployment of Large Language Models in a Public Health Agency: A Practical Guide

    This article walks through a practical blueprint for deploying large language models entirely inside a public health agency's internal network. It covers the dual constraints of data compliance and hardware cost, a five-layer training-and-inference architecture, heterogeneous accelerator selection, parameter-efficient fine-tuning, retrieval augmentation and knowledge governance, security controls, evaluation and operations, and a phased rollout path. Readers will learn how to build stable local LLM capability on limited hardware while keeping model weights and data within the intranet.

    1. Background: Data Compliance and Compute Cost Constraints

    Public health agencies applying large language models usually face two hard constraints at the same time. The first is the data boundary: disease surveillance, immunization planning, and laboratory test results contain large amounts of personal health information. Under data security and personal information protection regulations, this data must not be uploaded to external networks in principle, and cross-border transfer is even less permitted. The second is the cost boundary: mainstream large models range from billions to hundreds of billions of parameters. Full-parameter fine-tuning typically requires eight to sixteen high-end accelerators; once servers, storage, and data center modifications are included, the investment can reach several million yuan, which is difficult for grassroots units to afford.

    Put together, these two constraints point to a clear conclusion: a viable solution must satisfy both “model weights and data stay inside the intranet” and “hardware scale remains controllable.” This also determines that the technical path is not simply “moving a cloud model on-premises,” but making reductions at three levels simultaneously: how compute is supplied, the fine-tuning strategy, and inference resource scheduling.

    2. Overall Architecture: A Layered Design for Unified Training and Inference

    A deployable on-premises architecture is typically divided into five layers, with standard interfaces decoupling each layer for easier replacement and scaling.

    • Hardware layer: general-purpose and specialized accelerators deployed together, with middleware hiding low-level differences and providing a unified device and operator abstraction upward.
    • Platform layer: handles model weight management, image distribution, job orchestration, resource quotas, and tenant isolation, all running inside the intranet.
    • Model layer: a base model plus domain incremental weights plus a retrieval augmentation component, forming a “general capability + domain knowledge” combination.
    • Data layer: structured business databases, unstructured document stores, vector indexes, and de-identified audit logs, stored in partitions by sensitivity level.
    • Application layer: service interfaces for scenarios such as contact-tracing assistance, health education Q&A, first-draft report generation, and knowledge retrieval.

    The key value of unified training and inference is resource reuse. Inference dominates during the day, while idle compute is switched to fine-tuning and batch data processing at night, avoiding a separate purchase of equipment for low-frequency training. The following is illustrative job submission logic:

    1. # Pseudocode: schedule local compute between inference and training jobs by priority
    2. def submit_job(job):
    3. if job.kind == "inference":
    4. return scheduler.run(job, pool="latency_sensitive", timeout_ms=800)
    5. # Training/fine-tuning jobs run during off-peak hours and can be preempted
    6. return scheduler.run(job, pool="batch", preemptible=True, quota=job.gpu_hours)

    3. Compute Selection: Heterogeneous Combinations with Middleware Decoupling

    A single accelerator model often falls short in operator coverage, memory capacity, or supply lead time. A more reliable approach is a hybrid configuration of “a few general-purpose accelerators plus a few specialized accelerators,” with middleware handling operator mapping, memory management, and communication optimization so that upper-layer frameworks do not need to be aware of hardware differences. As an example, a scale of two general-purpose cards plus two specialized cards, combined with quantization and memory optimization, can usually support inference for a medium-sized parameter model and complete parameter-efficient fine-tuning during off-peak periods.

    Four metrics deserve close verification during selection: first, coverage of key operators for the target model and the fallback path; second, whether memory bandwidth and capacity meet long-context requirements; third, how the multi-card interconnect affects tensor parallelism efficiency; fourth, the compatibility matrix of driver and framework versions. Missing any one of them may surface during stress testing as a sharp drop in throughput.

    4. Domain Fine-Tuning: Prioritize Parameter-Efficient over Full-Parameter

    Public health corpora are highly specialized and labeled samples are limited, so full-parameter fine-tuning is both expensive and prone to overfitting. The recommended order is: start with prompt engineering and retrieval augmentation, then consider parameter-efficient fine-tuning, and only then evaluate a full-parameter approach.

    Parameter-efficient fine-tuning updates only a small number of newly added parameters, reducing both training memory usage and corpus requirements at the same time. Multiple tasks can share the same base model and load different incremental weights per task, which makes version rollback easy. An illustrative configuration is shown below:

    1. config = {
    2. "base_model": "local_base_model", # intranet weight path
    3. "method": "lora", # low-rank incremental update
    4. "rank": 16,
    5. "alpha": 32,
    6. "target_modules": ["q_proj", "v_proj"],
    7. "precision": "bf16",
    8. "max_seq_len": 4096,
    9. "epochs": 3,
    10. "learning_rate": 1e-4
    11. }

    On the data side, it is advisable to build three types of samples: knowledge-based Q&A (term explanations, process specifications), summary-type samples (distilling key points from contact-tracing reports), and refusal-type samples (explicitly declining to answer when a request is out of scope or lacks sufficient basis). The third type is often overlooked but has a significant impact on reducing hallucination rates.

    5. Retrieval Augmentation and Knowledge Governance

    Domain knowledge updates quickly, and compressing all of it into weights is not realistic. A more robust combination is “small weights + external knowledge base”: documents are parsed, chunked, and vectorized to build an index; at Q&A time, retrieval happens first and generation second, with sources attached to answers so business staff can verify them. Knowledge governance needs to define a document owner and update cycle for each document, and establish version numbers and expiration flags to prevent outdated specifications from being retrieved.

    6. Security and Compliance Essentials

    • Network isolation: training and inference environments are deployed in the intranet, providing services externally only through a controlled gateway.
    • Data classification: divide zones by sensitivity, and complete de-identification before using training sets.
    • Audit trails: record the accessing entity, time, retrieved snippets, and generated results to support after-the-fact traceability.
    • Output control: apply sensitive-word filtering and interception policies for out-of-scope questions to generated content.

    7. Evaluation and Operations

    Evaluation should cover three categories of metrics: domain capability (term accuracy, key-point recall), safety capability (correct refusal rate, out-of-scope interception rate), and engineering metrics (time to first token, concurrent throughput, peak memory usage). After launch, establish a canary release and regression evaluation mechanism; any prompt or weight change must pass the baseline test set. On the operations side, it is recommended to set monitoring alerts for accelerator temperature, memory usage, and job queue time, and to restrict batch training jobs to off-peak business windows.

    The first phase completes scenario convergence and data inventory, selecting two or three high-frequency, verifiable scenarios. The second phase builds the unified training-and-inference environment and completes quantization validation of the base model. The third phase implements parameter-efficient fine-tuning and retrieval augmentation to form an evaluable baseline. The fourth phase launches canary releases, runs continuous regression, and gradually expands scenarios. Following this path, an agency can obtain stable and usable local LLM capability with limited hardware investment while holding the compliance bottom line that data never leaves the intranet.