Skip to content

fix(studio): scope anonymizer sampling params to LLM roles [ASTD-417] - #1246

Merged
marcusds merged 9 commits into
mainfrom
astd-417-anonymizer-gliner-model-params/mschwab
Aug 12, 2026
Merged

fix(studio): scope anonymizer sampling params to LLM roles [ASTD-417]#1246
marcusds merged 9 commits into
mainfrom
astd-417-anonymizer-gliner-model-params/mschwab

Conversation

@marcusds

@marcusds marcusds commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

The Anonymizer builder showed the same three inference params (temperature, max tokens, top P) for every role and sent max_tokens to all of them — including the entity_detector, which must be a GLiNER model. GLiNER is a token-classification NIM driven by labels/threshold in extra_body; the library's default models.yaml gives its config only max_parallel_requests and timeout, while the LLM roles get temperature, top_p, and max_tokens. This change makes Studio match that split.

Answering the questions in the ticket:

  • Keep the three params for entity_validator, entity_augmenter, latent_detector, and replacement_generator — those roles are chat-completion models in anonymizer/config/default_model_configs/models.yaml.
  • Drop them for the GLiNER entity_detector — the upstream default config never sets them.
  • Defaults follow the upstream gpt-oss-120b profile: temperature 0.3, top_p 0.95, max_tokens 16384. (latent_detector defaults to the nemotron profile upstream — temperature 0.4, top_p 1.0 — but Studio applies one default across LLM roles and the user can adjust per role.)

Related Issue

ASTD-417

Changes

  • ModelSettingsSection: no Params dropdown for the GLiNER detector role. Other roles keep the dropdown.
  • schema.ts: buildRoleParams builds request params per role — timeout only for the detector (sampling keys stripped even if form state holds them), timeout + max_tokens + temperature + top_p for LLM roles.
  • constants.ts: adds DEFAULT_MODEL_TEMPERATURE (0.3), DEFAULT_MODEL_TOP_P (0.95), MAX_MODEL_MAX_TOKENS (32768), SAMPLING_PARAM_KEYS, supportsSamplingParams, and the Anonymizer slider metadata overrides.
  • InferenceParameters / ParamsDropdown (@nemo/common): new optional fieldMetadata prop to override the shared slider bounds and defaults per caller. Existing callers are unaffected. Studio uses it so the sliders show the values actually sent — previously the dropdown showed the generic defaults (temperature 1.0, max tokens 1024, ceiling 4096) while the request carried max_tokens: 16384.
  • Tests: new ModelSettingsSection.test.tsx, plus schema.test.ts coverage that the detector receives no sampling params.

Behavior note: because the detector's params now differ from the LLM roles', a run emits one model_config for the detector and one per distinct LLM param set instead of collapsing them into a single alias. Role-to-alias mapping is unchanged.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with documentation updates
  • Documentation only
  • Contributor tooling or automation
  • CI, build, or test infrastructure

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Documentation updated for user-visible behavior
  • Documentation not applicable — justification: in-product form behavior; no docs page describes these controls.

Verification

  • Pull request title follows the repository's Conventional Commit format
  • Every commit includes an appropriate Signed-off-by: trailer
  • uv run pre-commit run -a passes, or any blocked checks are identified below — not run repo-wide; the commit-stage hooks ran and passed on the changed files.
  • Targeted tests pass, or tests are marked not applicable above
  • No secrets, API keys, or credentials are included

Targeted validation:

  • pnpm --filter nemo-studio-ui test src/routes/AnonymizerBuilderRoute — 7 files, 54 tests passed
  • pnpm --filter @nemo/common test src/components/ModelSelectV2 — 3 files, 30 tests passed
  • pnpm --filter nemo-studio-ui typecheck and pnpm --filter @nemo/common typecheck — clean
  • pnpm lint:fix (from web/) — clean, no changes

