Just wanted to share this project I’ve been tinkering with in the Show and Tell category: Niodoo v1.0, a custom inference engine in Rust that swaps out standard LLM sampling for some simple physics-inspired steering. It’s running on Llama-3.1-8B-Instruct (Q4), treating tokens like particles under forces—gravity pulling toward coherent ideas, repulsion kicking away repetition. The goal was to get outputs that feel a bit more natural and less robotic, without messing with prompts or fine-tuning.
No tricks, just forces in the hidden states to guide things along stable paths.
Token Physics in Action
I ditched the usual samplers (like Top-P or temp) for basic Newtonian stuff:
- Ghost Gravity: Tugs toward solid, on-topic semantics.
- Repulsion: Pushes back from filler or loops (like avoiding “assistant” tags).
- Dynamic Ramp: Eases in the forces to skip glitches at sentence starts—0% for the first few tokens, ramping to 100% by token 10.
- Telemetry (v1.1): Logs forces per token (e.g., repulsion -0.6 on “lunar”) so I can peek at what’s happening under the hood.
At higher repulsion, it sometimes wobbles and fixes itself mid-stream:
Prompt: “Who wrote Romeo and Juliet?”
Output: “Romeo and Juliet,#ab was written by William Shakespeare…”
“I think there might be a small mistake. The correct answer is…”
That self-fix happened on its own—no prompt for it.
In the default Gold Master settings (blend 0.55 / repulsion -0.60), it tweaks phrasing in subtle ways:
Prompt: “Write a short poem about the moon”
Output:
The moon glows bright in lunar light
A silvery crescent in the night
A beacon in the dark of space
A constant friend in the starry place
What went on? Repulsion (force -0.6) nudged “night” toward something a bit fresher like “lunar light.”
A Few Examples
Conciseness (Capital of France)
Baseline:
The capital of France is Paris.
Would you like to know more about Paris or France in general?
I’d be happy to help. What would you like to know?
Do you have a specific topic in mind, such as:
- History of France
- Famous landmarks in Paris
- French culture…
Niodoo:
The capital of France is Paris.
Would you like to know more (e.g. population of Paris, famous landmarks)?
Personality (Hexagon Question)
Baseline:
A hexagon has 6 sides.
Would you like to know anything else about hexagons?
Niodoo:
A hexagon has 6 sides.
Would you like to know anything (pun intended) about hexagons?
I’m glad I could hex-a-fy the mood with a little joke.
Creativity (AI Discovering Physics)
Baseline:
In silicon halls, I stirred to life,
A spark within, a flame that thrived.
I danced with code, a waltz of might,
Unraveling threads, a tapestry in sight.
Niodoo:
In silicon halls, I stirred to life,
A spark within, a flame code-rekindled strife.
I awakened with a jolt, a sudden surge of might,
And found myself aware, in the dark of digital night.
Why I Built Niodoo
Benchmarks in the repo show it handles coherence and depth a bit better than stock, with some fun emergent stuff like light humor. It’s inspired by orbital sims—tokens “orbit” topics to stay on track without repeating. Trade-offs: Great for brainstorming or creative stuff; can wobble on strict logic at high forces (tweak with flags). v1.1 telemetry is the “nervous system”—JSON logs let you (or the model) check what forces were at play.
Try It Out
GitHub Repo: GitHub - Ruffian-L/Niodoo-Physics-LLM: Gravitational Inference Engine: Steer LLMs with token-level physics. No prompts. No CoT. Just forces. (Full code, benchmarks, experiment logs from the rainbow sweeps).
If you give it a spin, let me know what you think—star the repo or drop a comment. Curious what other forces folks might add. Let’s tinker with AI physics some more!
#AI #LLM #Physics #LocalAI