Skip to content

Commit ea227e2

Browse files
authored
Feature/tesseract anomaly detection (#403)
* uploading tesseract files Signed-off-by: vmodak <vmodak@nvidia.com> * Uploading remaining files for NV-Tesseract Capability Signed-off-by: vmodak <vmodak@nvidia.com> * Consolidate config files: NV-Tesseract as default with MOMENT alternative - Merged config-reasoning.yaml and config-reasoning-tesseract.yaml into single config - Set NV-Tesseract as default anomaly detection tool - Added clear comments for switching between NV-Tesseract and MOMENT - Updated README to integrate Tesseract documentation into main flow - Added fine-tuning roadmap note for NV-Tesseract - Updated anomaly detection example output to show Tesseract results - Tested both configurations successfully (both detect 12 anomalies at 5.19%) - Evaluation tests pass with perfect 1.0 score (4/4 test cases) Signed-off-by: vmodak <vmodak@nvidia.com> --------- Signed-off-by: vmodak <vmodak@nvidia.com>
1 parent f7911f3 commit ea227e2

6 files changed

Lines changed: 381 additions & 8 deletions

File tree

‎industries/asset_lifecycle_management_agent/README.md‎

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Multi-agent architecture designed for Asset Lifecycle Management with specialize
2222
- **ReAct Agent Workflow**: Main orchestration using ReAct pattern for intelligent decision-making
2323
- **SQL Retriever Tool**: Generates SQL queries using NIM LLM for asset data retrieval
2424
- **RUL Prediction Tool**: XGBoost model for remaining useful life prediction to optimize maintenance scheduling
25-
- **Anomaly Detection Tool**: Detects anomalies in sensor data using time series foundational model for early failure detection
25+
- **Anomaly Detection Tool**: Detects anomalies in sensor data using NV-Tesseract foundation model (NVIDIA NIM) for early failure detection, with MOMENT as an alternative
2626
- **Plotting Agents**: Multi-tool agent for data visualization and asset performance reporting
2727
- **Vector Database**: ChromaDB for storing table schema, Vanna training queries, and asset documentation
2828

@@ -554,13 +554,45 @@ Retrieve real RUL of each unit in the FD001 test dataset. Then plot a distributi
554554
![Visualization Example](imgs/test_prompt_2.png)
555555
556556
557-
**Anomaly Detection**
557+
**Anomaly Detection with NV-Tesseract**
558+
559+
The workflow uses [NV-Tesseract](https://developer.nvidia.com/blog/advancing-anomaly-detection-for-industry-applications-with-nvidia-nv-tesseract-ad/), NVIDIA's foundation model for time-series anomaly detection, as the default anomaly detection engine. NV-Tesseract is a foundational model where accuracy is highly data-dependent. However, the objective here is to demonstrate integration functionality. Its performance can be significantly improved through fine-tuning on domain-specific data—a capability currently on NVIDIA's NV-Tesseract roadmap.
560+
558561
```
559562
Retrieve and detect anomalies in sensor 4 measurements for engine number 78 in train FD001 dataset.
560563
```
561564
565+
**Sample Output:**
566+
```
567+
NV TESSERACT NIM ANOMALY DETECTION COMPLETED SUCCESSFULLY
568+
569+
Analysis Details:
570+
• Engine Unit: 78
571+
• Sensor Analyzed: sensor_measurement_4
572+
• Model: NV Tesseract (NVIDIA Foundation Model)
573+
574+
Anomaly Detection Results:
575+
• Total Timesteps Analyzed: 231
576+
• Anomalous Timesteps Detected: 12
577+
• Anomaly Rate: 5.19%
578+
579+
Output Files Generated:
580+
• Enhanced Data with is_anomaly Column: retrieve_sensor_measurement_4__results.json
581+
• Interactive HTML plot: anomaly_plot_sensor_measurement_4_engine78.html
582+
• Static PNG image: anomaly_plot_sensor_measurement_4_engine78.png
583+
```
584+
562585
![Anomaly Detection Example](imgs/test_prompt_4.png)
563586
587+
**Switching to MOMENT Foundation Model:**
588+
589+
To use the MOMENT foundation model instead of NV-Tesseract, edit `configs/config-reasoning.yaml`:
590+
1. Comment out the `nv_tesseract_anomaly_detection_tool` configuration
591+
2. Uncomment the `moment_anomaly_detection_tool` configuration
592+
3. Restart the workflow server
593+
594+
Both models provide state-of-the-art anomaly detection capabilities for time-series data.
595+
564596
**Workspace Utilities Demo**
565597
```
566598
Retrieve RUL values and time in cycles for engine unit 24 from FD001 train dataset. Use the piece wise RUL transformation code utility to perform piecewise RUL transformation on the ground truth RUL values with MAXLIFE=100.Finally, Plot a comparison line chart with RUL values and its transformed values across time.
@@ -581,6 +613,46 @@ Perform the following steps:
581613
582614
*Note: This example automatically uses the workspace `apply_piecewise_rul_transformation` utility to create realistic knee-pattern RUL data for comparison, resulting in much cleaner and more meaningful visualizations.*
583615
616+
## Deploying NV-Tesseract NIM (Required for Anomaly Detection)
617+
618+
Since NV-Tesseract is the default anomaly detection engine, you'll need to deploy the NV-Tesseract NIM container for anomaly detection capabilities.
619+
620+
**Note:** Access to the NV-Tesseract NIM container requires approval. Contact your NVIDIA representative or request access through the [NVIDIA NGC Catalog](https://catalog.ngc.nvidia.com/).
621+
622+
### Prerequisites
623+
- NVIDIA GPU (A100, H100, or L40S recommended)
624+
- Docker with NVIDIA Container Runtime
625+
- NGC API key with NV-Tesseract access
626+
627+
### Deploy NV-Tesseract NIM
628+
629+
Set your NGC API key:
630+
```bash
631+
export NGC_API_KEY='your-ngc-api-key'
632+
```
633+
634+
Deploy the NV-Tesseract NIM container:
635+
```bash
636+
docker run -d \
637+
--name nv-tesseract-nim \
638+
--gpus '"device=1"' \
639+
-p 8001:8000 \
640+
-e NGC_API_KEY=$NGC_API_KEY \
641+
--restart unless-stopped \
642+
nvcr.io/nim/nvidia/nv-tesseract:2.0.0
643+
```
644+
645+
Verify the deployment:
646+
```bash
647+
# Check container logs
648+
docker logs -f nv-tesseract-nim
649+
650+
# Health check
651+
curl http://localhost:8001/v1/health/ready
652+
```
653+
654+
**Note:** If you prefer to use the MOMENT foundation model instead (which doesn't require a NIM deployment), follow the instructions in the "Switching to MOMENT Foundation Model" section under Anomaly Detection above.
655+
584656
## Observability (Optional)
585657
586658
### Monitor Your System with Phoenix

‎industries/asset_lifecycle_management_agent/configs/config-reasoning.yaml‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ llms:
4444
# Data analysis and tool calling model
4545
analyst_llm:
4646
_type: nim
47-
model_name: "qwen/qwen2.5-coder-32b-instruct"
47+
model_name: "qwen/qwen3-coder-480b-a35b-instruct"
4848

4949
# Python code generation model
5050
coding_llm:
@@ -88,9 +88,19 @@ functions:
8888
scaler_path: "models/scaler_model.pkl"
8989
model_path: "models/xgb_model_fd001.pkl"
9090

91+
# Anomaly Detection Tool Configuration
92+
# Default: NV-Tesseract (NVIDIA Foundation Model via NIM)
9193
anomaly_detection:
92-
_type: moment_anomaly_detection_tool
94+
_type: nv_tesseract_anomaly_detection_tool
95+
nim_endpoint: "http://localhost:8001"
96+
timeout: 120
9397
output_folder: "output_data"
98+
# custom_threshold: 3.0 # Optional: Lower threshold to catch gradual degradation (default: None for NIM auto-threshold)
99+
100+
# Alternative: MOMENT Foundation Model (Comment out NV-Tesseract above and uncomment below to use MOMENT)
101+
# anomaly_detection:
102+
# _type: moment_anomaly_detection_tool
103+
# output_folder: "output_data"
94104

95105
plot_distribution:
96106
_type: plot_distribution_tool
@@ -158,7 +168,7 @@ functions:
158168
Executing step: the step you are currently executing from the plan along with any instructions provided
159169
Thought: describe how you are going to execute the step
160170
Final Answer: the final answer to the original input question including the absolute file paths of the generated files with
161-
`/Users/vikalluru/Documents/GenerativeAIExamples/industries/asset_lifecycle_management_agent/output_data/` prepended to the filename.
171+
`./output_data/` prepended to the filename.
162172
163173
**FORMAT 3 (when using a tool)**
164174
Input plan: Summarize all the steps in the plan.
@@ -170,6 +180,7 @@ functions:
170180
171181
### HOW TO CHOOSE THE RIGHT TOOL ###
172182
Follow these guidelines while deciding the right tool to use:
183+
**CRITICAL: When writing Action: tool_name, use PLAIN TEXT ONLY. Do NOT use markdown formatting like **tool_name**. Just write the tool name directly.**
173184
**Ensure that tool calls do not use single quotes or double quotes within the key-value pairs.**
174185
175186
1. **SQL Retrieval Tool**
@@ -186,7 +197,7 @@ functions:
186197
- plot_comparison: to compare two columns of a dataset by plotting both of them on the same chart.
187198
188199
4. **Anomaly Detection Tools**
189-
- Use anomaly_detection tool for state-of-the-art foundation model-based anomaly detection using MOMENT-1-Large.
200+
- Use anomaly_detection tool for production-grade anomaly detection using NV Tesseract foundation model via NVIDIA NIM.
190201
- **REQUIRES JSON DATA**: First use sql_retriever to get sensor data, then pass the JSON file path to anomaly_detection.
191202
- **OUTPUT**: Creates enhanced sensor data with added 'is_anomaly' boolean column.
192203
- Use plot_anomaly to create interactive visualizations of anomaly detection results.

‎industries/asset_lifecycle_management_agent/pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ requires = ["setuptools >= 64"]
66
name = "asset_lifecycle_management_agent"
77
dynamic = ["version"]
88
dependencies = [
9-
"nvidia-nat[profiling, langchain, telemetry]==1.3.0",
9+
"nvidia-nat[profiling, langchain, telemetry]==1.2.1",
1010
"momentfm",
1111
"vanna==0.7.9",
1212
"chromadb",

0 commit comments

Comments
 (0)