Expand description
Micro HNSW v2.3 - Neuromorphic HNSW with Novel Discoveries Target: <12KB WASM with multi-core support
Features:
- Multiple distance metrics (L2, Cosine, Dot)
- Multi-core sharding (256 cores × 32 vectors = 8K total)
- Batch operations with 4-vector batching
- Beam search for better recall
- Result merging across cores
- Node types for Cypher-style typed graphs (16 types)
- Edge weights for GNN message passing
- Vector updates for online learning/GNN propagation
- Spiking Neural Network integration with LIF neurons
- STDP (Spike-Timing Dependent Plasticity) learning
§Novel Neuromorphic Discoveries (v2.3)
- Spike-Timing Vector Encoding: Convert vectors to temporal spike patterns
- Homeostatic Plasticity: Self-stabilizing network activity
- Oscillatory Resonance: Frequency-tuned search amplification
- Temporal Pattern Recognition: Spike-based similarity matching
- Winner-Take-All Circuits: Competitive neural selection
- Dendritic Computation: Non-linear local processing
Structs§
Enums§
Functions§
- aggregate_
neighbors - Aggregate neighbors into DELTA buffer (GNN message passing)
- clear_
global - Clear global results
- compute_
resonance - Compute resonance boost for a neuron based on phase alignment Neurons in sync with gamma get amplified
- count
- dendrite_
inject - Inject input to specific dendritic compartment
- dendrite_
integrate - Dendritic integration with nonlinearity Multiple coincident inputs on same branch get amplified
- dendrite_
propagate - Propagate spikes through dendritic tree (not just soma)
- dendrite_
reset - Reset dendritic compartments
- encode_
vector_ to_ spikes - Encode vector to temporal spike pattern (rate-to-time conversion) Higher values → earlier spikes (first-spike coding) Returns encoded pattern as 32-bit bitmask
- get_
capacity - get_
core_ id - get_
delta_ ptr - Get delta buffer pointer for reading aggregated values
- get_
dims - get_
edge_ weight - Get node edge weight
- get_
global_ ptr - get_
insert_ ptr - get_
metric - get_
network_ activity - Get total network activity (sum of spike rates)
- get_
node_ type - Get node type (0-15)
- get_
pattern - Get temporal spike pattern for a neuron
- get_
query_ ptr - get_
result_ ptr - get_
spike_ rate - Get current spike rate estimate
- hnsw_
to_ snn - Combined HNSW-SNN cycle: search → convert to currents → inject Useful for linking vector similarity to neural activation
- homeostatic_
update - Apply homeostatic plasticity: adjust thresholds to maintain target rate
- init
- Initialize: init(dims, metric, core_id) metric: 0=L2, 1=Cosine, 2=Dot
- insert
- Insert vector from INSERT buffer, returns index or 255 if full
- merge
- Merge results from another core into global buffer
- neuromorphic_
search - Advanced neuromorphic search with all novel features Combines: HNSW graph, spike timing, oscillation, WTA
- oscillator_
get_ phase - Get current oscillator phase (0 to 2π)
- oscillator_
step - Update oscillator phase
- pattern_
correlate - Temporal correlation: find neurons with similar spike history
- pattern_
match - Match pattern against stored patterns (Hamming similarity) Returns best matching neuron index
- pattern_
record - Record current spike state into pattern buffer (shift register)
- resonance_
search - Apply resonance-modulated search boost Query matches are enhanced when neuron is in favorable phase
- search
- Search for k nearest neighbors using beam search
- set_
delta_ ptr - Get mutable delta buffer pointer
- set_
edge_ weight - Set node edge weight (uniform for all edges from this node, 0-255)
- set_
node_ type - Set node type (0-15) for Cypher-style typed queries Types packed 2 per byte (4 bits each)
- snn_
get_ membrane - Get membrane potential
- snn_
get_ spikes - Get spike bitset (32 neurons packed into u32)
- snn_
get_ time - Get current simulation time
- snn_
inject - Inject current into a neuron (adds to membrane potential)
- snn_
propagate - Propagate spikes to neighbors (injects current based on edge weights) Call after snn_step to propagate activity
- snn_
reset - Reset SNN state for all neurons
- snn_
set_ membrane - Set membrane potential for a neuron
- snn_
set_ threshold - Set firing threshold for a neuron
- snn_
spiked - Get spike status (1 if spiked last step, 0 otherwise)
- snn_
stdp - STDP learning: adjust edge weights based on spike timing Call after snn_step to apply plasticity
- snn_
step - LIF neuron step: simulate one timestep (dt in ms) Returns number of neurons that spiked
- snn_
tick - Combined: step + propagate + optionally STDP Returns spike count
- spike_
search - Search using spike-timing representation Novel: temporal code matching instead of distance
- spike_
timing_ similarity - Compute spike-timing similarity between two spike patterns Uses Victor-Purpura-inspired metric: count matching spike times
- type_
matches - Check if node type matches mask (for filtering in JS/host)
- update_
vector - Update vector: v = v + alpha * delta (in-place)
- wta_
compete - Run WTA competition: only highest membrane potential survives Returns winner index (or 255 if no winner)
- wta_
reset - Reset WTA state
- wta_
soft - Soft WTA: proportional inhibition based on rank