Summary by CodeRabbit

  • New Features

    • Added configurable inference parameter metadata for model settings.
    • Added temperature, top-p, and maximum token controls with role-specific defaults and limits.
    • Sampling controls now appear only for models that support them.
  • Bug Fixes

    • Model configurations now correctly preserve distinct inference parameter settings.
    • Unsupported models receive only applicable parameters.
  • Tests

    • Expanded coverage for model settings, parameter filtering, and configuration generation.

The builder exposed temperature, max tokens, and top P for every
Anonymizer role and sent max_tokens to all of them, including the GLiNER
entity detector. GLiNER is a token-classification NIM driven by labels
and a threshold, and the library's default models.yaml gives it only
max_parallel_requests and timeout.

Hide the params dropdown for the detector role and strip sampling keys
from its request params. For the LLM roles, seed the defaults the library
uses for gpt-oss-120b (temperature 0.3, top_p 0.95, max_tokens 16384) and
raise the max-tokens slider ceiling so the dropdown reflects what is
actually sent.

Signed-off-by: mschwab <mschwab@nvidia.com>
@github-actions github-actions Bot added the fix label Aug 11, 2026
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 32235/40906 78.8% 63.7%
Integration Tests 18640/38832 48.0% 20.7%

The absent dropdown reads clearly enough on its own.

Signed-off-by: mschwab <mschwab@nvidia.com>
@marcusds
marcusds marked this pull request as ready for review August 11, 2026 23:05
@marcusds
marcusds requested review from a team as code owners August 11, 2026 23:05
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 541cae2e-289b-4c0d-9057-7687295d34dd

📥 Commits

Reviewing files that changed from the base of the PR and between bdd4915 and f33f2c7.

📒 Files selected for processing (1)
  • web/packages/studio/src/routes/AnonymizerBuilderRoute/constants.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/packages/studio/src/routes/AnonymizerBuilderRoute/constants.ts

📝 Walkthrough

Walkthrough

The change adds typed inference metadata overrides, role-specific sampling controls, and role-specific request parameter construction. GLiNER excludes sampling parameters. Tests cover control rendering and separate model configurations.

Changes

Inference parameter handling

Layer / File(s) Summary
Typed inference metadata plumbing
web/packages/common/src/components/ModelSelectV2/InferenceParameters.tsx, web/packages/common/src/components/ModelSelectV2/ParamsDropdown.tsx
InferenceParameters accepts per-field metadata overrides. ParamsDropdown forwards the overrides.
Role-aware sampling controls
web/packages/studio/src/routes/AnonymizerBuilderRoute/constants.ts, web/packages/studio/src/routes/AnonymizerBuilderRoute/components/ModelSettingsSection.tsx, web/packages/studio/src/routes/AnonymizerBuilderRoute/components/ModelSettingsSection.test.tsx
The builder defines sampling metadata and renders parameter controls only for supported roles. GLiNER controls are excluded.
Role-specific request parameters
web/packages/studio/src/routes/AnonymizerBuilderRoute/schema.ts, web/packages/studio/src/routes/AnonymizerBuilderRoute/schema.test.ts
Request construction applies defaults and overrides for supported roles and removes sampling parameters for GLiNER. Tests cover configuration separation and parameter values.

Sequence Diagram(s)

sequenceDiagram
  participant ModelSettingsSection
  participant ParamsDropdown
  participant InferenceParameters
  participant buildRoleParams
  ModelSettingsSection->>ParamsDropdown: pass ANONYMIZER_PARAM_METADATA
  ParamsDropdown->>InferenceParameters: forward fieldMetadata
  InferenceParameters->>InferenceParameters: merge field metadata
  ModelSettingsSection->>buildRoleParams: build role parameters
  buildRoleParams->>buildRoleParams: filter unsupported sampling fields
  buildRoleParams->>buildRoleParams: apply defaults and overrides
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: limiting anonymizer sampling parameters to LLM roles.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch astd-417-anonymizer-gliner-model-params/mschwab

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
web/packages/studio/src/routes/AnonymizerBuilderRoute/components/ModelSettingsSection.test.tsx (1)

