Local Private Deployment of a Large Language Model in a Disease Control Center

    This article walks through a practical approach to deploying a large language model (LLM) inside a disease control agency under two hard constraints: strict health data compliance and a very limited hardware budget. It explains a four-layer training-and-inference architecture that trades capacity for card count, how a VRAM expansion middleware maps flash storage into the accelerator address space, and the engineering trade-offs around page size, prefetching, flash endurance and failure domains. It also covers a data-first domain fine-tuning workflow using parameter-efficient fine-tuning, the security and compliance controls that shape the architecture from the start, a three-layer evaluation and operations model, and the known limits of the approach. The result is a reference for building affordable, fully offline LLM infrastructure in data-sensitive public health environments.

    1. Problem Definition: Two Constraints on Public Health LLM Adoption

    As national “AI Plus” initiatives continue to advance, the disease prevention and control system’s demand for large language models has shifted from “optional” to “infrastructure candidate.” In practice, however, deployment runs into two walls: a data compliance wall and a compute cost wall.

    Disease control agencies have accumulated decades of data on infectious disease reporting, vaccination, chronic disease follow-up, laboratory testing, and epidemiological investigations. A large share of these fields fall under citizens’ health privacy. Under data security and personal information protection regulations, together with data classification and grading requirements, such data may not, in principle, be uploaded to public clouds or transferred across borders, and raw records certainly cannot circulate freely as training corpora. This rules out the technical route of calling an external inference API.

    The second wall is VRAM capacity. Mainstream open-source LLMs range from billions to tens of billions of parameters. Full-parameter fine-tuning typically requires 8 to 16 high-end accelerator cards; once servers, storage, and data center modifications are added, the investment can reach several million yuan. For a prefecture-level agency, this is not a question of budget priority but an unaffordable one.

    The core proposition this approach addresses is therefore: complete a usable domain fine-tuning run and a long-term inference service on a single machine with a small number of accelerator cards under full intranet isolation, while pushing the hardware threshold down to a level that grassroots institutions can afford.

    2. Overall Architecture: Unified Training and Inference with a Memory Hierarchy

    The approach uses a layered architecture that unifies training and inference, organized bottom-up into four layers:

    1. Hardware layer: 2 general-purpose GPUs plus 2 AI accelerator cards, forming a heterogeneous compute pool;
    2. VRAM expansion layer: middleware that presents an enterprise flash pool as addressable extended memory for the accelerators;
    3. Model serving layer: responsible for weight loading, KV cache management, batch scheduling, and streaming output;
    4. Application and security layer: retrieval augmentation, business APIs, authentication, access auditing, and log retention.

    The key design idea is trading capacity for card count. The bottleneck in LLM inference and fine-tuning is often not floating-point throughput but the inability to fit parameters and optimizer states. By offloading cold weights and low-frequency parameter shards to the flash tier while keeping hot data in local VRAM, a model scale that originally required 8 or more cards can run within 4 cards.

    An illustrative logic for estimating VRAM tier hit rate:

    1. # Illustrative only: how to compute tiered cache hit rate, not a product-specific API
    2. def layer_hit_rate(access_log, hot_set):
    3. total = len(access_log)
    4. hit = sum(1 for page in access_log if page in hot_set)
    5. return hit / max(total, 1)
    6. # A low hit rate means the hot set is poorly partitioned;
    7. # adjust the range of layers kept in VRAM

    3. How the VRAM Expansion Middleware Works

    The middleware does three things: address mapping, data migration, and consistency guarantees.

    • Address mapping: maps flash ranges into the accelerator’s address space so weights do not need to be rearranged at load time;
    • Data migration: swaps pages in and out between VRAM and flash at page granularity, with prefetching to reduce waiting on the critical path;
    • Consistency guarantees: parameters are updated repeatedly during fine-tuning, so the middleware must preserve write-back ordering and checkpoint integrity to avoid corrupted weights after an interruption.

    Three engineering points deserve attention. First, page size and prefetch depth: pages that are too small cause I/O counts to spike, while pages that are too large waste bandwidth. Second, flash endurance: write amplification is pronounced during fine-tuning, so write coalescing and wear leveling should be enabled. Third, failure domains: the flash pool should be provisioned with redundancy, otherwise a single disk failure makes the entire inference service unavailable.

    4. Domain Fine-Tuning: From Data Engineering to Parameter-Efficient Training

    Public health corpora have distinct characteristics: dense terminology, strict numbers and units, and conclusions that must be traceable. Data engineering takes priority over algorithm selection.

    Recommended data construction workflow:

    1. Export de-identified text from the internal business databases, removing names, ID numbers, detailed addresses, and phone numbers;
    2. Apply date offsets that preserve seasonal patterns while cutting individual identifiability;
    3. Organize samples into three categories: question-answer pairs, structured reports, and guideline provisions;
    4. Strictly separate the training and evaluation sets; the evaluation set must include the agency’s own gold-standard Q&A.

    Training strategy: prefer parameter-efficient fine-tuning, updating only low-rank adaptation matrices and selected normalization layers while the backbone weights stay frozen. This yields three benefits: the number of trainable parameters drops by one to two orders of magnitude, and optimizer state VRAM usage falls sharply; checkpoints become smaller, keeping flash write amplification under control; and multiple tasks can maintain separate adapters that are hot-swapped on demand.

    1. # Illustrative: freeze the backbone and train only the low-rank adaptation branch
    2. for name, param in model.named_parameters():
    3. param.requires_grad = "lora" in name
    4. optimizer = build_optimizer(filter(lambda p: p.requires_grad, model.parameters()))

    For hyperparameters, the learning rate is typically on the order of 1e-4, paired with cosine decay and gradient accumulation; the effective batch size is scaled up through accumulation steps rather than by adding VRAM pressure to fill a batch; and gradient checkpointing trades compute for memory, making it a mandatory switch for few-card fine-tuning.

    5. Security and Compliance Design

    Compliance is not documentation assembled after deployment; it is an architectural constraint:

    • Network isolation: the full stack sits inside the agency’s intranet, physically or logically isolated from the internet, exchanging data only through an approval gateway;
    • Data stays in domain: training, validation, and inference all run locally, and caches and temporary files written to flash by the middleware are brought into encryption scope;
    • Identity and permissions: role-based access control, with authorization by department and project, and secondary approval for sensitive queries;
    • Audit trail: record the questioner, time, retrieved document IDs, and model version so conclusions remain traceable;
    • Output guardrails: answers involving diagnostic suggestions, drug dosages, or the wording of epidemic notifications must carry cited sources and a “requires review by a qualified professional” notice.

    6. Evaluation and Operations

    Evaluation should cover three layers: no regression in general capability, accurate domain knowledge, and reliable safety refusals. Build an agency-owned test set of no fewer than several hundred items, covering infectious disease reporting standards, immunization schedules, disinfection protocols, and the interpretation of statistical indicators, and track hallucination rate and refusal accuracy separately.

    For operations, the inference service should expose metrics such as latency, throughput, VRAM usage, and flash queue depth, with threshold-based alerting; model versions and adapter versions should be managed as bound pairs, with rollback targeting minute-level recovery; and disaster recovery drills should be run periodically to validate degradation strategies under flash pool failure and single-card loss.

    7. Benefits and Boundaries

    The value of this path is turning LLM capability from “optional in the cloud” into “affordable on the intranet.” Compressing the hardware footprint to 4 cards demonstrates the feasibility of building compute infrastructure in data-sensitive environments and creates conditions for replication across multiple prefecture-level agencies.

    The boundaries must also be acknowledged: swapping pages in and out from flash raises time-to-first-token, and the gains are limited for very long context scenarios; parameter-efficient fine-tuning underperforms full-parameter training on tasks that require substantially changing model behavior. Future optimization directions include finer-grained prefetching strategies, operator adaptation across heterogeneous cards, and a unified abstraction layer targeting more hardware form factors.