Skip to content

Model and Specification View ​

Current responsibility and status. This module lists pinned and built models, loads supported VNN-LIB and classifier sources, serves ACT-backed model descriptions and dataset samples, and renders the network and input or output specification. MSV-01 and MSV-04 are implemented. MSV-02 and MSV-03 remain backlog. C owns the views, B integrates the service, and A reviews variable and constraint semantics.

The module owns presentation and content addressed model snapshots. It does not reinterpret ACT semantics, calculate bounds, or replace unsupported specifications with boxes. ACT-side loading and description are engine_bridge/model_spec. Run creation is verification, engine readiness is engine, and selection is workspace. See the parent flow diagram and project development entry point.

Change Guide ​

GoalRequired editsConditional edits / reused path
Show a new description fieldschemas.py, service.py mapping, consuming view/tests; generate wire.tsbridge model_spec only if the neutral description lacks the field. Routes/hooks/API only for endpoint/query changes.
Support a new sourcebridge source builder, schemas.py, service.py, LoadPanel.tsx, source testsExisting POST /api/models transport can remain if its operation is unchanged.
Change graph or input-image presentationModelGraph.tsx, SpecPanel.tsx, InputDomain.tsx as relevantShared pixels helpers only when reusable rendering changes; no ACT or model-identity change for presentation.
Change content identity or persistenceservice.py, persistence/hash testsverification only when its model ID/path contract changes.
Add editable specification draftsMSV-03 backlog: define validation and new immutable model references firstNo general draft API exists today. Preserve old runs' pinned snapshots.

Flow Diagram ​

Arrows are labeled as calls, results, or events. Neighboring modules are named explicitly and linked in the block tables. HTTP transport may be grouped; views use hooks or props, never direct fetch calls.

List and describe a model ​

BlockCode entryContract or artifactNeighbor handoff
ListModelService.modelsCatalog and derived model summaries with methods and sha256Verification uses method list
DescribeModelService.describeModelDescriptionOut with stable layer IDs, shapes, input bounds, and output constraintsAnalysis and workspace use IDs
SelectModelGraph.tsxLayer selection is presentation state, not ACT computationWorkspace owns global selection

Load and persist a source ​

BlockCode entryContract or artifactNeighbor handoff
Source requestLoadVnnlibRequest, LoadTorchRequestRelative VNN-LIB paths, classifier source, index or indices, epsBridge validates source availability
BuildModelService.loadContent addressed <kind>-<sha12> model and .meta.jsonDerived model can be used by verification
Repeat loadmodel_id from sha256Same content returns 200 and existing modelNo duplicate build is required

Render an input specification ​

BlockCode entryContract or artifactNeighbor handoff
DescriptionInputSpecOut, OutputSpecOutACT shape, bounds, center, dataset, constraint text, and true class; bounds and center are omitted above DISPLAY_VALUES (3x224x224) values per row, and the panel says soNo browser reinterpretation of constraints
Image viewInputDomain.tsxClean, bounds, heat map, and sampled display perturbationsSamples are visual only, not verification evidence
NavigationModelGraph.tsxStable layer IDWorkspace and analysis consume selection

Validation ​

Run the module's real ACT tests:

bash
.venv/bin/python -m pytest visual_bench/model_spec

Acceptance is observable when catalog models list their pinned sha256 and methods, a valid VNN-LIB or classifier source returns 201 then 200 for the same content, the model survives service restart, descriptions preserve ACT layer IDs and shapes, samples return the requested dataset row, a model the active engine cannot load is reported as load_failed and rebuilds from its recorded parameters, and invalid paths or sources return structured errors.

Run npm run gen:types after changing schemas.py, then npm run check:types. Do not hand edit visual_bench/generated/wire.ts. Do not claim tests were run unless the command and result are recorded.

Reference and Backlog ​

Current files, routes and contracts

Current Files and Contracts ​

