LSTN

LSTN (Liquid Spiking Trigram Network)

LSTN is an experimental text generation engine that models language not as static probabilities, but as a dynamic and “liquid” neural network. Each trigram (3-character sequence) acts as an individual neuron within a continuous temporal dynamic system.

Core Concept

Instead of calculating a classic probability distribution, the model simulates a network where energy (or “voltage”) flows from neuron to neuron. When a neuron “fires”, it emits its final character and propagates its energy to subsequent neurons based on learned synaptic weights.

This architecture allows for the emergence of pseudo-organic text generation, introducing concepts of refractory period, energy decay, and dynamic resuscitation.

Mechanism and Equations

1. Training (Ouroboros Engraving)

The training text is split into sliding windows of 4 characters to connect contiguous trigrams. For a context window $C = [c_1, c_2, c_3, c_4]$, a synaptic link is created between the source neuron $N_{src} = (c_1, c_2, c_3)$ and the target neuron $N_{tgt} = (c_2, c_3, c_4)$.

The synaptic weight $W_{src \to tgt}$ is incremented by the learning rate $\eta$ (LEARNING_RATE). After compiling the corpus, each neuron’s weights are normalized locally: \(W_{src \to tgt} = W_{src \to tgt} \times \frac{2.0}{\max(W_{src})}\)

2. Generation Dynamics (Infinite Dream)

At each time step of generation, the network evolves:

Installation & Usage

This type of model is highly relevant for experiments in emergence (complexity arising from very simple local rules) or uninterrupted organic text flows.

1. Prerequisites (Rust)

Windows:

winget install --id Rustlang.Rustup -e
rustup default stable

Linux / macOS:

curl https://sh.rustup.rs -sSf | sh
source "$HOME/.cargo/env"

2. Execution

From the root of the project, you can launch or compile the model as follows:

Development Mode:

cargo run --bin lstn

Optimized Build (Release):

cargo build --release --bin lstn
# The executable will be available in target/release/

Adjustable Hyperparameters (src/main.rs)

The internal physics are driven by several fundamental constants: