Skip to content

IINTS-AF SDK v1.5.13 Release Notes

v1.5.13 documents and hardens the AI Red-Team Realism Auditor workflow for long Jetson and AdvancedMetabolicModel runs.

Highlights

1. AI Realism Auditor (The "Red Team")

We have introduced a powerful new tool designed to mathematically stress-test the core SDK physics: iints.tools.ai_realism_auditor. This module acts as an autonomous clinical auditor: - Heuristic Filtering: Instantly scans massive CSV datasets for physiologically impossible edge-cases (e.g., negative glucose, impossible rates of change, exploding ketones). - Dual Compatibility: Natively supports both scratch AdvancedMetabolicModel outputs (time_min, glucose, ffa, ketones) and official Jetson Endurance telemetry (time_minutes, glucose_actual_mgdl). - Ollama/Mistral Verdicts: Extracts specific anomalous time-windows and passes them to a local LLM for a clinical verdict on whether the event is a rare physiological extreme or a true mathematical flaw in the SDK. - Deterministic Fallback: Added a --no-ai flag to allow CI/CD and offline Jetson execution of the heuristic filter without requiring the heavy LLM backend.

2. Endurance Generation

To support the Auditor, we introduced examples/jetson_endurance_test.py. This acts as an adversarial data generator that deliberately injects skipped boluses, immense carbohydrate intakes, and multi-hour pump failures into the AdvancedMetabolicModel over a simulated 14-day timeline.

3. Comprehensive Documentation

A new comprehensive documentation file has been added at docs/AI_RED_TEAM_AUDITOR.md, containing booth-safe commands and the mathematical underpinning behind the lipotoxicity and ketone models.

Corrected Claims

The previous scratch walkthrough described the 14-day demo as “almost half a million datapoints.” The verified 5-minute, 14-day configuration produces:

\[ 14 \cdot 24 \cdot 12 = 4032 \text{ rows} \]

With 8 exported columns, that is about:

\[ 4032 \cdot 8 = 32256 \text{ table cells} \]

That is still a useful endurance stress file, but it should not be described as half a million rows.

The scratch demo also claimed that a hidden G=-50 model glitch is directly produced by the physiology. In the guarded implementation, normal model output is clipped by the glucose-transition guard:

\[ G_{t+1}=\max(20, G_t + \mathrm{clip}(G^*_{t+1}-G_t, -r_{max}\Delta t, r_{max}\Delta t)) \]

So negative glucose should be treated as deliberate corruption or a true data/model bug, not normal physiology.

Mathematical Core

The 18-state advanced model uses:

\[ y = [G, X, I, Q_{sto1}, Q_{sto2}, Q_{gut}, S_1, S_2, Y_1, Y_2, \Gamma, x_{gluc}, HAAF, F, K, \beta, Q_{fat}, Q_{prot}] \]

Free fatty acids:

\[ \frac{dF}{dt}=\ell_0 e^{-\ell_1I}-k_fF \]

Ketones:

\[ \frac{dK}{dt}=k_0Fe^{-k_1I}-k_2K \]

Lipotoxicity:

\[ L(F)=\frac{0.4}{\max(0.4,F)} \]
\[ p_{3,eff}=p_3M_{exercise}M_{stress}L(F) \]

Beta-cell decay:

\[ \frac{d\beta}{dt}=-a\beta \]

T1D glucose instability:

\[ \frac{dG}{dt}=-XG+EGP+R_a+D-U_{exercise}-F_R \]
\[ EGP=p_{1,eff}G_{b,eff} \]
\[ G_{b,eff}=G_bM_{stress}M_{rescue}\max(0,1+x_{gluc})(1+3S) \]
\[ S=e^{-0.4I}\frac{\max(F,0.4)}{0.4} \]

Verified Locally

Smoke checks performed:

PYTHONPATH=src python3 -m pytest -q -p no:cacheprovider tests/tools/test_ai_realism_auditor.py
PYTHONPATH=src python3 examples/jetson_endurance_test.py --days 0.05 --output /tmp/iints_redteam_demo.csv --inject-demo-glitch
PYTHONPATH=src python3 -m iints.tools.ai_realism_auditor /tmp/iints_redteam_demo.csv --report /tmp/iints_redteam_demo.md --no-ai

The official Jetson endurance command also works when report dependencies such as matplotlib are installed:

iints jetson endurance start --algo algorithms/example_algorithm.py --duration 1h --output-dir /tmp/iints_endurance_smoke --profile mixed_adversarial --seed 42

If this command fails with ModuleNotFoundError: matplotlib, install the SDK with report extras:

python3 -m pip install -e ".[full]"