Skip to content

Commit c7ea13e

Browse files
committed
update ainode in tree model
1 parent 54c5b17 commit c7ea13e

8 files changed

Lines changed: 404 additions & 340 deletions

File tree

src/UserGuide/Master/Tree/AI-capability/AINode_apache.md

Lines changed: 65 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,24 @@
2121

2222
# AINode
2323

24-
AINode is an IoTDB native node designed to support the registration, management, and invocation of large-scale time series models. It comes with industry-leading proprietary time series models such as Timer and Sundial. These models can be invoked through standard SQL statements, enabling real-time inference of time series data at the millisecond level, and supporting application scenarios such as trend forecasting, missing value imputation, and anomaly detection for time series data.
24+
AINode is a native IoTDB node that supports the registration, management, and invocation of time-series-related models. It comes with built-in industry-leading self-developed time-series large models, such as the Timer series developed by Tsinghua University. These models can be invoked through standard SQL statements, enabling real-time inference of time series data at the millisecond level, and supporting application scenarios such as trend forecasting, missing value imputation, and anomaly detection for time series data.
2525

2626
The system architecture is shown below:
2727
::: center
28-
<img src="/img/AInode.png" style="zoom:50 percent" />
29-
:::
28+
<img src="/img/AINode-0-en.png" style="zoom:50 percent" />
29+
:::
30+
3031
The responsibilities of the three nodes are as follows:
3132

32-
- **ConfigNode**: responsible for storing and managing the meta-information of the model; responsible for distributed node management.
33-
- **DataNode**: responsible for receiving and parsing SQL requests from users; responsible for storing time-series data; responsible for preprocessing computation of data.
34-
- **AINode**: responsible for model file import creation and model inference.
33+
- **ConfigNode:**
34+
- Manages distributed nodes and handles load balancing across the system.
35+
- **DataNode:**
36+
- Receives and parses user SQL queries.
37+
- Stores time-series data.
38+
- Performs preprocessing computations on raw data.
39+
- **AINode:**
40+
- Manages and utilizes time-series models (including training/inference).
41+
- Supports deep learning and machine learning workflows.
3542

3643
## 1. Advantageous features
3744

@@ -58,12 +65,12 @@ Compared with building a machine learning service alone, it has the following ad
5865
- **Built-in capabilities**: AINode comes with machine learning algorithms or home-grown models for common timing analysis scenarios (e.g., prediction and anomaly detection).
5966

6067
::: center
61-
<img src="/img/AInode2.png" style="zoom:50%" />
68+
<img src="/img/AINode-en.png" style="zoom:50%" />
6269
::::
6370

6471
## 3. Installation and Deployment
6572

