Reorganise reports by day (reports/<date>/), add index; move Claude memory into claude-memory/

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
int 2026-10-15 10:48:29 +03:00
parent 151e9f0b23
commit 38cefe8f53
16 changed files with 165 additions and 2 deletions

5
claude-memory/MEMORY.md Normal file
View file

@ -0,0 +1,5 @@
- [KNP altai work](knp-mnist-altai-work.md) — MNIST + objects state, this machine is the stand, git setup, results, next steps
- [Inference on platform](all-on-platform.md) — user: recognition fully in KNP/AltAI, training may be offline; demo = UAV object recognition, live
- [KNP MNIST low recall](knp-mnist-low-recall.md) — blifat silence cause (frozen additional_threshold), inference-threshold fix (2026-10-12)
- [KNP WSL build state](knp-wsl-build-state.md) — what's built where, CPU/GPU, build gotchas (2026-10-07; check before trusting)
- [KNP reference links](knp-reference-links.md) — GitHub, Kaspersky neuro site, ai-cert, Altai chip page

16
claude-memory/README.md Normal file
View file

@ -0,0 +1,16 @@
# Память Claude
Здесь хранятся заметки Claude Code между сессиями: что уже сделано, решения пользователя, где что лежит. Каждая заметка — отдельный файл, `MEMORY.md` — их оглавление, которое Claude читает при старте.
Системные папки памяти Claude (`~/.claude/projects/-mnt-c-knp/memory` и `~/.claude/projects/-mnt-c-KNP/memory` — путь проекта пишется в двух регистрах) — ссылки на эту папку. Поэтому память одна, лежит в git и переносится вместе с репозиторием.
На новой машине после клонирования связать заново:
```bash
for d in -mnt-c-knp -mnt-c-KNP; do
mkdir -p ~/.claude/projects/$d && rm -rf ~/.claude/projects/$d/memory
ln -s /mnt/c/knp/claude-memory ~/.claude/projects/$d/memory
done
```
Копия памяти до объединения — `/mnt/c/knp-nested-git-backup/claude-memory-backup-2026-10-15/` (вне репозитория).

View file

@ -0,0 +1,14 @@
---
name: all-on-platform
description: "User requires INFERENCE fully on KNP/AltAI (pixel → answer); training may be off-platform. Demo goal: UAV object recognition, live"
metadata:
node_type: memory
type: feedback
originSessionId: 5e1c8e61-f0ee-51a6-9940-e024073c3caf
modified: 2026-10-15T07:37:10.350Z
---
Inference must run entirely on the platform (KNP/AltAI neurons, pixel → answer); no part of recognition may be computed in Python or our own simulator. Training does NOT need to be on AltAI (clarified 2026-10-15: "нам важен именно инференс на алтае, а обучение не важно") — train offline with whatever gives the best accuracy, then load weights into KNP.
**Why:** the live demo (week after 2026-10-15) must show AltAI can replace a neural network for object recognition in UAV systems; that claim is about running recognition on the neuromorphic processor.
**How to apply:** don't spend time on on-chip learning rules; fold preprocessing into neuron weights, verify accuracy with KNP itself, report which numbers come from KNP. Prefer drone-relevant classes (CIFAR-10 vehicles). Related: [[knp-mnist-altai-work]].

View file