10-15: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use type-only imports.

  • web/packages/studio/src/routes/AnonymizerBuilderRoute/components/ModelSettingsSection.test.tsx#L10-L15: Import AnonymizerFormData, FC, and ReactNode with import type.
  • web/packages/studio/src/routes/AnonymizerBuilderRoute/schema.test.ts#L12-L17: Import AnonymizerFormData with import type.

As per coding guidelines: “Use import type for type-only imports.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@web/packages/studio/src/routes/AnonymizerBuilderRoute/components/ModelSettingsSection.test.tsx`
around lines 10 - 15, Use type-only imports for AnonymizerFormData, FC, and
ReactNode in
web/packages/studio/src/routes/AnonymizerBuilderRoute/components/ModelSettingsSection.test.tsx
lines 10-15, and for AnonymizerFormData in
web/packages/studio/src/routes/AnonymizerBuilderRoute/schema.test.ts lines
12-17; leave the runtime imports unchanged.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@web/packages/studio/src/routes/AnonymizerBuilderRoute/components/ModelSettingsSection.test.tsx`:
- Around line 39-40: Strengthen the test around the dropdown triggers by
explicitly asserting that the Entity Detector section has no
params-dropdown-trigger, while a sampling role still has one. Update the test
near activeRolesForStrategy(STRATEGY_SUBSTITUTE) so it verifies both the missing
entity_detector control and the retained sampling-role control, rather than
relying only on the aggregate count.

---

Nitpick comments:
In
`@web/packages/studio/src/routes/AnonymizerBuilderRoute/components/ModelSettingsSection.test.tsx`:
- Around line 10-15: Use type-only imports for AnonymizerFormData, FC, and
ReactNode in
web/packages/studio/src/routes/AnonymizerBuilderRoute/components/ModelSettingsSection.test.tsx
lines 10-15, and for AnonymizerFormData in
web/packages/studio/src/routes/AnonymizerBuilderRoute/schema.test.ts lines
12-17; leave the runtime imports unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 21e44cf7-dd91-4d8d-94e7-2bb7c52efda6

📥 Commits

Reviewing files that changed from the base of the PR and between d5e9e4e and b57ea45.

📒 Files selected for processing (7)
  • web/packages/common/src/components/ModelSelectV2/InferenceParameters.tsx
  • web/packages/common/src/components/ModelSelectV2/ParamsDropdown.tsx
  • web/packages/studio/src/routes/AnonymizerBuilderRoute/components/ModelSettingsSection.test.tsx
  • web/packages/studio/src/routes/AnonymizerBuilderRoute/components/ModelSettingsSection.tsx
  • web/packages/studio/src/routes/AnonymizerBuilderRoute/constants.ts
  • web/packages/studio/src/routes/AnonymizerBuilderRoute/schema.test.ts
  • web/packages/studio/src/routes/AnonymizerBuilderRoute/schema.ts

A bare trigger count passes even if the wrong role drops its controls.

Signed-off-by: mschwab <mschwab@nvidia.com>
Comment thread web/packages/studio/src/routes/AnonymizerBuilderRoute/constants.ts Outdated
Comment thread web/packages/studio/src/routes/AnonymizerBuilderRoute/schema.test.ts Outdated
SAMPLING_PARAM_KEYS in the anonymizer constants duplicated the private FIELDS
const in InferenceParameters.tsx, which already backs InferenceParameterField.
Export it as INFERENCE_PARAMETER_FIELDS and drop the anonymizer copy, so the
set of sampling params GLiNER cannot take lives next to the controls that
render them.

Signed-off-by: mschwab <mschwab@nvidia.com>
Swap the anonymizer test mocks from openai/gpt-oss-120b to
nvidia/nemotron-3-nano-30b-a3b, and import AnonymizerFormData, FC and ReactNode
with import type.

Signed-off-by: mschwab <mschwab@nvidia.com>
@marcusds
marcusds enabled auto-merge August 12, 2026 18:46
@marcusds
marcusds added this pull request to the merge queue Aug 12, 2026
Merged via the queue into main with commit ec7289f Aug 12, 2026
55 checks passed
@marcusds
marcusds deleted the astd-417-anonymizer-gliner-model-params/mschwab branch August 12, 2026 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants