Opening Powerful LLMs: A Dynamic Risk Routing Architecture Practice

    As large language models become more capable, the tension between broad accessibility and abuse risks intensifies. This article explores a practical architecture for deploying powerful models using a "shared foundation, dual open surfaces, and dynamic risk routing" approach. It details the design of dynamic security classifiers, policy decision-making, model routing, output review, and observability mechanisms. By maintaining consistent underlying model capabilities while enforcing differentiated boundaries for public and controlled access, this architecture effectively mitigates high-risk abuse without compromising the experience of legitimate users.

    Opening Powerful LLMs: A Dynamic Risk Routing Architecture Practice

    1. Problem Background: The Structural Conflict Between Capability Accessibility and Abuse Risks

    As general large language models (LLMs) become more powerful and widely accessible, abuse risks become increasingly difficult to control through single-point measures. When opening up to general users, developers, and enterprise customers, models must cover numerous legitimate scenarios such as Q&A, analysis, code generation, and document processing. However, the same underlying capabilities can be exploited for high-risk purposes, including assisting with cyberattacks, querying biosecurity risks, or distilling model capabilities. Simply adopting a “fully open” strategy amplifies abuse risks, while a “completely deny” strategy significantly damages the experience of legitimate users.

    Therefore, a more feasible engineering approach is not to split the powerful model into two entirely different systems, but to adopt an architecture of “shared foundation, dual open surfaces, and dynamic risk routing.” The underlying model capabilities remain consistent, while the public and controlled surfaces form different boundaries through access policies, security classification, routing decisions, and output review. The public surface targets a broad user base with enhanced safety mechanisms; the controlled surface is open only to vetted defensive security partners, subject to use-case constraints, auditing, and quota management. This maintains model capability consistency while restricting high-risk capabilities to a controlled scope.

    2. Overall Architecture: Shared Foundation and Dual Open Surfaces

    The overall architecture can be divided into the access layer, risk classification layer, policy decision layer, model routing layer, output review layer, and audit/observability layer. The public and controlled surfaces share the same underlying model, but incoming requests do not directly reach the model. Instead, they first pass through context construction and risk assessment. The public surface executes stricter risk policies by default; the controlled surface determines whether to allow a request based on tenant identity, use-case whitelists, and session-level constraints.

    Key design principles include:

    • Shared foundation does not mean exposing all capabilities: The underlying model is consistent, but the capability boundaries are defined by the peripheral control planes.
    • Public surface is conservative by default: High-risk requests prioritize safe rewriting, conservative answering, or refusal paths.
    • Controlled surface uses least privilege: Open only to vetted defensive security partners, bound by use cases, quotas, and auditing.
    • Configurable control plane: Risk categories, thresholds, routing actions, and canary release ratios should all be version-managed.
    • Full-chain observability: Records classification results, routing actions, output reviews, and manual review results for continuous evaluation.

    At the deployment level, platforms like Baidu AI Cloud can provide general container platforms, logging services, and monitoring/alarm capabilities to build an elastic foundation and observability system. However, the core security boundaries must still be jointly guaranteed by the application-side classifiers, policy engines, and routing layers.

    3. Dynamic Security Classifier Design

    The dynamic security classifier is the core of the public surface’s safety mechanism. It should not merely perform single-turn keyword matching; it must combine request text, session context, user history, tenant attributes, and output intent for comprehensive judgment. Common risk categories include cyberattack assistance, biosecurity risks, model distillation, unauthorized operations, and review evasion. The classifier output can be multi-label risk scores, and the policy layer decides the specific actions.

    Engineering focuses on the following key points:

    1. Context aggregation: In multi-turn dialogues, a single-turn request may seem harmless, but combined they form high-risk intents. Aggregate analysis should be performed on the session window, maintaining necessary session-level risk states.
    2. Adversarial bypass detection: Encoding obfuscation, role-playing, step-by-step induction, and language switching may bypass single-turn classification. Multi-feature fusion and output-side review are required.
    3. Model distillation identification: Beyond single-request classification, behavioral features such as request frequency, question diversity, repetition patterns, and output distribution should be used to identify systematic extraction behaviors.
    4. False positive control: High-risk categories should support layered actions like safe rewriting, conservative answering, and manual review, rather than a blanket refusal.
    5. Policy explainability: Record the triggered risk categories and decision basis for appeals, auditing, and policy tuning.

    The illustrative pseudocode is as follows:

    1. def handle_request(request, session):
    2. context = build_context(request, session)
    3. risk = classifier.predict(context) # Output multi-label risk scores
    4. decision = policy.decide(
    5. risk=risk,
    6. tenant=request.tenant,
    7. session=session,
    8. surface=request.surface # Public or controlled surface
    9. )
    10. if decision.action == "allow":
    11. return base_model.generate(request)
    12. if decision.action == "rewrite":
    13. safe_request = rewriter.rewrite(request)
    14. return base_model.generate(safe_request)
    15. if decision.action == "route_conservative":
    16. return conservative_model.generate(
    17. redact_high_risk_parts(request),
    18. policy=decision.conservative_policy
    19. )
    20. if decision.action == "refuse":
    21. return refusal_response(decision.reason)
    22. if decision.action == "review":
    23. return pending_review_response()
    24. return fallback_response()

    The above code only expresses routing logic and does not represent specific interfaces or parameters. In a real system, the classifier, policy engine, and model routing should be decoupled for independent release and rollback.

    4. Policy Decision and Model Routing

    The policy decision layer is responsible for converting risk scores into actionable actions. Typical actions include allow, safe rewrite, switch to a conservative answering model, refuse, enter manual review, or rate-limit observation. When the public surface detects high-risk requests, it can automatically switch to a more conservative answering model or controlled policy engine to generate responses. This allows broad user access to capabilities while restricting high-risk capabilities to a controlled scope.

    The routing layer must address several engineering issues: first, timeout and degradation, ensuring clear fallback strategies when classifiers or conservative models are unavailable; second, idempotency and retry, avoiding audit confusion caused by duplicate routing; third, session consistency, maintaining high-risk states within a reasonable window for the same session; fourth, canary releases, validating new policies with small traffic before scaling up. The controlled surface must bind tenant whitelists, use-case declarations, quotas, and audit logs, ensuring that “trusted partners” are not static lists but continuously reviewed authorized relationships.

    5. Output Review and Secondary Protection

    Input-side classification cannot cover all risks; output-side secondary protection remains necessary. Output review can check whether responses contain high-risk operational steps, sensitive details, or evasion suggestions, and execute reductions, rewrites, citations of safety guidelines, or conversions to refusals based on policy. For the public surface, output review should share risk labels with input classification but use independent policies, preventing single-point misjudgments from escalating into user experience issues. For the controlled surface, output review is primarily used for compliance auditing and use-case boundary violation detection.

    6. Observability and Continuous Evaluation

    A security architecture must be measurable. It is recommended to track metrics such as risk hit rate, false positive rate, routing ratio, refusal rate, manual review rate, bypass attempt rate, latency overhead, and policy rollback count. Regular red team assessments and canary comparisons should be conducted. Logs should be desensitized in storage, adhering to the principle of data minimization. Policy versions, classifier versions, and model versions should be bound and recorded to ensure traceability. Only by forming a closed loop among classification, routing, review, and auditing can the opening of powerful models achieve a sustainable balance between capability and risk.