On-Premises LLM Training and RFT: From QLoRA to Production Serving
Fine-tuning an open-weight model on premises guarantees parameter ownership and precise adherence to internal tool interfaces. Here is the operational engineering method from trajectory curation to vLLM serving.

Why specialise an open model on site rather than calling a remote API?
Specialising an open model on site guarantees complete confidentiality of training data and eliminates dependence on unpredictable quotas and arbitrary terms of remote cloud APIs. Organisations operating under strict regulatory compliance or safeguarding proprietary software assets cannot transmit their internal operational logic to external platforms.
Local fine-tuning grounds open weights such as detailed on the Hugging Face model card for Qwen3.8-27B into structured tool-calling protocols including the Model Context Protocol standard. Commercial models evaluated across broad tasks frequently produce malformed arguments or redundant calls when presented with complex enterprise APIs. Updating specific weight matrices on curated domain trajectories enforces rigid schema compliance and reduces repeated execution failures.
Direct infrastructure ownership also establishes predictable operating expenditures. Whereas per-token billing scales linearly with agentic reasoning volume, deploying dedicated accelerators caps operational costs while granting engineering teams permanent sovereignty over checkpoints and runtime configurations.

How to construct a reinforcement training dataset through rejection sampling (RFT)?
Constructing a reinforcement training dataset relies on running autonomous agent workflows inside isolated sandboxes, where only trajectories verified by deterministic success criteria are preserved. This methodology prevents distribution contamination by selecting training traces solely upon objective functional proof.
The technical harness employs the save agent rs (save-agent-rs) orchestrator written in Rust linked to containerised Linux execution sandboxes via the Docker daemon and LiteLLM gateway. The agent receives technical assignments such as vulnerability patching or repository refactoring, exercising over fourteen hundred system tools. Each trial produces a comprehensive execution log recording natural language thoughts, structured tool parameters, and raw shell outputs.

When base exploration encounters deadlocks, an automated teacher wave queries a secondary reasoning model to unlock the obstacle. Once execution completes and satisfies an unambiguous binary test suite, the entire interaction trace is formatted as structured JSON Lines. This rejection sampling mechanism ensures that every training example demonstrates an orderly sequence of validated actions.

Which hyperparameters and masking rules stabilise QLoRA on H100 and H200 accelerators?
Stabilising QLoRA adaptation requires a rank of 64, an alpha multiplier of 128, a learning rate of 2e-4, and strict assistant-only loss masking. These empirical parameters, building upon the foundational QLoRA paper on arXiv, maintain steady gradient norms on modern compute hardware such as the H200 SXM server without risking numerical divergence.
Compute resources are provisioned on the NVIDIA Brev acceleration platform, offering on-demand H100 80 GB PCIe or SXM and H200 141 GB SXM instances at accessible hourly rates between $1.50 and $3.50. This consumption-based model completes a full fifty-step adaptation cycle for under fifteen dollars of direct expenditure, eliminating capital allocation for dedicated physical appliances.
Leveraging these enterprise accelerators is technically mandatory compared to consumer cards or legacy A100 units constrained to 40 GB of VRAM. At a sequence length of 16,384 tokens with full backpropagation across all linear layers, activation tensors alone require over 32 GB of memory buffer. On a 40 GB A100 unit, transient attention spikes trigger immediate CUDA out-of-memory terminations. Modern H100 and H200 hardware delivers the necessary headroom along with HBM3 and HBM3e memory bandwidth of 3.35 to 4.8 TB/s, accelerating forward and backward passes.
A decisive architectural asset of the Brev environment is the persistent /workspace NVMe volume. When halting compute instances between experimental runs, the fifty-five gigabyte base weights and Python virtual environments remain preserved on disk. This persistent caching eliminates recurring transfers of raw tensor files over the network and guarantees deterministic startup script execution.