LayerEntryContract or artifactOwner for handoff
Wireschemas.pyModel summaries, source requests, samples, layers, input and output specsgenerated/wire.ts is generated from Pydantic models
Serviceservice.pymodels, sources, sample, load, rebuild, describe; content addressed built models with built_with (ACT commit and source) and engine_checkEngine gate is engine.EngineService; ACT description is bridge owned
HTTProutes.py/api/models, /api/models/{id}, POST /api/models/{id}/rebuild, /api/sources, /api/sources/sampleVerification consumes model IDs and methods
Browser dataapi.ts, hooks.tsQueries for models, descriptions, sources, samples; load and rebuild invalidate the model listShared query keys own cache identity
ViewsLoadPanel.tsx, ModelList.tsx, ModelGraph.tsx, SpecPanel.tsx, InputDomain.tsx, RebuildNotice.tsxLoad, graph, spec, image-domain, and sample presentation; rebuild offer for a model the active engine cannot loadWorkspace owns selection and navigation
Teststest_model_spec.pyReal ACT loads, idempotency, persistence, descriptions, samples, engine-check and rebuild, structured errorsBridge loader tests cover ACT source adaptation
Task acceptance and planned capabilities

Tasks ​

The task IDs and dependencies remain stable. MSV-04 is the implemented loading slice and appears in the parent task index.

IDDeliverableDepends onCompletion evidence
MSV-01Deliver real description list/detail UIVER-01, WS-02A real sample shows correct layer shapes, tensor edges, and specification variables with loading/error states.
MSV-02Evaluate and wrap the network rendererMSV-01Show stable IDs, external selection, node callbacks, resize, worker/assets, and browser findings; document a fallback if the candidate fails.
MSV-03Validate specification draftsMSV-01, MSB-03Invalid variable mappings are explained; a valid change creates a new reference and cannot mutate an existing run.
MSV-04Load models from VNN-LIB and torch sourcesMSB-04, MSV-01LoadPanel.tsx in the sidebar: VNN-LIB tab (benchmark, instance) and Torch tab (classifier, test-image index with preview and label, eps slider, batch size with a per-image picker: a batch of several test images builds one net with a row per image (fuzzing and Verification; BaB needs one image), and the Specification panel shows it one row at a time). POST /api/models builds through the bridge and returns the content-addressed model (201 new, 200 existing); loaded models appear under "Loaded" with their parameters, and selecting one prefills the form so a new image/eps rebuilds a new snapshot. Flat VNN-LIB image vectors of known datasets are drawn as H x W x C (cora_2024 convention).
MSV-05Flag and rebuild models built on another ACT engineMSV-04, VER-08ModelService.load records built_with (commit, baseline or remote/branch) in .meta.json. ModelSummary.engine_check is same_commit when the active engine built it, otherwise the outcome of the first describe on the active commit (loads / load_failed) or unchecked; model files are never scanned eagerly (built models can be GBs). ModelList.tsx marks load_failed ("needs rebuild") and untried models from another commit; RebuildNotice.tsx replaces the load error with a button that calls POST /api/models/{id}/rebuild, which rebuilds the recorded source settings through load and selects the new model; the old model and its runs are kept. Evidence: test_model_spec.py::test_model_from_another_engine_is_flagged_when_it_fails_to_load_and_rebuilds.
MSV-06Load a batch of VNN-LIB properties on one networkMSB-05, MSV-04LoadVnnlibRequest.vnnlibs (distinct, starts with vnnlib, at most 64); the VNN-LIB tab has a batch size (capped at the network's property count) and a per-slot property picker restricted to the first slot's ONNX file, with the batch collapsed into chips. hooks.ts batchRows/useBatchRows label batch rows for every view (test image #i or property name): ModelList chip, Verification row verdicts, fuzzing Inputs table. Rebuild keeps the batch. visual_bench/fuzzing/test_fuzzing.py::test_vnnlib_properties_on_one_network_are_one_net_fuzzed_row_by_row.

MSV-02's renderer evaluation and MSV-03's editable draft validation are not current capabilities. Proposed ModelSpecView.tsx, view_model.ts, and network_renderer.ts are design references only. Keep unsupported specifications visible with their actual representation and reason.