@ -0,0 +1,30 @@
---
name: knp-mnist-altai-work
description: "Ongoing work on KNP (Kaspersky Neuromorphic Platform): mnist-learn altai/blifat accuracy + cats-vs-dogs SNN experiment, acceleration, GPU STDP prototype — state and next steps"
metadata:
node_type: memory
type: project
originSessionId: 5e1c8e61-f0ee-51a6-9940-e024073c3caf
modified: 2026-10-14T15:29:20.294Z
---
This WSL machine (1220WS2, IP 10.9.8.230 on wswg0) IS the "test stand" referenced in handoff docs; /mnt/c/knp == /mnt/c/KNP. No SSH needed. Runtime: ~/run/exp (MNIST), ~/run/cats-dogs (cats/dogs), build ~/knp-build, python with numpy: ~/anvenv/bin/python.
Git: /mnt/c/knp is one repo (branch main, remote https://git.snw.su/int/our_knp.git), created 2026-10-14. Nested .git of 1/, viz/, examples/ moved to /mnt/c/knp-nested-git-backup/ (examples = KasperskyLab/knp @55470ed6 + 6 local file changes). Local DNS doesn't resolve git.snw.su → repo config http.curloptResolve to 45.141.100.133. Credentials saved (credential.helper store) — Claude can push directly; push after commits.
MNIST (to 2026-10-13): altai 82.5%→91.5% via KNP_COL_JITTER=20 + KNP_MNIST_INFER_INHIB=255; fixed ModelLoader::init_channels bug. Simulator viz/altai_sim.py, visualizer viz/app.html→altai_viz.html. Col size 20≈40 (91.9%). Fashion ~55%. Weakness: OFF pixels send no spikes. Agreed next idea: ON/OFF input coding. sz80_*/sz40_60k runs have empty result.csv (killed). Reports: /mnt/c/knp/reports/<date>/ (index reports/README.md).
Cats/dogs (2026-10-14, other chat; docs cats-dogs/HANDOFF.md, V2.md, ACCELERATION.md, reports/2026-10-14/журнал.md): v1 contrast input 52% test; v2 HOG-like features (non-spiking) + KNP STDP: val 62.6%, test 61.8% (test already viewed — not for further tuning). Parallel independent processes 2.1× throughput. Verified 2026-10-14 evening: tuned multithread backend and fast connection-cache backend give byte-identical CSVs; tuned2 3.5× slower, fast ~10% faster (800+200 only). GPU STDP hybrid draft (gpu_stdp*.cu/.cpp) written, NOT built/verified.
MAIN GOAL (user, 2026-10-14): object recognition; MNIST is a testbed — carry every finding over to objects (cats/dogs). MNIST 92% is only on aligned MNIST: shift 2px → ~64%, thickness ±1px → 75-79% (template-like net); hand-drawn digits in viz look bad. ON/OFF naive (local) gave 56.5% val: input spike count tripled → 1/3 images silent (all column sums negative), not a quantization issue; needs spike-rate normalization.
Night 14→15 Oct (report reports/2026-10-15/Отчёт_объекты_ночь.md, log reports/2026-10-14/журнал.md): bottleneck for objects was FEATURES (HOG: even linear ~60%). Learned k-means patch features (objects/kmeans_features.py, ~WTA competitive learning) + linear: 77% on fresh test; fully spiking exact sim (objects/spiking_pipeline.py, layer1 800×729 AltAI-like neurons + one "dog−cat" readout neuron trained off-chip): 68.3%; KNP STDP columns on top-256 learned features with KNP_COL_PUNISH=0.012: 67.0%; old v2: 62.5%. Fresh test = CIFAR test 700–999/class, NOW USED (all CIFAR cat/dog test images consumed). Data v3: ~/run/cats-dogs/data-v3 (train 9000). KNP_COL_PUNISH (neg. dopamine to wrong columns) best 0.012–0.02 (+3.8pp MNIST). STDP columns fail on dense inputs (weights mostly negative → silence); need sparse input. MNIST: stroke features + spiking readout 95.1%, shift-2px 89.9%.
Later that night: online WTA (objects/kmeans_features.learn_online) ≈ k-means; three-factor dopamine-error readout (objects/dopamine_readout.py) + calibrated decision neuron: all-neural-rule pipeline 71.6% val (K=1600), ridge 73.5%; seed spread D 64.0±0.6 vs v2 62.1±1.2. Digit page (artifact Vc1q1WCZuPY2QAHBSGtrKF v2) has stroke-feature spiking readout panel (94.7% MNIST test).
Morning 15 Oct (log reports/2026-10-15/журнал.md): KNP_DELTA=a,b (+ isolated backend readout/build_delta_cpu.py → ~/run/delta-cpu/libknp-cpu-delta-backend.so, env KNP_DELTA_RULE=rate, KNP_DELTA_LAG=1 REQUIRED — dopamine arrives 1 step after input) = error-driven dopamine readout inside KNP, KNP_COL_SIZE=1. MNIST coarse features: 94.8% (b=4–6, r=3), augmented 90k: 94.6%, shift-2px 91.3%. Cats/dogs: 65–69% (columns 64–65%, ridge 74%); weight range (KNP_W_RANGE) and 3 epochs don't help. cats-dogs/run.py --backend delta; cats_dogs input size via KNP_MNIST_INPUT_SIZE.
Next: close KNP object gap (smaller steps/learning-rate decay?), port WTA feature layer into KNP; reduce spike-coding loss; make columns handle dense features.
Waiting tip: never `pgrep -f <name>` for a string that appears in the waiting command itself (self-match hung a wait 1.5h); use `ps -eo args | grep -c "[x]yz"`. `tail -5` fails here; use `tail -n 5`.
User wants a real KNP/AltAI spiking net trained (not CNN substitution). Daily log: reports/YYYY-MM-DD/журнал.md (+ reports of that day in the same folder; index reports/README.md, living overview reports/Итоги_и_план.md): short for discussion, detailed for code/runs; no passwords.
**Why:** session transcripts don't survive between days; user expects continuity.
**How to apply:** read reports/README.md, reports/Итоги_и_план.md and the latest reports/<date>/журнал.md; check `uptime` (WSL restarts kill runs) and result files before trusting; update this memory and the daily log at session end.

View file

@ -0,0 +1,44 @@
---
name: knp-mnist-low-recall
description: "Root cause of low MNIST recall in KNP blifat example (frozen additional_threshold), fix via inference threshold, diagnostics added 2026-10-12"
metadata:
node_type: memory
type: project
originSessionId: 3960a282-f1ff-5147-91d4-9a2f1014ff08
modified: 2026-10-12T12:02:12.554Z
---
Investigated 2026-10-12. Metrics code is correct (FN = image with zero output spikes, FP = wrong class).
- Root cause of silence: input neuron fires only if sum of active weights >= 8.571 + additional_threshold_, where
additional_threshold_ = 0.218 * sum of positive weights (set by STDP at each spike, frozen at inference; survives upcast).
Longer training polarizes weights -> sum+ grows (12.8 @3k -> 18 @60k) -> threshold grows -> more silence.
- The 20 neurons per column have identical weights (gate forces whole column), so they act as 1 neuron.
- `stochastic_stimulation_` is declared but never used by the CPU backend.
- WTA seed comes from std::random_device (knp/base-framework/impl/projection/wta.cpp:38); runs are normally
identical anyway; one 60k run out of 5 collapsed to all-zero weights, cause not found.
- Fix (inference only): KNP_MNIST_THR / KNP_MNIST_ADD_THR_SCALE env knobs added to
examples/mnist-learn/models/blifat/prepare_network_for_inference.cpp (+ KNP_MNIST_DUMP=<dir> writes neurons.csv/weights.csv).
Original backed up in session scratchpad only; `git diff` in /mnt/c/KNP/examples shows the change.
- Old "3000 vs 60000" comparison was on different test sets (test images follow training ones). ~/run/exp/tr<N>.bin
= first N train images + the fixed 10k test set.
- Offline re-simulator (numpy, ~/anvenv) reproduced KNP spike results within a few images.
**Why:** user asked to explain and improve the ~31% result.
**How to apply:** use ~/run/exp/run.sh <name> <N> [ENV=..] for experiments; see [[knp-wsl-build-state]].
AltAI model (checked 2026-10-12): deterministic; baseline 76.2% (3k) / 75.6% (30k) / 73.3% (60k). Same frozen
additional_threshold effect. Threshold chosen on validation (train imgs 50000-59999, files ~/run/exp/val<N>.bin):
KNP_MNIST_THR=40 KNP_MNIST_ADD_THR_SCALE=0 (quantized units) -> test 84.2% / 84.1% / 82.5%. Quantization costs ~0.5 pp
(KNP_MNIST_QUANT=none|weights knob). Altai example also got KNP_MNIST_DUMP (float_/quant_ csv) and threshold knobs.
KNP BUG FOUND 2026-10-12 (fixed locally): ModelLoader::init_channels (knp/base-framework/impl/model_loader.cpp)
iterated hash buckets assuming one channel per bucket; with random UIDs, image and label channels sometimes share a
bucket (~1/8-1/12 runs) -> image projection subscribed to label channel -> no learning (weights stay initial).
This, not WTA, explains the collapsed blifat 60k run and altai jitter collapses. Fixed with equal_range over
distinct keys; 72/72 runs identical afterwards. Original saved in session scratchpad only; see git diff.
Column specialization (altai): env knobs in models/altai/construct_network.cpp: KNP_COL_JITTER (sigma, init weight
noise), KNP_COL_SEED, KNP_COL_LATERAL (in-column inhibition, hurt), KNP_COL_GATE (pulsed label, hurt). Jitter
sigma=20 makes column neurons specialize. Inference knob KNP_MNIST_INFER_INHIB=255 (global INPUT inhibition) needed
to read it out. quantize_network rewritten: one scale per postsynaptic population, big weights clamped to +-255.

View file

@ -0,0 +1,16 @@
---
name: knp-reference-links
description: "Official reference links for Kaspersky Neuromorphic Platform (KNP), Altai chip, Kaspersky AI security approach"
metadata:
node_type: memory
type: reference
originSessionId: 3960a282-f1ff-5147-91d4-9a2f1014ff08
modified: 2026-10-12T11:30:11.087Z
---
- KNP source + developer docs: https://github.com/KasperskyLab/knp
- General overview: https://neuro.kaspersky.ru/neuromorphic-technology
- Kaspersky secure AI development approach: https://ai-cert.kaspersky.ru/
- Altai neuromorphic chip specs + world use cases: https://motivnt.ru/altai
Related: [[knp-wsl-build-state]]

View file

@ -0,0 +1,24 @@
---
name: knp-wsl-build-state
description: "State of the KNP build in WSL as of 2026-10-07 — CPU works, GPU fails; paths, env, open issues"
metadata:
node_type: memory
type: project
originSessionId: 3960a282-f1ff-5147-91d4-9a2f1014ff08
modified: 2026-10-12T11:30:17.531Z
---
As of 2026-10-07 KNP is built from source in WSL (no sudo). CPU works; GPU backend builds but fails at runtime.
- Build: ~/knp-build (bin/, wheel in knp_python_framework/dist/); OpenCV in ~/deps; CUDA 12.9 in ~/cuda-12.9; GCC 14 via micromamba in ~/mamba; MNIST + logs in ~/run.
- Run env: `export LD_LIBRARY_PATH=$HOME/knp-build/bin:$HOME/deps/lib:$HOME/cuda-12.9/lib64:/usr/lib/wsl/lib`
- Python 3.14 wheel installed into /mnt/c/KNP/1/.venv; 1/pyproject.toml still points to old 3.11 wheel.
- Build gotchas: -DBoost_PYTHON_VERSION=3.14; disable maybe-uninitialized as error on GCC 15; nvcc 12.9 needs GCC 14.
- MNIST blifat full run on single-threaded CPU: 690 s, 30.9% correct (high precision, low recall); 3000/1000 run gave 47.1%. Multi-threaded backend ~7x slower.
- GPU (RTX 4070 Ti SUPER, sm_89): `invalid device function` in CUDAMessageBus::unload_messages; GPU backend only supports BLIFATNeuron + DeltaSynapse (no STDP). Changed cuda-backend CMakeLists arch 60 -> "89".
- Open next steps: fix invalid device function; try `-m altai`; investigate low recall; write Python BLIFAT+Delta net for CPU/GPU.
**Why:** user ran this work in earlier session(s) and shared the report as context.
**How to apply:** start from this state instead of rebuilding; verify paths still exist before use.
Related: [[knp-reference-links]]

View file

@ -105,4 +105,4 @@
| `features/stroke_features.py` | Признаки штрихов для цифр | | `features/stroke_features.py` | Признаки штрихов для цифр |
| `augment/` | Аугментация, голосование сдвигами, перезапуск прогонов | | `augment/` | Аугментация, голосование сдвигами, перезапуск прогонов |
| `examples/.../models/altai/construct_network.cpp`, `cats-dogs/source/...` | `KNP_COL_PUNISH` — наказание неверных колонок | | `examples/.../models/altai/construct_network.cpp`, `cats-dogs/source/...` | `KNP_COL_PUNISH` — наказание неверных колонок |
| `changes-2026-10-14.md` | Подробный журнал с командами и всеми цифрами | | `reports/2026-10-14/журнал.md`, `reports/2026-10-15/журнал.md` | Подробные журналы с командами и всеми цифрами |

14
reports/README.md Normal file
View file

@ -0,0 +1,14 @@
# Отчёты по дням
С чего начать: [Итоги и план](Итоги_и_план.md) — что изучено, главные цифры и план к показу.
В папке каждого дня лежат отчёты этого дня и `журнал.md`: коротко об обсуждениях, подробно об изменениях кода и запусках, с путями, командами и цифрами.
| День | Что сделано | Файлы |
| --- | --- | --- |
| 12 октября | Почему пример KNP на MNIST молчит; модель altai 82,5% → 91,5%; исправлена ошибка в `ModelLoader` | [MNIST: точность](2026-10-12/Отчёт_MNIST_точность.md), [модель altai](2026-10-12/Отчёт_altai.md), [колонки altai](2026-10-12/Отчёт_колонки_altai.md) |
| 13 октября | Размер колонки (20 ≈ 40 нейронов), Fashion-MNIST ~55%, визуализатор | [размер колонки и одежда](2026-10-13/Отчёт_размер_колонки_и_одежда.md) |
| 14 октября | Кошки и собаки в KNP (v1 52%, v2 61,8%), ускорение CPU, GPU-черновик; вечером — git, ON/OFF, устойчивость к сдвигам, аугментация, признаки штрихов, спайковый выход, ночь: выученные признаки для объектов | [журнал](2026-10-14/журнал.md); эксперимент кошек и собак: [`cats-dogs/`](../cats-dogs/README.md), [передача](../cats-dogs/HANDOFF.md) |
| 15 октября | Итоги ночи (кошки и собаки на свежем тесте: 62,5% → 67–68%); обучение дофамином по ошибке в KNP (цифры 94,8%); смена цели на транспорт для беспилотников; распознавание целиком в KNP (`altai-objects/`) | [объекты: ночь](2026-10-15/Отчёт_объекты_ночь.md), [журнал](2026-10-15/журнал.md) |
Новые журналы — `reports/ГГГГ-ММ-ДД/журнал.md`; отчёт дня кладётся в ту же папку и добавляется строкой в эту таблицу.

View file

@ -52,7 +52,7 @@
| Спайковый выход, точная симуляция цепочки, дофаминовое правило | `readout/`, `objects/spiking_pipeline.py`, `objects/dopamine_readout.py` | | Спайковый выход, точная симуляция цепочки, дофаминовое правило | `readout/`, `objects/spiking_pipeline.py`, `objects/dopamine_readout.py` |
| Данные объектов v3 (9000 обучающих), свежий тест | `objects/prepare_big.py`, `objects/final_fresh_test.py` | | Данные объектов v3 (9000 обучающих), свежий тест | `objects/prepare_big.py`, `objects/final_fresh_test.py` |
| Визуализатор цифр (три сети, сдвиги) | `viz/app.html`, https://claude.ai/artifact/Vc1q1WCZuPY2QAHBSGtrKF | | Визуализатор цифр (три сети, сдвиги) | `viz/app.html`, https://claude.ai/artifact/Vc1q1WCZuPY2QAHBSGtrKF |
| Отчёты и журналы | `Отчёт_*.md`, `changes-2026-10-14.md`, `changes-2026-10-15.md` | | Отчёты и журналы | `reports/<дата>/` — отчёты и `журнал.md` каждого дня, оглавление `reports/README.md` |
## 4. План на неделю: что показать ## 4. План на неделю: что показать