66-
The deployment of AINode can be found in the document [Deployment Guidelines](../Deployment-and-Maintenance/AINode_Deployment_apache.md#ainode-deployment) .
73+
The deployment of AINode can be found in the document [AINode Deployment](../Deployment-and-Maintenance/AINode_Deployment_apache.md).
6774

6875

6976
## 4. Usage Guidelines
@@ -84,12 +91,12 @@ Models that meet the following criteria can be registered with AINode:
8491
The SQL syntax for model registration is defined as follows:
8592

8693
```SQL
87-
create model <model_name> using uri <uri>
94+
create model <model_id> using uri <uri>
8895
```
8996

9097
Detailed meanings of SQL parameters:
9198

92-
- **model_name**: The global unique identifier for the model, non-repeating. Model names have the following constraints:
99+
- **model_id**: The global unique identifier for the model, non-repeating. Model names have the following constraints:
93100
- Allowed characters: [0-9 a-z A-Z _] (letters, numbers, underscores)
94101
- Length: 2-64 characters
95102
- Case-sensitive
@@ -121,7 +128,7 @@ In addition to registering local model files, remote resource paths can be speci
121128

122129
#### Example
123130

124-
The current example folder contains model.pt (trained model) and config.yaml with the following content:
131+
The [example folder](https://github.com/apache/iotdb/tree/master/integration-test/src/test/resources/ainode-example) contains model.pt (trained model) and config.yaml with the following content:
125132

126133
```YAML
127134
configs:
@@ -144,12 +151,6 @@ Register the model by specifying this folder as the loading path:
144151
IoTDB> create model dlinear_example using uri "file://./example"
145152
```
146153

147-
Models can also be downloaded from HuggingFace for registration:
148-
149-
```SQL
150-
IoTDB> create model dlinear_example using uri "https://huggingface.co/google/timesfm-2.0-500m-pytorch"
151-
```
152-
153154
After SQL execution, registration proceeds asynchronously. The registration status can be checked via model display (see Model Display section). The registration success time mainly depends on the model file size.
154155

155156
Once registered, the model can be invoked for inference through normal query syntax.
@@ -161,42 +162,58 @@ Successfully registered models can be queried for model-specific information thr
161162
```SQL
162163
show models
163164

164-
show models <model_name>
165+
show models <model_id>
165166
```
166167

167168
In addition to displaying all models, specifying a `model_id` shows details of a specific model. The display includes:
168169

169-
| **ModelId** | **State** | **Configs** | **Attributes** |
170-
| ----------- | --------------------------------------------------------- | ------------------------------------------------ | -------------- |
171-
| Unique ID | Registration status (INACTIVE, LOADING, ACTIVE, DROPPING) | InputShape, outputShape, inputTypes, outputTypes | User notes |
170+
| **ModelId** | **ModelType** | **Category** | **State** |
171+
|-------------|---------------|----------------|-------------|
172+
| Model ID | Model Type | Model Category | Model State |
172173

173-
**State descriptions:**
174+
- Model State Transition Diagram
174175

175-
- **INACTIVE**: Model is unavailable.
176-
- **LOADING**: Model is being loaded.
177-
- **ACTIVE**: Model is available.
178-
- **DROPPING**: Model is being deleted.
176+
![](/img/AINode-State-en.png)
179177

180-
#### Example
178+
**Instructions:**
179+
180+
1. Initialization:
181+
- When AINode starts, show models only displays BUILT-IN models.
182+
2. Custom Model Import:
183+
- Users can import custom models (marked as USER-DEFINED).
184+
- The system attempts to parse the ModelTypefrom the config file.
185+
- If parsing fails, the field remains empty.
186+
3. Foundation Model Weights:
187+
- Time-series foundation model weights are not bundled with AINode.
188+
- AINode automatically downloads them during startup.
189+
- Download state: LOADING.
190+
4. Download Outcomes:
191+
- Success → State changes to ACTIVE.
192+
- Failure → State changes to INACTIVE.
193+
5. Fine-Tuning Process:
194+
- When fine-tuning starts: State becomes TRAINING.
195+
- Successful training → State transitions to ACTIVE.
196+
- Training failure → State changes to FAILED.
197+
198+
**Example**
181199

182200
```SQL
183201
IoTDB> show models
184-
185-
+---------------------+--------------------+--------+--------+
186-
| ModelId| ModelType|Category| State|
187-
+---------------------+--------------------+--------+--------+
188-
| arima| Arima|BUILT-IN| ACTIVE|
189-
| holtwinters| HoltWinters|BUILT-IN| ACTIVE|
190-
|exponential_smoothing|ExponentialSmoothing|BUILT-IN| ACTIVE|
191-
| naive_forecaster| NaiveForecaster|BUILT-IN| ACTIVE|
192-
| stl_forecaster| StlForecaster|BUILT-IN| ACTIVE|
193-
| gaussian_hmm| GaussianHmm|BUILT-IN| ACTIVE|
194-
| gmm_hmm| GmmHmm|BUILT-IN| ACTIVE|
195-
| stray| Stray|BUILT-IN| ACTIVE|
196-
| timer_xl| Timer-XL|BUILT-IN| ACTIVE|
197-
| sundial| Timer-Sundial|BUILT-IN| ACTIVE|
198-
+---------------------+--------------------+--------+--------+
202+
+---------------------+--------------------+--------------+---------+
203+
| ModelId| ModelType| Category| State|
204+
+---------------------+--------------------+--------------+---------+
205+
| arima| arima| BUILT-IN| ACTIVE|
206+
| custom| | USER-DEFINED| ACTIVE|
207+
| timerxl| timer-xl| BUILT-IN| LOADING|
208+
| sundial| timer-sundial| BUILT-IN| ACTIVE|
209+
| sundialx_1| timer-sundial| FINE-TUNED| ACTIVE|
210+
| sundialx_2| timer-sundial| FINE-TUNED| ACTIVE|
211+
| sundialx| timer-sundial| FINE-TUNED| ACTIVE|
212+
| sundialx_4| timer-sundial| FINE-TUNED| TRAINING|
213+
| sundialx_5| timer-sundial| FINE-TUNED| FAILED|
214+
+---------------------+--------------------+--------------+---------+
199215
```
216+
200217
### 4.3 Deleting Models
201218

202219
Registered models can be deleted via SQL, which removes all related files under AINode:
@@ -248,7 +265,7 @@ The following machine learning models are currently built-in, please refer to th
248265

249266
After completing the registration of the model, the inference function can be used by calling the inference function through the call keyword, and its corresponding parameters are described as follows:
250267

251-
- **model_name**: corresponds to a registered model
268+
- **model_id**: corresponds to a registered model
252269
- **sql**: sql query statement, the result of the query is used as input to the model for model inference. The dimensions of the rows and columns in the result of the query need to match the size specified in the specific model config. (It is not recommended to use the `SELECT *` clause for the sql here because in IoTDB, `*` does not sort the columns, so the order of the columns is undefined, you can use `SELECT s0,s1` to ensure that the columns order matches the expectations of the model input)
253270
- **window_function**: Window functions that can be used in the inference process, there are currently three types of window functions provided to assist in model inference:
254271
- **head(window_size)**: Get the top window_size points in the data for model inference, this window can be used for data cropping.
@@ -392,6 +409,11 @@ Total line number = 4
392409
393410
In the result set, each row's label corresponds to the output of the anomaly detection model after inputting each group of 24 rows of data.
394411
412+
413+
### 4.5 Time Series Large Model Import Steps
414+
415+
AINode supports multiple time series large models. For deployment, refer to [Time Series Large Model](../AI-capability/TimeSeries-Large-Model.md)
416+
395417
## 5. Privilege Management
396418
397419
When using AINode related functions, the authentication of IoTDB itself can be used to do a permission management, users can only use the model management related functions when they have the USE_MODEL permission. When using the inference function, the user needs to have the permission to access the source sequence corresponding to the SQL of the input model.

0 commit comments

Comments
 (0)