File size: 1,509 Bytes
3706bdc
7067541
 
 
 
 
 
 
 
3706bdc
 
 
7067541
3706bdc
7067541
3706bdc
7067541
3706bdc
7067541
 
 
 
 
 
 
3706bdc
7067541
3706bdc
7067541
 
 
 
 
 
3706bdc
 
 
 
7067541
 
3706bdc
 
7067541
 
 
 
3706bdc
 
7067541
3706bdc
 
 
7067541
3706bdc
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
title: FSI_ECHO
emoji: 🧬
colorFrom: purple
colorTo: indigo
sdk: gradio
sdk_version: "5.0.0"
app_file: app.py
pinned: false
license: apache-2.0
---

# 🧬 FSI_ECHO — Morphing Code Swarm

**World's smallest production code AI: 2.6M params, 1.3MB at Q4, runs on any phone.**

## Architecture — Novel "Morphing Code Swarm"

| Component | What it does |
|-----------|-------------|
| **Morph Embedding** | Tokens transform based on context (causal sliding window) |
| **Nanobot Swarm** | 512 nanobots with scout/combat dual-mode routing |
| **Assembly Blocks** | Multi-head attention with adaptive gating |
| **Self-Verification** | Built-in confidence scoring per token |
| **Closed-Loop Debug** | Generates, verifies syntax, and iteratively refines |

## Metrics

- Parameters: 2,621,578
- FP32 size: 10.5 MB
- Q4 size: 1.31 MB — fits on any phone
- Training loss: 8.4 → 0.0 (trained on 2400+ code examples)
- Speed: ~10 tok/s on CPU
- Context: 2048 tokens

## Usage

```python
from fsi_echo import FSIEchoModel, CodeTokenizer, ClosedLoopDebugger
import torch

model = FSIEchoModel()
tok = CodeTokenizer()
ckpt = torch.load('prod2_final.pt', map_location='cpu', weights_only=True)
model.load_state_dict(ckpt['model'])
model.eval()

# Generate code
result = model.generate(tok, 'def reverse_str', max_tokens=50)
print(result['generated'])

# Debug code
debugger = ClosedLoopDebugger(model, tok)
result = debugger.debug("def add(a, b):\n    a + b")
print(result['code'])
```

## License
Apache 2.0