Recipe Graph Editor
Relevant source files
The following files were used as context for generating this wiki page:
The Recipe Graph Editor is the primary visual interface in Olive Studio for designing and configuring model optimization pipelines. It allows users to manage a sequence of "passes"—such as conversion, quantization, and pruning—to transform an input model into an optimized version for specific hardware targets. The editor provides an interactive visualization of the workflow, ensuring that the strict ordering and execution provider constraints required by Microsoft Olive are met.
Sources: ABOUT.md, src/components/features/recipe-graph/RecipeGraphView.tsx:1-10
Architecture and Components
The editor is integrated within the ExecutionWorkspace and is composed of several high-level functional parts that manage state, layout, and user interaction.
Core Layout Components
- RecipeGraphView: The top-level container that manages the synchronization between the global application state and the graph's visual representation.
- GraphCanvas: A specialized canvas component (rendered within
RecipeGraphView) that draws the visual nodes and connections of the pipeline. - StepInspector: A detail panel that allows for the fine-tuning of individual pass parameters when a specific node in the graph is selected.
Sources: src/components/features/recipe-graph/RecipeGraphView.tsx:13-33, src/components/features/ExecutionWorkspace.tsx:640-650
Logic and Data Flow
The Editor utilizes the UIState to determine which passes are active and how they should be visually arranged. It employs helper functions like buildPipelineSteps to transform raw pass configuration into a structured set of graph steps.
This diagram shows the unidirectional flow of state into the graph layout logic and the interactive feedback loop between the inspector and the application state.
Sources: src/components/features/recipe-graph/RecipeGraphView.tsx:17-19, src/components/features/ExecutionWorkspace.tsx:50-70
Pipeline Validation and Schema
A critical function of the Recipe Graph Editor is ensuring that the visually constructed pipeline is valid according to the Microsoft Olive schema. Validation occurs at multiple layers, including structural integrity and hardware compatibility.
Structural Validation
The validateOliveRecipeStructure function checks that the recipe includes mandatory top-level keys and valid internal configurations.
| Validation Level | Description | Key Requirements |
|---|---|---|
| Top Level | Validates presence of main blocks. | input_model, systems, passes, engine. |
| Input Model | Checks model source configuration. | Must have type and config object. |
| Passes | Validates individual optimization steps. | Each pass must have a type known to Olive. |
| Systems | Validates target infrastructure. | Must include accelerators and execution_providers. |
Sources: src/lib/oliveRecipeSchema.ts:25-78, src/lib/recipePipeline.ts:130-150
Hardware Compatibility
The editor integrates results from a hardware probe to ensure that selected passes and execution providers (EPs) can run on the host machine. For instance, NvTensorRTRTXExecutionProvider is verified for consumer RTX GPUs, while OpenVINOExecutionProvider is checked for Intel hardware.
Sources: src/components/features/InputEnvironmentPanel.tsx:127-145, src/components/features/ExecutionWorkspace.tsx:440-460
Optimization Passes and Target Hardware
The editor allows users to toggle and configure various optimization passes. The availability and parameters of these passes often depend on the selected Execution Provider (EP).
Available Passes
- Graph Conversion: PyTorch to ONNX or OpenVINO IR.
- Quantization: PTQ, AWQ, and precision settings (INT8/INT4/FP16).
- Pruning: Structured or unstructured (SparseGPT, Wanda).
- PEFT: LoRA/QLoRA adapters.
Supported Execution Providers
The editor supports a range of vendors and hardware targets:
CPUExecutionProviderCUDAExecutionProviderTensorrtExecutionProviderOpenVINOExecutionProviderQNNExecutionProvider
Sources: ABOUT.md, src/components/features/ExecutionWorkspace.tsx:150-180, src/lib/oliveRecipeSchema.ts:100-115
Recipe Export and Deployment
Once a recipe is designed in the Graph Editor, the system provides several export options for local execution or edge deployment.
This sequence illustrates the process of generating a finalized Olive recipe from the visual state maintained by the editor.
Sources: src/components/features/ExecutionWorkspace.tsx:490-515, src/lib/recipePipeline.ts:10-30
Export Types
- Standard JSON: For use with the Olive CLI (
olive run --config). - OWR Bundle: Includes optimized model manifests and initialization code for ONNX Runtime Web or Mobile.
Sources: src/components/features/ExecutionWorkspace.tsx:85-110, src/components/features/ExecutionWorkspace.tsx:517-535
Summary
The Recipe Graph Editor acts as a bridge between high-level user intent and the complex, technical requirements of Microsoft Olive optimization. By combining visual layout, real-time validation against the Olive schema, and hardware-aware configuration, it enables developers to author robust optimization pipelines without manual JSON editing. The system ensures that every change made in the visual editor results in a valid, executable recipe ready for deployment across diverse hardware ecosystems.
Sources: ABOUT.md, src/components/features/recipe-graph/RecipeGraphView.tsx:40-52