1
0
Fork
You've already forked LabLlama
1
Meshula Lab llama.cpp plugin
  • C++ 83.8%
  • Shell 5.5%
  • Python 4.9%
  • CMake 3.1%
  • HTML 2.7%
2026年06月08日 23:43:05 -07:00
agentic Qwen 3.6 notes 2026年06月02日 22:33:54 -07:00
docs organize headers more 2026年04月16日 23:39:54 +09:00
examples Modernize inner inference loop 2026年06月08日 23:43:05 -07:00
include/LabLlama Modernize inner inference loop 2026年06月08日 23:43:05 -07:00
src Modernize inner inference loop 2026年06月08日 23:43:05 -07:00
tests IEngine->BaseEngine 2026年05月10日 15:41:24 -07:00
.gitignore Ignore db9 lock files 2026年02月25日 21:47:56 -08:00
BUILD.md LabRaven->MeshulaLab 2026年05月10日 14:27:58 -07:00
CMakeLists.txt LabRaven->MeshulaLab 2026年05月10日 14:27:58 -07:00
LabLlamaConfig.cmake.in Use hashline file editing. Fix project installation 2026年04月09日 22:34:17 +09:00
LICENSE.txt Add README etc 2026年02月17日 00:12:13 -08:00
README.md organize headers more 2026年04月16日 23:39:54 +09:00

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 contexts
  • VirtualLLM — per-character state: system_prompt, stop_sequences, use_chat_template, busy flag
  • VirtualLLMRegistry — creates/looks up VirtualLLMs by string ID
  • FlockWorkPool — 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

  1. route_channels() — extract final channel if present
  2. Strip leading whitespace
  3. Strip [MARKER] prefixes (Mixtral [START] etc., bracket closes within 20 chars)
  4. Strip leading SpeakerName: prefix (prevents Dormouse: Dormouse: double-prefix in history)
  5. 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.mdThe 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:

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.