ml-engineering

Maintains TinyML acoustic model training, log-mel DSP parity, and INT8 export for firmware.

23|1|Updated Feb 26, 2026
One-click install
npx skills add https://github.com/Alexey-Lukin/silken_net --skill ml-engineering-alexey-lukin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ml-engineering
Source: https://github.com/Alexey-Lukin/silken_net/tree/main/.claude/skills/ml-engineering
Command: npx skills add https://github.com/Alexey-Lukin/silken_net --skill ml-engineering-alexey-lukin

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Keeping a TinyML acoustic model consistent across three implementations (librosa training, pure-stdlib Python, and on-device C) is error-prone: a silent drift in any log-mel parameter breaks the train-side vs on-device feature parity that the whole pipeline depends on. This Skill provides the operational playbook for the silken_net ML surface so every change is proven equal, not hoped equal. ## Core Features & Use Cases - Three-implementation parity verification: Run layered gates from gcc-only golden-vector checks (make -C firmware/test logmel) up to the full conda-based librosa parity suite (pytest tools/ml/tests). - Contract change workflow: Edit a log-mel parameter across its three homes (docs canon, Python mirror, C header), regenerate firmware tables with silken_ml.codegen.emit_c, and re-pin the contract hash. - INT8 model export: Retrain or re-emit the quantized acoustic model header via silken_ml.export, with a quantization-parity gate and a byte-for-byte header freshness check. - Use Case: You need to change the mel-band count in the feature contract. The Skill walks you through editing the SSOT doc, mirroring the value in contract.py and logmel_contract.h, regenerating the committed headers, and re-running the parity gates so CI stays green. ## Quick Start Ask the assistant to verify that the firmware log-mel C implementation still matches the committed golden vectors and to show which gate to run for your change.

Frequently Asked Questions about ml-engineering

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I verify log-mel parity between Python and firmware C code?

Run `make -C firmware/test logmel` with only gcc to compare the C front-end against committed golden vectors at tolerance 1e-3. For full librosa-vs-stdlib parity at 1e-6, run `pytest tools/ml/tests` inside the conda silken_ml environment.

How do I change a log-mel parameter like n_fft or mel bands?

Edit the value in the docs canon (03_03 section 3.4), mirror it in tools/ml contract.py and firmware/common/logmel_contract.h, then regenerate headers with silken_ml.codegen.emit_c and re-pin the contract hash test. Re-run the parity gates to confirm all three implementations match.

How do I export the INT8 acoustic model to a C header?

Use silken_ml.export: build_from_run retrains and re-quantizes, while extract_params plus emit_header re-emits the header from the committed model_int8.tflite with zero weight churn. A quantization-parity gate raises if the numpy int-reference diverges from the TFLite interpreter.

Does this project use TensorFlow Lite Micro for on-device inference?

No. The runtime is a fixed-topology INT8 forward pass written in pure C, identical on host and ARM, with no vendored interpreter. TFLM is documented only as a fallback if OTA graph flexibility is ever needed and its roughly 16-20 KB flash footprint fits the arena budget.

Why does the cavitation class use synthetic training audio?

True xylem cavitation acoustic emission is ultrasonic at 25-150 kHz, beyond this chain's 16 kHz sample rate and 8 kHz Nyquist limit. The generator synthesizes 5-8 kHz clicks as an audible structural proxy, so baseline accuracy measures pipeline integrity, not field validity.

Where did the backend Rumale stress-index model go?

It was removed on 2026-09-05 after feature hygiene left zero legitimate inputs: max_acoustic had no hardware source and avg_temp was rejected as a weather confound. Do not search the tree for ai_train.rake or the RandomForest marshal file; it returns only when a direct field signal exists.