Skip to content

fix(ui,registry): distinguish component type, model family and implementation (#58) - #122

Open
drk-ram wants to merge 1 commit into
GenAI-Security-Project:mainfrom
drk-ram:fix/58-model-type-architecture-semantics
Open

drk-ram wants to merge 1 commit into
GenAI-Security-Project:mainfrom
drk-ram:fix/58-model-type-architecture-semantics

Conversation

@drk-ram

@drk-ram drk-ram commented Nov 1, 2026

Copy link
Copy Markdown

Summary

Fixes #58 (goals A and the "registry JSONPath / checklist location match emitted JSON" acceptance criteria). The optional per-field provenance view (B) is not included.

UI terminology (result.html, Human-Friendly View)

Before After Source
Type Component type (CycloneDX) components[0].type
Architecture Model family (HF model_type) modelCard.modelParameters.modelArchitecture
(not shown) Model implementation (HF architectures) (only when present) architectures component property

For the Nanbeige4.1-3B example: machine-learning-model / llama / LlamaForCausalLM.

The emitted AIBOM is unchanged, so this is backward compatible: components[].type, modelArchitecture (from model_type) and the architectures component property keep their names and values.

Registry JSONPath vs. emitted JSON

Auditing every field_registry.json jsonpath against a generated BOM showed several paths using a singular $.component. root that does not exist in the output (primaryPurpose, suppliedBy, intendedUse, ethicalConsiderations, technicalLimitations, datasets), plus paper pointing at $.metadata.component.externalReferences. Same class of bug as #76. Effects on main:

  • primaryPurpose, suppliedBy (both critical) and intendedUse were scored missing even when present, because the fallback checker does not know those names
  • the Field Checklist showed a location (e.g. component.modelCard...) that does not match the JSON

All paths now use $.components[0]... (the ethicalConsiderations leaf is name, the key actually emitted). Scoring note: BOMs that emit those three fields will now correctly gain their points.

The two externalReferences location edits and the paper path are identical to those in #120, so the PRs merge cleanly in either order.

Small cleanup

model_type / architectures component properties are no longer emitted with a "None" or empty value when config.json lacks them (the UI row is skipped in that case).

Not changed / follow-up

modelArchitecture still falls back to <name>Model when model_type is unknown; changing that affects scoring and is left for a separate discussion. Mapping architectures[] into a CycloneDX field (e.g. architectureFamily) is also left out to keep the output stable.

Tests

tests/test_model_type_semantics.py (new):

  • no registry jsonpath/location uses the singular $.component. root
  • registry jsonpath resolves against a generated BOM for every emitted field
  • those fields are checked off in the Field Checklist, and the checklist path matches the emitted JSON location
  • emitted type / modelArchitecture / architectures stay distinct and backward compatible
  • rendered result page shows the new labels, the implementation row only when present, and not the old labels
  • no placeholder properties for empty model_type / architectures

The registry and UI tests fail against the previous src/.

Validation

  • pytest --no-cov (Python 3.11): 191 passed

…entation (GenAI-Security-Project#58)

UI (Human-Friendly View):
- "Type" -> "Component type (CycloneDX)"
- "Architecture" -> "Model family (HF model_type)"
- add "Model implementation (HF architectures)" when config.json
  architectures[] is present

Registry: several jsonpath/location values used a singular `$.component.`
root that never exists in the emitted BOM (primaryPurpose, suppliedBy,
intendedUse, ethicalConsiderations, technicalLimitations, datasets) and
`paper` used `$.metadata.component.externalReferences`. Because the
fallback checker does not know these fields, primaryPurpose, suppliedBy and
intendedUse were scored as missing even when emitted, and the Field
Checklist displayed a location that did not match the JSON. Point every
path at `$.components[0]...` (ethicalConsiderations leaf is `name`, the
key actually emitted).

Do not emit `model_type`/`architectures` component properties with a
"None"/empty value when config.json lacks them.

The emitted AIBOM structure is unchanged: components[].type,
modelCard.modelParameters.modelArchitecture (model_type) and the
`architectures` component property keep their names and values.

Fixes GenAI-Security-Project#58

Signed-off-by: Raghuvar Karthik Durga <177662415+drk-ram@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Normalize model type / architecture field semantics and align UI, registry, and CycloneDX mapping

1 participant