Apex: which machine signals deserve an inspection?
Use NVIDIA's NV-Tesseract diffusion anomaly detector and a robust baseline to decide which machine signals deserve an inspection.
Casebook links: MFG-02 / MFG-09 / MFG-10 · Real pretrained model · Synthetic data · Retrospective batch analysis
A reliability engineer has three synthetic compressor sensors and limited inspection capacity. Can reconstruction error help prioritize a bearing inspection without automatically stopping a machine?
The saved example generates synthetic telemetry, inspects model inputs, runs NVIDIA’s diffusion checkpoint, compares it with a robust baseline, and translates point flags into a review workload. No safety action or production write is authorized.
Prerequisites and support
Section titled “Prerequisites and support”Dependency-incomplete download: this .ipynb preserves the lesson and its saved outputs, but is not a standalone runnable package. It does not include time_series_lab.py, time_series_prepare.py, time-series-model-lock.json, mementropy.mplstyle, the pinned upstream SDK checkout, or model assets. There is no verified public support bundle or locked Python environment for this download. Installing Jupyter alone will not make Run All work.
The original setup used Python 3.12 with Jupyter/IPython, NumPy, pandas, Matplotlib, PyTorch and the matching upstream SDK dependencies. Forecasting cells use pandas’ include_groups API (pandas 2.2 or later). These are prerequisites, not a tested installation recipe. The missing helper expected upstream code under .runtime/NV-Tesseract and model-family asset directories beside it. Its preparation step downloads assets; its activation step checks revisions and hashes before loading. The forecasting and anomaly packages share the sdk namespace and require separate fresh kernels.
Retained identities for an independently reviewed reconstruction:
- Upstream NVIDIA/NV-Tesseract, revision
7fa53ac50abcd8829550d9399875f24170c1d0e8. - Diffusion model:
nvidia/nv-tesseract-ad-diffusion, revisione8dbafbbcad2e2539d2cb6423b27b579f80ed54c; required files includefinal_model.pthandcurriculum_medium.yaml.
Use the official source and model cards linked below to review licenses, hardware support and security requirements before acquiring assets. Checkpoint and standardizer loading can deserialize code-capable formats; verify provenance and hashes in a disposable environment. The public download includes no weights or credentials. A complete helper distribution, dependency lock and clean-environment smoke test remain unverified; this page does not offer a one-command rerun.
Evidence: these are saved outputs from an earlier execution, not rerun for the 2026-10-29 editorial update. Rendering displays saved cells; it does not execute them. The public download is not a locked environment or a production validation.
from pathlib import Pathimport sys, time, json, hashlibimport numpy as npimport pandas as pdimport matplotlib.pyplot as pltfrom IPython.display import display, Markdown, JSON# Requires the separately prepared runtime described above; the public download is dependency-incomplete.from time_series_lab import activate, features, anomaly_metrics, style, LOCK, RUNTIMEstyle()weights = activate('ad')from sdk.anomaly_analysis import perform_anomaly_analysis_with_diffusionfrom sdk.inference_ad import DEVICE, set_seedprint({'model': 'NV-Tesseract-AD', 'device': DEVICE, 'checkpoint_revision': LOCK['ad']['revision'], 'diffusion_samples': 3}){'model': 'NV-Tesseract-AD', 'device': 'mps', 'checkpoint_revision': 'e8dbafbbcad2e2539d2cb6423b27b579f80ed54c', 'diffusion_samples': 3}
The data and the decision
Section titled “The data and the decision”Every value below is generated teaching data, not captured factory or subscriber telemetry. Labels are retained only for evaluation. The first 120 points are a declared normal baseline for the comparator; the remaining points are the scoring interval. The NVIDIA SDK operates on the entire retrospective batch.
rng = np.random.default_rng(17)t = np.arange(300)df = pd.DataFrame({ 'timestamp': pd.date_range('2026-01-01', periods=len(t), freq='min'), 'vibration_mm_s': 2 + .2*np.sin(t/12) + rng.normal(0,.06,len(t)), 'temperature_c': 65 + 2*np.sin(t/25) + rng.normal(0,.3,len(t)), 'motor_current_a': 18 + np.sin(t/12) + rng.normal(0,.2,len(t)),})columns = ['vibration_mm_s', 'temperature_c', 'motor_current_a']# Known synthetic events, defined before model execution; not tuning targets.intervals = [(160,174), (230,244)]df.loc[160:173, 'vibration_mm_s'] += 2.5df.loc[160:173, 'temperature_c'] += 7df.loc[230:243, 'motor_current_a'] += 8truth = np.zeros(len(df), dtype=int)for start, stop in intervals: truth[start:stop] = 1model_input = features(df, columns)assert model_input.columns.tolist() == columnsassert len(model_input) == len(truth) and np.isfinite(model_input).all().all()print('Model sees only:', model_input.columns.tolist())display(df.head())fig, axes = plt.subplots(3, 1, figsize=(11,7), sharex=True)for ax, column in zip(axes, columns): ax.plot(df.timestamp, df[column], linewidth=1.5) for start, stop in intervals: ax.axvspan(df.timestamp[start], df.timestamp[stop-1], color='#cf222e', alpha=.15) ax.set_ylabel(column.replace('_', ' '))axes[0].set_title('Synthetic telemetry — shaded intervals are injected events')plt.tight_layout(); plt.show()Model sees only: ['vibration_mm_s', 'temperature_c', 'motor_current_a']
| timestamp | vibration_mm_s | temperature_c | motor_current_a | |
|---|---|---|---|---|
| 0 | 2026-01-01 00:00:00 | 2.066076 | 65.237994 | 17.875674 |
| 1 | 2026-01-01 00:01:00 | 2.036953 | 65.316900 | 17.804345 |
| 2 | 2026-01-01 00:02:00 | 2.000781 | 65.300022 | 18.108237 |
| 3 | 2026-01-01 00:03:00 | 1.973866 | 65.634647 | 18.028081 |
| 4 | 2026-01-01 00:04:00 | 1.951762 | 65.538299 | 18.345866 |
Run the actual diffusion model
Section titled “Run the actual diffusion model”The checkpoint reconstructs masked observations; large residuals can indicate unusual behavior. We use SCS thresholding and three diffusion samples to keep this an exploratory workstation exercise, not a vendor benchmark.[2][4]
Important boundary: the pinned SDK fits min/max normalization on the supplied batch and uses windowed reconstruction plus adaptive batch thresholding (ad_diffusion/sdk/inference_ad.py and sdk/anomaly_analysis.py).[2] Later values can affect earlier scores. This is retrospective triage, not causal streaming detection or a leakage-free future holdout. Labels never enter the model. A real online design needs a separately validated causal preprocessing and threshold protocol.
set_seed(42)started = time.perf_counter()# Exact official SDK call. No fallback to a baseline if this fails.result = perform_anomaly_analysis_with_diffusion( df=model_input, threshold_strategy='scs', nsample=3, model_path=str(weights/'final_model.pth'), model_config_path=str(weights/'curriculum_medium.yaml'), explain=True, explanation_top_k=3,)elapsed = time.perf_counter() - startedassert len(result) == len(df) and np.isfinite(result.MAE).all()assert result.Anomaly.isin([0, 1]).all()print(f'Actual model inference: {elapsed:.2f} seconds on {DEVICE}')Actual model inference: 6.59 seconds on mps
Does the complexity earn its place?
Section titled “Does the complexity earn its place?”The baseline uses a per-channel median and median absolute deviation from the first 120 points, then flags any channel beyond six robust standard deviations. Its threshold is fixed before seeing evaluation labels. Compare pointwise precision, recall, F1, false alarms, and misses on the same final 180 points. We do not inflate event intervals through point adjustment. The protocols differ (batch SDK versus historical baseline), so this is a workflow comparison, not a controlled architecture benchmark.
reference = model_input.iloc[:120]center = reference.median()scale = (reference-center).abs().median().clip(lower=1e-6) * 1.4826baseline_score = ((model_input-center)/scale).abs().max(axis=1)baseline_flags = (baseline_score > 6).astype(int).to_numpy()flags = result.Anomaly.astype(int).to_numpy()metrics = pd.DataFrame({ 'NV-Tesseract AD (batch)': anomaly_metrics(truth[120:], flags[120:]), 'Robust baseline (historical)': anomaly_metrics(truth[120:], baseline_flags[120:]),}).Tdisplay(metrics.round(3))fig, axes = plt.subplots(2,1,figsize=(11,6),sharex=True)axes[0].plot(df.timestamp, result.MAE, label='Diffusion reconstruction MAE')axes[0].scatter(df.timestamp[flags==1], result.MAE[flags==1], color='#cf222e', s=20, label='SCS flag')axes[1].plot(df.timestamp, baseline_score, color='#b35900', label='Robust baseline score')axes[1].axhline(6, color='#6f706a', linestyle='--', label='Fixed threshold')for ax in axes: for start, stop in intervals: ax.axvspan(df.timestamp[start], df.timestamp[stop-1], color='#cf222e', alpha=.12) ax.axvline(df.timestamp[120], color='#171817', linestyle=':', label='Evaluation starts') ax.legend(loc='upper left', fontsize=8)axes[0].set_title('Model and baseline can disagree — inspect both false alarms and misses')plt.tight_layout(); plt.show()| precision | recall | f1 | false_alarms | missed_points | |
|---|---|---|---|---|---|
| NV-Tesseract AD (batch) | 1.0 | 0.536 | 0.698 | 0.0 | 13.0 |
| Robust baseline (historical) | 1.0 | 1.000 | 1.000 | 0.0 | 0.0 |
From flags to human work
Section titled “From flags to human work”Consecutive flagged points become one review episode. This simple grouping is not an incident-correlation engine. Contributor shares identify channels with reconstruction error, not root cause.[2] Compare the top contributors with independent maintenance or network-change evidence before taking action.
evaluation_flags = flags.copy()evaluation_flags[:120] = 0starts = np.flatnonzero((evaluation_flags == 1) & (np.r_[0, evaluation_flags[:-1]] == 0))review = result.loc[starts, ['MAE', 'TopContributors', 'ContributionShares']].copy()review.insert(0, 'timestamp', df.timestamp.iloc[starts].to_numpy())display(review.head(10))model_f1 = metrics.loc['NV-Tesseract AD (batch)', 'f1']base_f1 = metrics.loc['Robust baseline (historical)', 'f1']verdict = 'higher' if model_f1 > base_f1 else 'lower' if model_f1 < base_f1 else 'equal'display(Markdown(f"**Observed:** model F1 is {model_f1:.3f}, {verdict} than the baseline's {base_f1:.3f}. " f"The model creates {len(starts)} review episodes in the evaluation interval. " "A sophisticated model is not automatically a better alerting policy. " "Keep the cheap comparator and require an operator to review the misses."))| timestamp | MAE | TopContributors | ContributionShares | |
|---|---|---|---|---|
| 160 | 2026-01-01 02:40:00 | 0.651616 | ["vibration_mm_s","temperature_c","motor_curre... | [0.514452,0.356701,0.128847] |
| 241 | 2026-01-01 04:01:00 | 0.547015 | ["motor_current_a","vibration_mm_s","temperatu... | [0.681677,0.273713,0.044611] |
Observed: model F1 is 0.698, lower than the baseline’s 1.000. The model creates 2 review episodes in the evaluation interval. A sophisticated model is not automatically a better alerting policy. Keep the cheap comparator and require an operator to review the misses.
Break it safely, then transfer the idea
Section titled “Break it safely, then transfer the idea”A missing sensor value should be a data-quality decision, not a silently invented zero. This failure probe is intentionally caught so Run All stays green. For your variation, replace the sharp spike with a slow ramp, freeze your alert policy before reading labels, and explain which event each method misses. Do not tune repeatedly against these displayed labels and call the result held out.
broken = df.copy()broken.loc[170, columns[0]] = np.nantry: features(broken, columns)except ValueError as error: print('EXPECTED DATA-QUALITY REJECTION:', error)else: raise AssertionError('Missing sensor data reached the model')EXPECTED DATA-QUALITY REJECTION: Missing or nonfinite observations require an explicit data-quality policy
What this teaches an operator
Section titled “What this teaches an operator”- Separate data validity, model score, alert policy, and permission to act.
- Baselines are useful even when foundation models run successfully. Their disagreements identify where to investigate.
- An impressive plot does not measure avoided downtime or faster incident resolution. A pilot needs real labels, shift-specific false-alarm budgets, and independently reviewed outcomes.
- This notebook does not fine-tune weights, prove safety, or authorize machine control, alarm acknowledgement, or production changes.
The following receipt is generated from this execution, not hand-entered expected results.
display(JSON({'case_id': 'MFG-02 / MFG-09 / MFG-10', 'model': 'nvidia/nv-tesseract-ad-diffusion', 'device': str(DEVICE), 'seconds': round(elapsed,3), 'samples': 3, 'protocol': 'retrospective-batch', 'review_episodes': len(starts), 'metrics': metrics.to_dict(orient='index')})){
"case_id": "MFG-02 / MFG-09 / MFG-10",
"device": "mps",
"metrics": {
"NV-Tesseract AD (batch)": {
"f1": 0.6976744186046512,
"false_alarms": 0,
"missed_points": 13,
"precision": 1,
"recall": 0.5357142857142857
},
"Robust baseline (historical)": {
"f1": 1,
"false_alarms": 0,
"missed_points": 0,
"precision": 1,
"recall": 1
}
},
"model": "nvidia/nv-tesseract-ad-diffusion",
"protocol": "retrospective-batch",
"review_episodes": 2,
"samples": 3,
"seconds": 6.594
}
Sources and scope
Section titled “Sources and scope”The May 2025 article describes a family spanning classification, forecasting, and anomaly detection.[1] This notebook uses the later public diffusion anomaly-detection release, not the earlier article’s exact model or reported healthcare F1 score.[2][4] The pinned public library exposes forecasting and anomaly detection; this collection does not invent a released classification checkpoint.[2] This is an original VIT teaching extension of the casebook, not implementation of the entire enterprise program.
Sources
Section titled “Sources”[1] https://developer.nvidia.com/blog/new-nvidia-nv-tesseract-time-series-models-advance-dataset-processing-and-anomaly-detection — New NVIDIA NV-Tesseract Time Series Models Advance Dataset Processing and Anomaly Detection