Training neural networks on Apple Neural Engine via reverse-engineered private APIs
This report presents the forensic synthetic code analysis of maderix/ANE, a Objective-C project with 7,229 GitHub stars. SynthScan v2.0 examined 14,302 lines of code across 54 source files, recording 67 pattern matches distributed across 8 syntactic categories. The overall adjusted score of 6.6 places this repository in the Low AI signal band.
The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).
Longitudinal tracking requires multiple scan runs. Once this repository is re-scanned after new commits land, this chart will visualise how the synthetic code signal evolves over time — enabling you to detect whether AI authorship is growing, stabilising, or being actively corrected by human engineers.
Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.
This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.
The scanner identified 67 distinct pattern matches across 8 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.
Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | ane_int8_bench.m | 1 | // ane_int8_bench.m — INT8 W8A8 benchmark on ANE via _ANEInMemoryModel | COMMENT |
| LOW | bridge/ane_bridge.h | 1 | // ane_bridge.h — C-callable bridge to ANE private APIs for Python ctypes | COMMENT |
| LOW | bridge/ane_bridge.h | 21 | COMMENT | |
| LOW | training/train_large.m | 561 | io_copy(kern[L].qkvBwd->ioIn, 0, sdpaBwd2[L]->ioOut, 0, 2*DIM, SEQ); | COMMENT |
| LOW | training/train_large.m | 581 | // Wait no - dx2 = d(loss)/d(x2), not d(loss)/d(layer_input) | COMMENT |
| LOW | training/ane_classifier.h | 1 | // ane_classifier.h — MIL generators for classifier matmul and softmax on ANE | COMMENT |
| LOW | training/test_conv_attn3.m | 1 | // Grouped conv causal attention with CORRECT layout A: blob[oc*ICg + ic] | COMMENT |
| LOW | training/test_weight_reload.m | 1 | // test_weight_reload.m — Can we skip recompilation by rewriting weight blobs on disk? | COMMENT |
| LOW | training/tiny_train_old.m | 1 | // tiny_train.m — Train a 2-layer linear model on ANE (forward AND backward) | COMMENT |
| LOW | training/test_dynamic_matmul.m | 1 | // test_dynamic_matmul.m — Benchmark dynamic matmul on ANE (no recompile) | COMMENT |
| LOW | training/test_weight_patch.m | 1 | // test_weight_patch.m — Test whether ANE weights can be patched after compile | COMMENT |
| LOW | training/ane_rmsnorm_bwd.h | 1 | // ane_rmsnorm_bwd.h — MIL generator for RMSNorm backward on ANE | COMMENT |
| LOW | training/stories_config.h | 1 | // stories_config.h — Stories110M model config and structures | COMMENT |
| LOW | training/stories_config.h | 21 | #define HD (DIM/HEADS) | COMMENT |
| LOW | training/train_large_ane.m | 1 | // train_large_ane.m — Stories110M training with CPU ops offloaded to ANE | COMMENT |
| LOW | training/test_fused_qkv.m | 1 | // Test: Fused QKV projections in single MIL graph (3 convs → concat output) | COMMENT |
| LOW | training/model.h | 1 | // model.h — Stories110M model struct + weight loading + ANE kernel compilation | COMMENT |
| LOW | training/tiny_train.m | 1 | // tiny_train.m — Train a 2-layer linear model on ANE (forward AND backward) | COMMENT |
| LOW | training/test_fused_bwd.m | 1 | // Test: fused backward dx kernels | COMMENT |
| LOW | training/test_full_fused.m | 1 | // Full fused forward: QKV convs → reshape → matmul(Q,K^T) → scale+mask → softmax → matmul(scores,V) → Wo conv | COMMENT |
| LOW | training/test_ane_causal_attn.m | 1 | // Decomposed causal attention: Q@K^T on ANE, mask+softmax on CPU, scores@V on ANE | COMMENT |
| LOW | training/training_dynamic/config.h | 1 | // config.h — Model-agnostic structs, derived sizes, ANE init | COMMENT |
| LOW | training/training_dynamic/config.h | 21 | #ifndef MODEL_NAME | COMMENT |
| LOW | training/training_dynamic/models/stories110m.h | 1 | // stories110m.h — Stories110M (Llama2-style, 12 layers, MHA) | COMMENT |
| LOW | training/training_dynamic/models/qwen3_06b.h | 1 | // qwen3_06b.h — Qwen3-0.6B (28 layers, GQA 16q/8kv, head_dim=128) | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW⚡ | training/test_conv_attn3.m | 177 | // Step 1: Q@K^T | COMMENT |
| LOW⚡ | training/test_conv_attn3.m | 181 | // Step 2: Scale + causal mask + softmax (CPU) | COMMENT |
| LOW | training/test_conv_attn3.m | 202 | // Step 3: scores@V | COMMENT |
| LOW | training/ane_rmsnorm_bwd.h | 35 | // Step 1: Compute rrms = 1/sqrt(mean(x²) + eps) | COMMENT |
| LOW⚡ | training/ane_rmsnorm_bwd.h | 51 | // Step 2: Load RMSNorm weights w [1, DIM, 1, 1] | COMMENT |
| LOW⚡ | training/ane_rmsnorm_bwd.h | 54 | // Step 3: Compute dot = sum(dy * w * x, axis=1) * invd * rrms² | COMMENT |
| LOW | training/ane_rmsnorm_bwd.h | 68 | // Step 4: dx = (dy * w - x * coeff) * rrms | COMMENT |
| LOW | training/test_ane_causal_attn.m | 97 | // Step 1: Q @ K^T → scores [1, HEADS, SEQ, SEQ] | COMMENT |
| LOW | training/test_ane_causal_attn.m | 115 | // Step 3: scores_softmax @ V → output [1, HEADS, SEQ, HD] | COMMENT |
| LOW⚡ | training/test_ane_causal_attn.m | 167 | // Step 1: Q@K^T on ANE | COMMENT |
| LOW⚡ | training/test_ane_causal_attn.m | 173 | // Step 2: Scale + causal mask + softmax on CPU | COMMENT |
| LOW | training/test_ane_causal_attn.m | 197 | // Step 3: softmax_scores @ V on ANE | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW⚡ | training/test_conv_attn3.m | 177 | // Step 1: Q@K^T | COMMENT |
| LOW⚡ | training/test_conv_attn3.m | 181 | // Step 2: Scale + causal mask + softmax (CPU) | COMMENT |
| LOW | training/test_conv_attn3.m | 202 | // Step 3: scores@V | COMMENT |
| LOW | training/ane_rmsnorm_bwd.h | 35 | // Step 1: Compute rrms = 1/sqrt(mean(x²) + eps) | COMMENT |
| LOW⚡ | training/ane_rmsnorm_bwd.h | 51 | // Step 2: Load RMSNorm weights w [1, DIM, 1, 1] | COMMENT |
| LOW⚡ | training/ane_rmsnorm_bwd.h | 54 | // Step 3: Compute dot = sum(dy * w * x, axis=1) * invd * rrms² | COMMENT |
| LOW | training/ane_rmsnorm_bwd.h | 68 | // Step 4: dx = (dy * w - x * coeff) * rrms | COMMENT |
| LOW | training/test_ane_causal_attn.m | 97 | // Step 1: Q @ K^T → scores [1, HEADS, SEQ, SEQ] | COMMENT |
| LOW | training/test_ane_causal_attn.m | 115 | // Step 3: scores_softmax @ V → output [1, HEADS, SEQ, HD] | COMMENT |
| LOW⚡ | training/test_ane_causal_attn.m | 167 | // Step 1: Q@K^T on ANE | COMMENT |
| LOW⚡ | training/test_ane_causal_attn.m | 173 | // Step 2: Scale + causal mask + softmax on CPU | COMMENT |
| LOW | training/test_ane_causal_attn.m | 197 | // Step 3: softmax_scores @ V on ANE | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | training/dashboard.py | 135 | except Exception as e: | CODE |
| LOW | training/dashboard.py | 172 | except Exception as e: | CODE |
| LOW | training/dashboard.py | 313 | except Exception as e: | CODE |
| LOW | training/dashboard.py | 1044 | except Exception: | CODE |
| LOW | training/dashboard.py | 1103 | except Exception: | CODE |
| LOW | training/dashboard.py | 1182 | except Exception as e: | CODE |
| MEDIUM | training/dashboard.py | 141 | def load_weights_from_ckpt(path): | CODE |
| MEDIUM | training/dashboard.py | 1173 | def force_gen(): | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | training/dashboard.py | 186 | CODE | |
| LOW | training/dashboard.py | 290 | CODE | |
| LOW | training/dashboard.py | 418 | CODE | |
| LOW | training/dashboard.py | 590 | CODE | |
| LOW | training/dashboard.py | 651 | CODE | |
| LOW | training/dashboard.py | 947 | CODE | |
| LOW | training/tokenize.py | 12 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | training/dashboard.py | 910 | cmd = f'cd training_dynamic && make{model_arg} 2>&1 && ./train' | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | training/dashboard.py | 394 | def _sync_globals_from_parsed(cfg): | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | training/dashboard.py | 906 | CODE |