---
title: "Training a Model"
description: "Understand where model training fits in the Koios workflow and what you need before deploying a model"
source_url: https://ai-ops.com/docs/models/training-a-model
---

# Training a Model

Koios is an **inference engine**, not a training platform. Its job is to take a model you have already trained and run it continuously against live data from your plant, factory, or building — reading sensor values, making predictions, and writing outputs back to control systems in real time.

**Training happens externally.** You train your model in whatever environment suits your workflow — Python scripts, Jupyter notebooks, cloud ML platforms, or dedicated training infrastructure. Once you have a trained model, you export it as an ONNX or TFLite file and upload it to Koios.

## What Koios Does

| Koios handles | You handle externally |
|---------------|----------------------|
| Connecting to PLCs, controllers, and sensors | Collecting and curating training datasets |
| Reading live tag values at scan rate | Feature engineering and model architecture |
| Normalizing inputs to match your training pipeline | Training, validation, and hyperparameter tuning |
| Running inference (ONNX Runtime / TFLite) | Exporting to `.onnx` or `.tflite` |
| Denormalizing and writing predictions to outputs | Evaluating model accuracy and retraining |
| Monitoring model health, uptime, and performance | |

## Collecting Training Data with Koios

While Koios does not train models, it can serve as a **data historian** — collecting and storing high-resolution time-series data from your devices that you can then use for training. This is particularly useful if you don't have an existing historian, or if your current historian doesn't provide the resolution you need.

Koios records tag values to its time-series database at your configured scan rate, and you can [export that data](https://ai-ops.com/docs/trends/settings-and-export.md#exporting-data) as CSV, JSON, or Parquet from any trend. For long-term data collection, review the [Data Retention](https://ai-ops.com/docs/system/retention.md) settings to ensure your retention and compression policies preserve the resolution your training pipeline requires.

## Typical Workflow

```text
  Your Environment                          Koios
  ──────────────                            ─────
  1. Collect historical data       ───►  (Koios can serve as your historian)
  2. Export data for training       ◄───  (Export from Trends as CSV/JSON/Parquet)
  3. Train model (PyTorch, TF, sklearn...)
  4. Export to .onnx or .tflite    ───►  5. Upload model file
                                         6. Assign bindings to tags
                                         7. Configure normalization
                                         8. Enable — inference runs continuously
                                         9. Monitor predictions & retrain as needed
```

## Preparing Your Model for Koios

Your exported model must meet specific tensor shape and format requirements. The key points:

- **Input shape:**
  - `[1, num_inputs]` — flat models that read the *current* sensor snapshot (RL policies, regressors, classifiers)
  - `[1, input_depth, num_inputs]` — time-series models that consume a window of recent history (forecasters, LSTMs, etc.)
- **Output shape:** `[1, num_outputs]` for single-step predictions, or `[1, output_depth, num_outputs]` for multi-step forecasts
- **Data type:** float32
- **Formats:** ONNX (`.onnx`) or TensorFlow Lite (`.tflite`)

See [Model Inference Requirements](https://ai-ops.com/docs/models/inference-requirements.md) for the full specification, including tensor layout, interpolation behavior, and normalization details.

> [!TIP] Test before uploading
> Run a quick inference locally with a dummy input of the expected shape before uploading to Koios. This catches shape mismatches and export issues early.

> [!WARNING] Export to a supported ONNX version
> Koios loads ONNX files up to **IR version 13**. Very recent export toolchains can target a higher IR version, which Koios rejects at upload. Export at IR 13 or lower, or annotate the model with the Koios model-utils library — it clamps the IR version to a safe value for you. TFLite files are unaffected.

## Normalization Must Match Training

The normalization you configure in Koios (on each binding) must match what was used during training. If your training pipeline scaled inputs with min-max normalization using specific bounds, configure the same type and bounds in Koios. A mismatch means the model receives inputs in a different range than it was trained on, producing meaningless predictions.

See [AI Models — Normalization](https://ai-ops.com/docs/models/introduction.md#3-normalization) for the available normalization types and sources.

## Retraining and Updating

When you retrain a model, export a new file and upload it as a new version on the [Files](https://ai-ops.com/docs/models/model-files.md) tab. Koios supports multiple file versions per model — you can switch between them without reconfiguring bindings (as long as the input/output count stays the same). This makes A/B testing straightforward: upload the new version, activate it, monitor performance, and roll back if needed.

> [!NOTE] Embedded metadata for automation
> ONNX files can include Koios-specific metadata that auto-configures normalization, sample rate, and binding names on upload. This reduces manual setup when deploying from a training pipeline. See [Embedded Metadata](https://ai-ops.com/docs/models/model-files.md#embedded-metadata).

## Need Help with Training?

If you need a bespoke model trained for your specific process or application, **Ai-Ops can help**. Our team can work with your data to develop, validate, and deploy custom models tailored to your site. Contact us at [support@ai-ops.com](mailto:support@ai-ops.com) for a quote.

> [!NOTE] Ronin — Ai-Ops training platform
> **Ronin**, our dedicated model training platform, is currently in beta development. Ronin will provide an integrated workflow for building and deploying models directly to Koios. Stay tuned for updates.