The decisive architectural control is assistant-only loss masking. Across multi-turn agent interactions, evaluating loss on static system instructions or verbose tool outputs disrupts language modelling representations. Gradient backpropagation is therefore restricted strictly to tokens generated directly by the assistant during reasoning and tool invocation phases by injecting generation boundary markers into the chat template and leveraging native Transformers masking.
| Training Hyperparameter | Measured Setting | Architectural Rationale |
|---|---|---|
| Base Architecture | Qwen 3.8 27B dense abliterated (orcarouter/Qwen3.8-27B-Uncensored-FP8) | Non-MoE dense architecture providing stable code synthesis across long turns. |
| LoRA Rank (r) and Alpha | r = 64, alpha = 128 | Sufficient representational bandwidth to encode over fourteen hundred tool schemas. |
| Target Modules | all-linear | Comprehensive parameter coverage spanning attention projections and MLP layers. |
| Learning Rate | 2e-4 cosine schedule | Consistent convergence over fifty optimisation steps without loss spikes. |
| Loss Masking | Assistant-only tokens | Gradient computation restricted strictly to reasoning and tool dispatch tokens. |
| Context Window | 16,384 tokens (training) | Preserves multi-turn interaction traces without truncating command output payloads. |
| VRAM Footprint | 64 GB on 141 GB total | Maintains safe memory headroom preventing transient allocation faults. |
| Software Component | Reference Version | Operational Role in Pipeline |
|---|---|---|
| OS and Drivers | Ubuntu 22.04 LTS, NVIDIA Driver R550 / CUDA 12.8 | Low-level kernel drivers and HBM3e bandwidth support for H200 accelerators. |
| Execution Runtime | Python 3.11 | Isolated interpreter executing training loops and supervision telemetry scripts. |
| Deep Learning Framework | PyTorch 2.4.0 (CUDA 12.1) | Tensor math operations, backpropagation passes, and unified memory management. |
| Adaptation Libraries | Transformers 4.45.2, PEFT 0.13.0, TRL 0.11.4 | Native tokenisation, low-rank adapter configuration, and training loop orchestration. |
| 4-bit Quantisation | BitsAndBytes 0.44.1 (NF4 double quant) | Compact memory representation of base weights with bfloat16 compute precision. |
| Cloud Compute Platform | Brev (brev.nvidia.com) | On-demand H100 80 GB / H200 141 GB SXM instances with persistent /workspace volume. |
| Private Model Hub | Hugging Face Pro | Unlimited private repositories, dedicated Git LFS bandwidth, and programmatic HfApi access. |
| Serving Engine | vLLM >= 0.15 (--tool-call-parser qwen3_coder) | High-throughput batching, concurrent token generation, and native tool parsing. |
| Post-Training Compression | NVIDIA ModelOpt v0.17+ (NVFP4 SM120) | Four-bit floating point quantisation for workstation deployment on RTX PRO 6000 hardware. |
| Secrets Management | OpenBao v2.x | In-memory delivery of model registry tokens and remote API credentials. |

How to supervise training telemetry and prevent gradient instabilities automatically?
Supervising training telemetry relies on tracking L2 gradient norms, monitoring loss curves for sudden divergences, and retrieving credentials securely from an identity vault. A background telemetry worker parses log records at every step to halt execution when abnormal parameter fluctuations emerge.
The supervisory monitor confirms that the L2 gradient norm remains between 0.05 and 1.50. Spikes exceeding this boundary indicate imminent gradient explosion, whereas drops toward zero denote vanishing signals. Upon detecting anomalies, the supervisor adjusts learning rates or scales gradient accumulation steps dynamically.
Credential provisioning and registry tokens are managed through an OpenBao secrets engine. Secrets are injected directly into environment memory during process initialization, preventing cleartext exposure inside deployment files or version control repositories.

How to merge low-rank adapters and deploy the specialised model under vLLM?
Deploying the specialised model requires merging LoRA adapter weights directly into the base BF16 layers, followed by initialization under vLLM with an engine-level tool parser. Merging eliminates runtime computational overhead during high-concurrency token generation.
The merging routine, aligned with the vLLM engine project, reconstructs full precision tensors by adding low-rank product matrices to original weights, writing the unified artifact to local storage and private registries as the save-rs-merged-v7 checkpoint.
Post-training artifact governance relies on private Hugging Face Pro repository infrastructure. The professional tier provides unlimited private model and dataset repositories accompanied by elevated Git LFS bandwidth to transfer fifty-five gigabyte unified checkpoints without transfer bottlenecks. Upon completing parameter fusion, an automated script uploads the LoRA adapters and the consolidated save-rs-merged-v7 checkpoint to the secure hub, indexed by commit hash and semantic version tags.
Authentication against private repositories uses fine-grained programmatic access tokens provisioned directly from the OpenBao identity vault. This pattern shields proprietary weights from public disclosure while enabling local vLLM inference nodes to synchronize verified checkpoints automatically during continuous deployment pipelines.

The vLLM engine (version 0.15 or later) is then started with automated function calling flags (--tool-call-parser qwen3_coder), a production context of 65,536 tokens, and a 92% video memory allocation quota.
For deployment on workstation workstations hosting cards such as the RTX PRO 6000, the consolidated model can undergo subsequent NVFP4 quantisation via NVIDIA ModelOpt. This format leverages specialised hardware tensor cores, reducing memory footprints by half while preserving baseline task performance.


Which objective benchmarks confirm non-regression and operational stability?
Confirming operational stability demands a zero-failure completion rate on specialized tool tasks without degrading general natural language reasoning benchmarks. Automated verification suites must execute immediately after checkpoint conversion to validate model integrity.
The qualification harness executes synthetic evaluation suites testing code refactoring, network inspection routines, and system exception management. Generated outputs are evaluated against rigid structural assertions to verify that domain specialization has not induced catastrophic forgetting.
Production latencies, time-to-first-token, and throughput metrics are documented under sustained concurrent workloads. Passing these functional gates permits rolling deployment across internal networks, establishing a dependable and sovereign production pipeline.

Frequently asked questions
Why choose QLoRA adaptation over full-parameter fine-tuning?
QLoRA in 4-bit quantisation restricts gradient state allocation to low-rank matrices, allowing a dense 27-billion parameter model to train on a single professional accelerator without altering baseline weight precision.
What does assistant-only loss masking accomplish?
The mask zeroes out training loss across prompt instructions and raw external environment outputs, concentrating parameter updates exclusively on reasoning chains and tool invocations generated by the assistant.
How does vLLM parse tool calls from the trained checkpoint?
The vLLM engine (version 0.15 or later) activates the qwen3_coder tool parser matching the model tag format and configures automated schema selection, providing an OpenAI-compatible interface directly consumed by multi-agent frameworks.