Source-linked AI summary
SAMpLE: A SystemC-AMS Machine LEarning-based Framework for Virtual Prototyping
Andrei Mihai Albu, Sara Vinco
TL;DR
SAMpLE targets the lack of standardized ML integration in virtual-platform simulation. It provides native TDF integration with online C++ and offline ONNX backends, and experimentally supports parity, model interchangeability, and common simulation-based comparison.
Problem
SystemC-based virtual platforms lack a standardized native mechanism for integrating ML models, leading to fragmented approaches such as external runtimes, custom interfaces, and manual reimplementation.
Method
SAMpLE integrates ML inference and online learning as native TDF components through a unified IMLModel interface with native C++ and ONNX Runtime backends.
Results
SAMpLE reproduces Python predictions with virtually identical R2, RMSE, and MAE for offline models, with the largest discrepancy being ΔR2 = 0.003 for XGB on UCI.
Takeaways & Limitations
The unified framework enables heterogeneous models to be compared under identical SystemC-AMS scheduling, datasets, and metric pipelines.
Abstract
from arXiv · showhide
Machine Learning (ML) is increasingly used in virtual prototypes of embedded systems to model behaviors that are difficult to capture analytically. However, integrating ML models into virtual platform simulation is still typically done through ad hoc solutions, which limits reuse, comparability, and reproducibility. This paper presents \textbf{\textit{SAMpLE}}, an open-source SystemC-AMS-based framework that integrates ML models as first-class Timed Dataflow (TDF) components through a standardized plug-and-play interface. SAMpLE provides two execution backends: a native C++ backend for online training of lightweight models, and an offline backend for executing externally developed models without requiring re-implementation in C++ or manual integration steps. The framework uses ONNX as a standard model exchange format to enable integration of externally trained ML models into SystemC-AMS simulations, and allows the evaluation of different ML-based solutions within the same testbench, dataset, and simulation workflow. The modular design and unified and reproducible environment will allow future extensions of SAMpLE to new models, without modifying the SystemC-AMS structure.
I. INTRODUCTION
SAMpLE addresses fragmented ML integration in SystemC-based virtual prototyping by making models native TDF components with interchangeable online and offline execution paths.
- ML surrogates approximate embedded-system behaviors that are difficult to capture analytically while balancing accuracy, computational cost, and adaptability.
- SAMpLE enables ML models to execute as native TDF components, supporting online incremental learning or offline loading through ONNX.
- The framework uses a lightweight MLModule abstraction to decouple simulation behavior from inference execution.
- Its unified interface allows heterogeneous ML models to coexist under identical SystemC-AMS simulation conditions.
- SAMpLE combines native C++ implementations for lightweight online-adaptive models with ONNX-based deployment of models trained in heterogeneous frameworks.
II. BACKGROUND AND RELATED WORKS
SystemC provides a common system-level modeling environment, while SystemC-AMS extends it for mixed-signal and dataflow-oriented virtual-platform simulations.
- SystemC is a C++-based framework for modeling and simulating complex embedded and heterogeneous systems.
- SystemC-AMS adds Models of Computation suited to analogue and dataflow-oriented simulations in multi-domain virtual platforms.
- TDF represents systems as interconnected processing blocks that periodically consume and produce samples under statically scheduled execution semantics.
B. ONNX
ONNX provides a platform-independent model representation, while existing SystemC-based ML integration approaches remain diverse and can introduce coupling or synchronization overhead.
- ONNX is an open standard that represents ML models in a platform-independent format for interoperability across frameworks, inference engines, and hardware platforms.
- SAMpLE executes ONNX models with ONNX Runtime, bridging exported model graphs and deterministic inference within the SystemC-AMS TDF flow.
- SystemC-based environments are used for virtual prototyping and AI-accelerator design-space exploration, but lack standardized native ML components.
- Existing strategies include FMI-based co-simulation and manual C++ reimplementation, with co-simulation introducing synchronization overhead.
III. METHODOLOGY
SAMpLE uses configuration-driven preprocessing and a unified IMLModel interface to support offline or online model execution within identical TDF simulation semantics.
- SAMpLE is an open-source methodology for integrating ML models into SystemC-AMS virtual-platform design evaluation.
- The workflow is driven by a CSV behavior dataset and config.json, which serves as the single source of truth for subsequent stages.
- Offline models are trained externally and imported through ONNX Runtime, whereas online models train during framework initialization.
- A single IMLModel interface exposes both execution paths so the TDF scheduler interacts with every model family identically.
- Preprocessing includes ingestion, cleaning, feature engineering, statistical analysis, serialization, and chronology-preserving dataset partitioning.
C. Training Phase
SAMpLE supports offline and online training paths through a shared preprocessing pipeline and simulation interface. Online training uses a unified predictor abstraction with configurable model types and incremental adaptation.
- SAMpLE offers offline training with user-defined workflows and online training managed within the framework through a few user-defined parameters.
- Online model construction and parameter initialization occur automatically at simulation start-up, removing the need for a separate training phase.
- Predefined training strategies reduce manual intervention and accelerate design-space exploration, although they may not match extensively optimized offline accuracy.
- IMLModel separates feature ingestion, prediction, and adaptation logic through a unified predictor abstraction.
- The predictor interface includes window sizing, sliding-window prediction, incremental updates against ground truth, and runtime training-support reporting.
- Supported online approaches include adaptive linear, ensemble-based, regime-switching, and nonlinear models, with model type and parameters selected in the initial configuration.
2) Offline training:
The offline path fits models outside SAMpLE and imports them through ONNX, allowing existing machine-learning assets to run in simulation without reimplementation. Validation checks help ensure deployment consistency with the training environment.
- Offline model fitting uses arbitrary external machine-learning workflows and supports both custom training and direct import of previously trained models.
- ONNX provides a common model representation, while serialized normalization and scaling parameters form a self-contained deployment artifact.
- The model loads at simulation initialization and undergoes static input-shape and dry-run inference validation.
- These validation guards reproduce the Python training environment without embedding an interpreter or requiring inter-process communication.
D. Simulation Semantics
SAMpLE embeds model construction, deployment, and inference within standard TDF execution semantics. Its fixed primitive interface supports warmup, validation, backend interchangeability, and comparable model evaluation under shared simulation conditions.
- Fixed-interval ML inference maps naturally to causal, periodically scheduled TDF processing without auxiliary co-simulation layers.
- SAMpLE preserves TDF semantics while supporting multiple machine-learning backends with deterministic, reproducible, and portable execution.
- The primitive receives features, emits predictions, signals readiness after warmup, and optionally accepts ground truth and validity signals.
- The module follows the TDF lifecycle by loading configuration during setup, instantiating the backend during initialization, and running inference at activation steps.
- Optional ground-truth evaluation accumulates error statistics and reports regression metrics while flagging predictions that violate configured acceptance criteria.
- A common interface makes externally exported models and native online predictors interchangeable for comparisons using the same testbench, dataset split, and metric code.
E. Toward a standardised SystemC-AMS primitive
SAMpLE’s integration patterns motivate a standardized SystemC-AMS primitive for hosting ML surrogates. The proposed contract supplies model interaction capabilities absent from the current standard.
- The SystemC-AMS standard currently provides no mechanism to host ML surrogates, despite their routine use in production virtual platforms.
- SAMpLE’s IMLModel contract combines windowed input, fixed-size prediction output, optional ground-truth updates, and a readiness flag.
IV. EXPERIMENTAL EVALUATION
The evaluation tests SAMpLE’s fidelity, heterogeneity, and portability across models and datasets, emphasizing interoperability rather than individual model optimization.
- Evaluation goals: The evaluation asks whether ONNX-exported models preserve Python behavior, diverse models share one interface, and datasets transfer without simulator-source changes.The study assesses framework generality and interoperability rather than tuning individual ML models.
- Datasets: Two datasets capture distinct temporal regimes: noisy occupancy-driven UCI Appliances and smooth periodic Tetuan City electricity demand.UCI contains 19,735 samples and Tetuan City contains 52,416 samples, both sampled every 10 minutes.
- Models: Offline experiments support ARX Ridge, Random Forest, and XGBoost models trained through heterogeneous ML workflows.ARX Ridge uses ridge-regularized least squares, while Random Forest and XGBoost use tree ensembles.
- Reproducibility: All experiments run on Ubuntu 22.04 with an Intel Core i7-10700 and 16 GB RAM, alongside released artifacts for reproducibility.Released artifacts include configurations, datasets, models, predictions, and metric reports.
- Metrics: Experiments report wall-clock simulation time, R2, RMSE, and MAE using dataset-specific energy units.RMSE and MAE are expressed in Wh for UCI and W for Tetuan.
B. Results and Discussion
SAMpLE preserves offline prediction fidelity and lets heterogeneous online and offline models run under shared SystemC-AMS conditions. Results also show that adaptive online learners are especially valuable for non-stationary workloads, while offline and online methods converge on smooth demand.
- Fidelity: The largest offline discrepancy is ΔR2 = 0.003 for XGB on UCI, while all offline runs complete in under 1.5s.ARX, XGB, and RF predictions are virtually identical to Python baselines across both datasets.
- Heterogeneity and portability: Three offline and eight online backends execute within one simulation structure, with model switching requiring no manual code modification.Offline models are selected through config.json, while online models use compile-time IMLModel dispatch.
- Heterogeneity and portability: Across datasets, changing from UCI to Tetuan requires only replacing the input CSV and feature schema, without changing C++ code, SystemC modules, or build configuration.The evaluation attributes differing predictive behavior to workload complexity rather than implementation error.
- UCI results: Offline models on UCI reach R2 ∈[0.13, 0.28], whereas Hedge Ensemble reaches R2 = 0.879 through per-sample adaptation.The adaptive online result is reported as more than a threefold improvement over the best offline baseline.
- Tetuan results: On Tetuan, NLMS-ARX reaches R2 = 0.9961 versus 0.986 for offline ARX, while online runtime ranges from 9ms to 3.6s.NLMS-ARX completes inference in 48ms end-to-end, whereas the offline pipeline includes 0.6s of Python training plus 0.343s of simulation and export overhead.
V. CONCLUSION
SAMpLE provides an open-source native TDF framework for integrating and comparing ML inference and online learning under common SystemC-AMS conditions. Future work targets broader ensembles, uncertainty-aware interfaces, and larger virtual platforms.
- Conclusion: SAMpLE integrates ML inference and online learning as native SystemC-AMS TDF components, removing the ad-hoc integration layer.The framework is presented as open source.
- Conclusion: The unified IMLModel abstraction enables heterogeneous model families to be compared under identical scheduling, dataset partitions, and metric pipelines.The conclusion reports close agreement between SAMpLE predictions and Python-based evaluations with minor cross-environment discrepancies.
- Future work: Future work will extend SAMpLE with heterogeneous ensembles, confidence-aware TDF interfaces, and validation on larger virtual platforms.These extensions target uncertainty-aware inference and design-space exploration.