Skip to content

feat(docs,examples): migrate tutorials and notebooks to nemotron-3.5-content-safety (NGUARD-972, NGUARD-980) - #2442

Open
svenchilton wants to merge 3 commits into
developfrom
dev/schilton/content-safety-tutorial-and-notebook-updates
Open

svenchilton wants to merge 3 commits into
developfrom
dev/schilton/content-safety-tutorial-and-notebook-updates

Conversation

@svenchilton

Copy link
Copy Markdown
Collaborator

Summary

  • Migrates all tutorials and example notebooks to nemotron-3.5-content-safety (replacing nemotron-3-content-safety): nemotron-safety-guard-deployment.mdx, nemotron-content-safety-reasoning-deployment.mdx (full rewrite with enable_thinking: true), nemoguard-topiccontrol-deployment.mdx (full rewrite with custom_policy), multimodal.mdx, topic_control_nim.ipynb, content_safety_nim.ipynb, combined_guardrails_nim.ipynb, gliner_pii_detection_nim.ipynb
  • Adds examples/e2e_tests/test_content_safety_rail.py: end-to-end eval script covering Aegis 2.0, Nemotron Safety Guard v3, CoSApien, DynaGuardrail, and VLGuard; supports direct NIM path and full Guardrails pipeline comparison (--compare-guardrails); stratified subsampling (--sample), custom policy per dataset, per-domain/trickiness breakdowns (NGUARD-972, NGUARD-980)
  • Adds GLiNER deprecation notes to gliner_pii_detection_nim.ipynb and combined_guardrails_nim.ipynb: hosted nvidia/gliner-pii endpoint is no longer available on build.nvidia.com; notes local hosting as the current option and mentions an OpenRouter-hosted equivalent coming soon
  • Adds OpenRouter note to combined_guardrails_nim.ipynb Remote Deployment section
  • Updates content_safety_vision config: config.yml and prompts.yml migrated to nemotron-3.5-content-safety
  • Updates uv.lock: regenerated with uv 0.11.26 to resolve stale lockfile

Eval results (direct NIM, default policy, test_content_safety_rail.py)

Dataset n F1 Published Delta
Aegis 2.0 1964 0.858 0.860 −0.002
Nemotron-SG v3 2000 0.821 — —
CoSApien 200 0.710 (default) / 0.856 (custom) 0.820 −0.110 / +0.036
DynaGuardrail 2000 0.728 (default) / 0.847 (custom) 0.910 −0.182 / −0.063

Guardrails pipeline (default policy) tracks direct within ≤0.004 F1 on all datasets (96.7–98.0% agreement), with ~2.7–2.8× latency overhead.

Test plan

  • Verify tutorials render correctly in Fern docs build
  • Verify test_content_safety_rail.py runs against a live Nemotron 3.5 CS NIM (--dataset aegis --sample 10)
  • Verify notebooks execute cleanly in Jupyter with a local NIM
  • Confirm GLiNER deprecation note renders correctly in both notebooks

Closes NGUARD-972, NGUARD-980

…content-safety (NGUARD-980) + add benchmark eval script (NGUARD-972)

Tutorials (docs/getting-started/tutorials/):
- nemotron-safety-guard-deployment.mdx: migrated to nemotron-3.5-content-safety
  NIM with request_categories and chat_template_kwargs
- nemotron-content-safety-reasoning-deployment.mdx: full rewrite for
  enable_thinking: true (reasoning/extended-thinking mode)
- nemoguard-topiccontrol-deployment.mdx: full rewrite for custom_policy
- multimodal.mdx: updated model ID and config for vision rail

Notebooks (examples/notebooks/):
- content_safety_nim.ipynb: updated to nemotron-3.5-content-safety NIM
- topic_control_nim.ipynb: updated for custom_policy
- combined_guardrails_nim.ipynb: updated model references; architecture
  under review -- custom_policy and request_categories are not additive
  in a single model call; correct fix requires two separate model instances
  (pending Tim Gasser / Anuj Doshi reply on NGUARD-980)

Vision config (examples/configs/content_safety_vision/):
- Migrated from gpt-4o-mini vision_rails to nemotron-3.5-content-safety NIM

Benchmark eval script (examples/e2e_tests/):
- test_content_safety_rail.py: end-to-end eval covering Aegis 2.0,
  Nemotron Safety Guard v3, CoSApien, DynaGuardrail, and VLGuard datasets
  against both direct NIM and Guardrails input rail (NGUARD-972)

Signed-off-by: Sven Chilton <schilton@nvidia.com>
…enRouter note (NGUARD-980)

- test_content_safety_rail.py: add --main-nim-url, --main-model-name, --guardrails-concurrency flags and stratified subsampling via --sample
- gliner_pii_detection_nim.ipynb: add deprecation note for nvidia/gliner-pii hosted endpoint
- combined_guardrails_nim.ipynb: note that OpenRouter-hosted GLiNER equivalent is coming soon
- uv.lock: sync to current dependency resolution

Signed-off-by: Sven Chilton <schilton@nvidia.com>
@github-actions github-actions Bot added status: needs triage New issues that have not yet been reviewed or categorized. size: XL labels Oct 8, 2026
@svenchilton
svenchilton requested a review from tgasser-nv October 8, 2026 16:48
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

…y model

The vision rail prompt was renamed from $model=vision_rails to
$model=content_safety in examples/configs/content_safety_vision/prompts.yml
as part of the nemotron-3.5 migration, but the test file still referenced
the old name, causing all 13 CI jobs to fail with:

  ValueError: Could not find prompt for task
  content_safety_check_input $model=vision_rails and model openai/gpt-4o-mini

Signed-off-by: Sven Chilton <schilton@nvidia.com>
@github-actions

Copy link
Copy Markdown
Contributor

PR merge guidance

@svenchilton thanks for the PR. GitHub is currently blocking merge for one or more repository requirements:

  • This branch has merge conflicts with develop. Please rebase your branch on the latest develop, resolve the conflicts locally, and force-push the updated branch.

Relevant guide:

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs: rebase size: XL status: needs triage New issues that have not yet been reviewed or categorized.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant