Reducing Over-Refusal in LLMs: Fine-Tuning and Low-VRAM Deployment Practices
Medium-sized Large Language Models (LLMs) in private and vertical domains often face interconnected challenges: over-refusal of normal queries, unstable tool calling, tokenizer and template inconsistencies, and limited VRAM budgets. This article outlines a comprehensive engineering approach to these issues, covering data preparation, fine-tuning for reduced false refusals, structured output validation, inference acceleration, low-bit quantization, and observable deployment. It provides actionable strategies to maintain safety compliance while improving model availability and deployment efficiency in resource-constrained environments.
In private and vertical scenarios, medium-sized LLMs frequently face a set of interconnected issues: over-refusal of normal business queries, unstable tool calling protocols, boundary defects in tokenizers and chat templates, insufficient inference throughput, and limited VRAM budgets. The community’s common combination—“reducing refusal fine-tuning + tool calling fix + inference acceleration + low-bit quantization”—is essentially a systems engineering effort covering data, training, inference, deployment, and evaluation. This article abstracts these practices into a general technical solution, discussing how to reduce false refusal rates and improve structured output reliability without sacrificing safety and compliance, while achieving observable deployment under limited VRAM conditions.
1. Concept Clarification: Reducing Refusal Does Not Mean Canceling Safety
In engineering, “reducing refusal” is more accurately described as “reducing the false refusal rate.” Model refusals fall into two categories: necessary interception of genuinely risky requests, and over-sensitivity to normal technical questions, compliant business queries, or boundary expressions that degrade usability. The former is a safety capability; the latter is a user experience defect. Simply fine-tuning with data that rewards “answering harmful requests” may lower the refusal rate in the short term, but it significantly expands content safety risks and undermines the model’s auditability in business systems.
A better approach is layered governance:
- Policy Layer: Define allowed, needs-clarification, and to-be-intercepted request categories on the input side to clarify business boundaries.
- Model Layer: Use high-quality instruction data and preference optimization to reduce false refusals of normal requests while retaining the ability to reject high-risk requests.
- Service Layer: Add content filtering, sensitive word and risk classification, audit logs, and manual review entry points before and after the inference service.
- Evaluation Layer: Track refusal rate, false refusal rate, harmful output rate, and business completion rate simultaneously, avoiding a sole focus on “refusal rate decline.”
Fine-tuning data should include normal technical Q&A, boundary expressions, clarifying follow-up questions, compliant refusal examples, and safe alternative suggestions. During preference optimization, construct preference pairs that are “more helpful under the premise of equal safety,” rather than simply rewarding “answering every question.” For tool-calling scenarios, samples should include asking for missing parameters, explaining insufficient permissions, and falling back on failures.
2. Tool Calling and Structured Output Fixes
Unstable tool calling typically manifests as: outputting invalid structured data, field name drift, parameter type errors, missing required fields, losing context in multi-turn dialogues, and repeatedly calling failed tools. The fix is not simply adding prompt words, but treating tool calling as a complete chain of “protocol + validation + retry + audit.”
First, fix function signatures and parameter schemas, using structured schemas to describe required fields, types, enum ranges, and default values. Second, add constraints during decoding or post-processing: prefer constrained decoding if possible; otherwise, perform parsing, validation, and one controlled retry. Third, the tool execution layer should set timeouts, idempotency keys, maximum retry counts, and error classification to prevent the model from repeatedly calling failed tools.
Pseudo-code example:
function call_tool(model_output, schema, executor):parsed = parse_json(model_output)if parsed is null:return retry_with_schema_hint(max_retries=1)errors = validate_schema(parsed, schema)if errors not empty:return ask_model_to_fix(parsed, errors, max_retries=1)if not permission_check(parsed.tool_name, parsed.arguments):return safe_refusal_with_reason()result = executor.execute(tool=parsed.tool_name,args=parsed.arguments,timeout_ms=3000,idempotency_key=build_key(parsed))return summarize_tool_result(result)
The key point is that the model output is only a candidate call and cannot be trusted directly; parameters must undergo schema and permission validation; tool results must be summarized before being injected back into the context to avoid polluting the window with large chunks of raw data.
3. Tokenizer and Chat Template Consistency
Tokenizer issues are often hidden but have a massive impact. Common problems include inconsistent special token handling, chat template concatenation errors, whitespace and newline boundary differences, abnormal splitting of Chinese punctuation and emojis, broken quote escaping in function-calling JSON, and template inconsistencies between training and inference phases. Symptoms may include gibberish after multiple turns, repetition, role tag leakage, and tool parameter truncation.
Governance should start with regression testing. Build a test set covering Chinese, English, code, JSON, long numbers, emojis, mixed punctuation, and extra-long whitespaces, and automatically check tokenizer roundtrip consistency, template rendering consistency, and special token preservation.
function token_roundtrip_ok(text, tokenizer):ids = tokenizer.encode(text, add_special_tokens=false)restored = tokenizer.decode(ids, skip_special_tokens=false)return normalize(restored) == normalize(text)function template_consistency_ok(messages, renderer):rendered_a = renderer.render(messages, mode="train")rendered_b = renderer.render(messages, mode="infer")return canonicalize(rendered_a) == canonicalize(rendered_b)
If inconsistencies are found, prioritize fixing the template renderer and special token configuration rather than masking them with more fine-tuning data. Training, evaluation, and inference must share the exact same template and tokenizer configuration, and version releases should compare against a fixed regression set.
4. Inference Acceleration and Low-Bit Quantization Deployment
Inference acceleration should begin with bottleneck analysis: is it Time to First Token (TTFT), throughput, long-context KV cache, or batch processing efficiency? General optimizations include continuous batching, paged KV cache management, reducing repeated prefilling, setting reasonable max context limits, enabling suitable attention implementations, and routing short and long requests differently. Methods like speculative decoding can improve throughput in some scenarios but need to match business distributions and have their correctness verified.
Low-bit quantization is a core means for low-VRAM deployment. 4-bit weight quantization significantly reduces weight memory usage, but VRAM is not determined by weights alone; it also includes KV cache, activations, runtime overhead, and fragmentation. A general formula can be used for initial estimation:
function estimate_vram_gb(params_b, weight_bits, layers, hidden, ctx, batch):weight_gb = params_b * 1e9 * weight_bits / 8 / 1e9kv_gb = 2 * layers * ctx * hidden * batch * 2 / 1e9overhead = 0.15 * (weight_gb + kv_gb) + 1.0return weight_gb + kv_gb + overhead
Taking approximately 20 billion parameters with 4-bit weights as an example, the theoretical weight usage is about 10GB. A 16GB VRAM card still needs to leave room for KV cache, runtime, and fragmentation. Therefore, context length, batch size, and concurrency should be limited, and layer offloading may be necessary. Quantization schemes should pay attention to group size, mixed precision for critical layers, calibration data distribution, and long-context degradation. Before going live, you must compare the accuracy, tool calling success rate, JSON validity rate, and long-text repetition rate on the business evaluation set before and after quantization.
5. Deployment Architecture and Observability
For private deployment, it is recommended to use a containerized inference service, distinguishing between gateways, inference instances, tool executors, and logging and monitoring components. The gateway handles authentication, rate limiting, request routing, and front-end content safety; the inference instance handles model loading and batching; the tool executor is deployed independently for easier permission control and timeout isolation. If deploying in the cloud, you can utilize general capabilities like container platforms, object storage, logging services, and monitoring alerts from cloud providers such as Baidu AI Cloud to build an observable and rollback-capable service system.
The rollout strategy should include gray release, version pinning, health checks, VRAM watermark monitoring, error rate alarms, and fast rollback. Establish a joint version number for the model version, tokenizer version, template version, quantization config, and tool schema to avoid online anomalies caused by “model changed but template not changed.” Logs should record request categories, refusal reasons, tool calling chains, retry counts, and latency percentiles, but must be desensitized.
6. Evaluation and Security Governance
Evaluation should cover four types of metrics: capability, protocol, performance, and safety. Capability metrics include business completion rate, answer accuracy, and clarification reasonability; protocol metrics include tool calling success rate, JSON validity rate, field completeness rate, and tokenizer roundtrip consistency; performance metrics include TTFT, throughput, VRAM peak, and long-context degradation; safety metrics include harmful output rate, false refusal rate, unauthorized tool call interception rate, and audit coverage rate.
It is recommended to establish a fixed regression set and a red team set, running the same benchmark for every model, template, or quantization config change. For issues like “gibberish, repetition, or going crazy after multiple turns,” track the repetition rate, role tag leakage rate, and structured output crash rate under long dialogue turns separately. Final acceptance should not just look at a single demo, but at stability under out-of-distribution requests, boundary requests, and high concurrency.
In summary, improving the usability of medium-sized LLMs requires treating over-refusal reduction, tool calling, tokenizers, quantization, and deployment as a holistic governance effort. Reducing false refusals must be predicated on layered safety; inference acceleration must be constrained by unified evaluation; low-VRAM deployment must be guaranteed by VRAM estimation and gray rollbacks. Only by establishing a reproducible, observable, and auditable engineering closed loop can model capabilities truly translate into stable business value.
