- C++ 83.8%
- Shell 5.5%
- Python 4.9%
- CMake 3.1%
- HTML 2.7%
|
|
||
|---|---|---|
| agentic | Qwen 3.6 notes | |
| docs | organize headers more | |
| examples | Modernize inner inference loop | |
| include/LabLlama | Modernize inner inference loop | |
| src | Modernize inner inference loop | |
| tests | IEngine->BaseEngine | |
| .gitignore | Ignore db9 lock files | |
| BUILD.md | LabRaven->MeshulaLab | |
| CMakeLists.txt | LabRaven->MeshulaLab | |
| LabLlamaConfig.cmake.in | Use hashline file editing. Fix project installation | |
| LICENSE.txt | Add README etc | |
| README.md | organize headers more | |
mLabLlama
A research platform for multi-agent LLM orchestration using shared model weights.
The central experiment: what happens when multiple agents share a single model in memory, but each sees only a bounded recent window of a shared conversation? The answer — coherent thematic arcs, emergent narrative structure, and occasional auto-reflexive moments — is documented in the research findings below.
The architecture is closer to Minsky's Society of Mind than to any conventional LLM usage pattern. A single set of model weights, asked the same question from N different partial vantage points, produces behaviour that no single agent planned. Ideas propagate across agent boundaries through shared conversation history. Coherence is not enforced — it emerges from overlap.
Architecture
LlamaCppEngine— wraps llama.cpp, owns the shared model (read-only), creates per-call contextsVirtualLLM— per-character state: system_prompt, stop_sequences, use_chat_template, busy flagVirtualLLMRegistry— creates/looks up VirtualLLMs by string IDFlockWorkPool— priority queue + worker threads; submits to engine serially (one model)
Chat Templates
Base Models
use_chat_template = false
system_prompt + "\n\n" + conversation_history + "Name:" + agent name
- Works well for Mixtral, Codestral, and other base models
- Use character name stop sequences + [END] EOT marker
RLHF'd Models
`use_chat_template = true
system prompt in <|system|> slot, history as user turn
- Needed for heavily RLHF'd models (gpt-oss, etc.)
- Do NOT set stop sequences — they fire inside the analysis channel, killing generation
- Use 600+ max_tokens; analysis channel consumes ~200-300 before final channel
OpenAI style channel routing
- Models emit
<|channel|>analysis<|message|>(reasoning) then<|channel|>final<|message|>- Extract final channel for display; log analysis channel for forensics
Response post-processing order
route_channels()— extract final channel if present- Strip leading whitespace
- Strip
[MARKER]prefixes (Mixtral[START]etc., bracket closes within 20 chars) - Strip leading
SpeakerName:prefix (preventsDormouse: Dormouse:double-prefix in history) - Strip trailing whitespace
GPU/threading on macOS
n_gpu_layers = 999— Metal caps to actual layer count; effectively "all layers"n_threads = hardware_concurrency() / 2— sweet spot for autoregressive decode- Unified memory: no separate VRAM budget; offloading everything usually correct
Theoretical Frame: Flock as Distributed Cognition
See distributed_cognition.md for extended notes.
- The flock is a form of distributed cognition, rather than simple completion or reasoning in a single context — the system is closer to Minsky's Society of Mind than to a chain-of-thought prompt.
- Ideas carry across agent boundaries through shared conversation history (emergent, not planned)
- Example: the spoon — mentioned in passing by March Hare, elaborated across 4 successive turns by different agents who each see only recent context, producing a narrative arc no single agent authored
- The narrator call functions as a global workspace broadcast: a one-sentence state update that each agent receives as its scene-frame, loosely analogous to Baars' global workspace theory
recent_turns(n)bounds the context window per agent — agents are intentionally limited; coherence emerges from overlap, not omniscience
Research findings
docs/presentation.md — The Tea Party Mind: Emergent Distributed Cognition via Shared-Weight LLM Orchestration
Covers the architecture, the carrying factor, the Narrator as a Global Workspace analogue, strange loops, the Society of Mind theoretical frame, engineering decisions and their consequences, per-model results, and a concrete lower bound on model viability. Includes curated transcripts and an annotated bibliography.
Building and running
BUILD.md — step-by-step instructions for building llama.cpp, downloading models, launching servers, using the browser UI, the group chat interface, and building the C++ Wonderland Tea Party demo.
Acknowledgments
llama.cpp — This project is built entirely on top of llama.cpp by Georgi Gerganov and contributors. The shared-weights / ephemeral-context architecture that makes the Flock practical is a direct consequence of llama.cpp's design. Without it, loading a 120B model N times would be the only option.
Open-weight model providers — The Flock runs on models released by researchers who chose to share their work openly. The models used in this project's experiments:
- Qwen3-Coder-Next (Alibaba Cloud / Qwen Team)
- Mixtral-8x7B (Mistral AI)
- Codestral-22B (Mistral AI)
- gpt-oss-120B (Microsoft)
- Qwen2.5-1.5B-Instruct (Alibaba Cloud / Qwen Team)
- Pleias-350m-Preview (PleIAs)
The diversity of these models — in size, training distribution, and character of output — is what makes the comparative findings meaningful.
Authorship and AI Disclosure
This project is the original work of Nick Porcino, who served as the primary architect and researcher. All conceptual frameworks, experimental methodologiies, system prompt engineering, and architectural designs are the sole creative output of the human author.
Large Language Models (Claude/Anthropic and Qwen3-Coder-Next) were utilized as sophisticated technical instruments for the iterative drafting of documentation, analysis of data transcripts, and code implementation under the author's direct supervision and substantive revision. All final outputs have been reviewed, edited, and verified by the author to ensure creative and technical alignment.
The specific system prompts, behavioral constraints, and multi-turn instruction sets utlized in this project are the original creative expressions of Nick Porcino.
While the outputs generated by these prompts may be used for documentation or analysis, the prompts themselves reprsent original literary and logical works. They consitute the "Human-in-the-loop" architecure and are protected under copyright as the author's unique method of directing computational resources.
License
BSD 3-Clause. See LICENSE.
Scholia
The spoon arc was nobody's idea in particular.