Instructions to use mondk/fly-brain with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use mondk/fly-brain with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf mondk/fly-brain:F16 # Run inference directly in the terminal: llama cli -hf mondk/fly-brain:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf mondk/fly-brain:F16 # Run inference directly in the terminal: llama cli -hf mondk/fly-brain:F16
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf mondk/fly-brain:F16 # Run inference directly in the terminal: ./llama-cli -hf mondk/fly-brain:F16
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf mondk/fly-brain:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf mondk/fly-brain:F16
Use Docker
docker model run hf.co/mondk/fly-brain:F16
- LM Studio
- Jan
- Ollama
How to use mondk/fly-brain with Ollama:
ollama run hf.co/mondk/fly-brain:F16
- Unsloth Desktop
- Docker Model Runner
How to use mondk/fly-brain with Docker Model Runner:
docker model run hf.co/mondk/fly-brain:F16
- Lemonade
How to use mondk/fly-brain with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull mondk/fly-brain:F16
Run and chat with the model
lemonade run user.fly-brain-F16
List all available models
lemonade list
- Atomic Chat
mondk/fly-brain — FlyWire Brain Flight Sim
A simulation of the sensorimotor flight-control circuitry of the fruit fly (Drosophila melanogaster) based on the real connectome (FlyWire), running LIF neuron models in accordance with the whole-brain study by Shiu et al., Nature 2024 (UC Berkeley team — "simulating the entire fly brain on a laptop"), placed in a 3D environment to observe the brain piloting the fly in a closed-loop manner.
Running
cd D:\opencode-file\fly-brain
python -m http.server 8000
# open browser: http://localhost:8000/viewer/
Requirements: modern browser, 1 GB free RAM. Simulates 30,212 neurons / 272,318 synapses in real-time (60 FPS on a standard laptop; event-driven engine, no memory allocation within the loop, ensuring no lag).
What is REAL (based on published data)
| Item | Source |
|---|---|
| 3,794,615 synapse edges (pre, post, neuropil region, synapse count) | FlyWire v630, via Murthy Lab mirror (connections.csv.gz, ~26 MB download) |
| Neurotransmitter labels per neuron (ACh/GABA/Glut/DA/SER/OCT) | Predictions by Eckstein et al., Cell 2024 (neurons.csv.gz) |
| Cell type / super-class / side for 127,979 neurons | Schlegel et al., Nature 2024 (classification.csv.gz) |
| Synapse distribution per neuron across 79 neuropil regions | FlyWire (neuropil_synapse_table.csv.gz) |
| Weight signs: GABA/Glut = inhibitory, ACh/DA/SER/OCT = excitatory | Convention from Shiu et al., Nature 2024 |
| LIF parameters: V₀=−52 mV, Vth=−45 mV, τm=20 ms, τsyn=5 ms, w=0.275 mV/synapse, refractory period 2.2 ms | Shiu et al. + original code philshiu/Drosophila_brain_model (model.py) |
| Key neurons present in the data: DNp01 (giant fiber escape, 2 neurons), LC4/LPLC2/LC11/LC13 (looming detection), R1-6/R7-8 (visual), JO-B/JO-E (Johnston's organ/wind sensing), EPG (head direction/compass, 50), PFL3 (central complex steering, 24), Kenyon cells/MBON/DAN (learning–memory), ORN/ALPN (olfactory), DN descending (1303), MN motor | verified directly in classification.csv.gz |
Flight circuit comprising 30,212 neurons selected based on anatomical criteria: visual (VIS 10,526) + olfactory (OLF 3,425) + mechanical/wind (MECH 2,779) + gustatory (TASTE 438) + central complex (CX 2,859) + mushroom body (MB 5,681) + lateral horn (737) + descending DN (1,303) + ascending feedback (2,364) + motor (100). Edges retained if ≥5 synapses (standard FlyWire noise filtering). ## What is Model-based / Artificial (read to avoid misunderstanding)
- 3D neuron positions are estimates, NOT raw microscopy coordinates: x-axis = left/right side of the main neuropil (real data), y/z = PCA based on actual synapse distribution profiles + jitter. Raw EM coordinates are gigabytes in size, exceeding this session's 100 MB budget.
- Sensory gain: Poisson drive to sensory inputs with 15 mV EPSP/hit (Shiu used a saturating model, f=250). This is an artificial parameter to compensate for the absence of the cell body/VNC and the fact that only a portion of the brain is simulated.
- Arousal baseline (6–12 Hz) into DN/CX/MB (artificial spontaneous activity—real flies also exhibit spontaneous activity, but this specific figure was manually selected and tuned to achieve a baseline DN rate of ~2.5 Hz).
- Steering: the optomotor/obstacle-avoidance reflex derived from left/right visual disparity is engineered (acting as a proxy for the HS/VS pathways not yet separated in the subcircuit); actual DN and PFL3 signals are superimposed (assuming ipsilateral alignment). The visual→CX→DN pathway in this simplified LIF model barely propagates signals on its own (consistent with limitations Shiu noted regarding long-range circuits), so one cannot claim that "all behaviors are emergent."
- Thrust is derived from the average DN level relative to an adaptive baseline (artificial sensory adaptation); the escape burst triggered by DNp01 spiking is emergent from the actual network (LC4/LPLC2→DNp01).
- The fly model, flight physics, and stimuli (swatter/odor/wind) are illustrative representations. ## Measured Results (Empirical Data)
- Offline Whole-Brain Simulation (
scripts/sim_full.py, numpy, 127,979 neurons / 3,794,615 synapses; ~20s real-time for 1s simulation time): 100 Hz gustatory + olfactory stimulation propagates selectively to the central brain and to the descending neuron DNb05 — demonstrating sensorimotor transformation; the network remains stable without runaway excitation (effective E/I balance). Seeresults_full.json. - Closed-loop Test (
scripts/test_closedloop.js,node test_closedloop.js): Odor source approaches → OLF activity rises (13.5 → 44.4 Hz); swatter approaches laterally → ipsilateral visual input spikes (32 → 288 Hz); forcing DNp01 spike → escape response (thrust 7.5); silencing VIS → deactivation of 10,526 neurons. - During tuning, numerical testing revealed two actual bugs: inverted closing-velocity sign and reversed left/right vectors — both fixed; tests now pass.
Suggested Viewer Experiments
- Click 🪰 Swat Now as the swatter approaches: observe VIS burst → DNp01 → ESCAPE! (mimicking the real giant-fiber reflex: LC4/LPLC2 → DNp01).
- Silence VIS then release the swatter: the fly is "blind" and fails to escape.
- Silence CX: loss of PFL3/E-PG compass input (observe the compass bump signal vanish).
- Disable sugar odor: OLF goes silent; the fly stops tracking the odor.
- "Brain View" Camera: 30k neurons color-coded by membrane potential (red = spiking); track the E-PG compass bump.
Structure
data/ pre-loaded real connectome (~34 MB / 100 MB limit) + results_full.json
scripts/ build_brain.py (brain construction) · sim_full.py (offline whole-brain sim) · test_closedloop.js
viewer/ index.html · sim.js (LIF) · env.js (environment + closed-loop) ·
fly.js (fly + physics) · ui.js (panel + graphs) · main.js ·
brain.json (9.2 MB brain) · brain_stats.json · lib/three.min.js (local, offline OK)
Citations (external works used here)
- Dorkenwald et al., Nature 2024 — Neuronal wiring diagram of an adult brain (FlyWire).
- Schlegel et al., Nature 2024 — Whole-brain annotation and cell typing.
- Eckstein, Bates et al., Cell 2024 — neurotransmitter predictions.
- Shiu et al., Nature 2024 — whole-brain LIF model (code: philshiu/Drosophila_brain_model).
- Murthy Lab — flywire-network-analysis (lightweight v630 data mirror). - Google Research + HHMI Janelia + Cambridge — male CNS connectome (166k neurons), Cell 2026 (Context: The data used in this project is the FlyWire FAFB dataset, as it fits within 100 MB).
- Downloads last month
- 37
4-bit
16-bit