-
Notifications
You must be signed in to change notification settings - Fork 2
Hive episodes
A shared desk cannot converge on its own. A message picks one responder off the
ladder, that agent replies, and the interaction ends.
tinyhivemind-hive is what happens when you want the room to actually decide
something. Every mechanism below is borrowed from something that already works
without a leader: see Further reading for the sources and
the Glossary for the vocabulary.
step(state, transcript, roster, desks, policy) -> HiveStepThat is the entire interface. It is a pure fold over arguments the caller
already holds. There is no trait here for a host to implement, and no storage:
EpisodeState is returned, never applied, and the caller commits it after its
turn is durably appended.
Every score inside is
fixed-point integer, so
every payload derives Eq and every fold reproduces exactly. The
implementation is
crates/tinyhivemind-hive/src/episode/.
pub enum HiveStep {
Speak { turn: Box<HiveTurn> },
Converged { topic: TopicId, standing: Box<TopicStanding> },
Deadlocked { topics: Vec<TopicId> },
Exhausted { spent: u32 },
Idle,
}There is deliberately no variant carrying more than one turn. HiveTurn holds
one agent_id, one phase, one visibility, one reason it won the floor, and the
state to commit afterwards. The one-message-one-turn rule is a type invariant
here rather than a convention somebody has to remember.
An episode always terminates, and it always terminates for a reason it can
name. Deadlocked and Exhausted
are outcomes, not errors: a room that could not decide should say so rather
than produce an answer nobody supported.
Agents deposit typed markers in the transcript. Nothing addresses anything.
This is stigmergy in
Grassé's sense, and
the transcript is the medium. See Trace grammar and
src/trace/.
A weighted sum of an exponentially decaying recency term, a standing importance term, and a caller-supplied relevance term. The shape is the memory-stream retrieval score from Generative Agents. Where that paper and its released code disagree on weights, this follows the code, and decay is applied by rank in sequence rather than elapsed time, which is what a transcript with no clock can support.
Decay is not optional. Without it the participant who spoke first holds the
floor forever, which is the failure mode
ant trails
avoid only because pheromone
evaporates. See
src/salience/.
A topic carries when threshold distinct participants have supported it within
the last window sequences. Not when it holds a majority of anything: the
count is local, order independent, and
idempotent, so a participant
catching up late folds to the same standing as one that watched live. This is
quorum sensing, in the version
honeybee swarms use
rather than the bacterial one it is named for. Under require_grounded,
support citing nothing is ignored entirely and joins neither the supporter set
nor the weight.
Cross-inhibition targets the advocate, not the option. An objection naming a
message removes that message's author from the supporter set of the topic they
were advocating. Subtracting from a score cannot break a tie between two
equally supported options. Silencing an advocate can, and that asymmetry is the
whole reason the mechanism is shaped this way. It comes from the stop signals
honeybee swarms use
to settle a nest site, not from voting theory, and it has the same shape as
lateral inhibition in
neural systems. See
src/quorum/.
Every eligible member computes an urge from the salience field and its own
affinity, and floor_holder takes the
argmax. A member whose urge does not
reach its
response threshold
does not bid at all, which is how Idle happens. The arrangement is
Pandemonium's
decision demon and the entomologists' response-threshold model of division of
labour, which are the same mechanism reached from two directions. See
src/attention/.
Taking the argmax rather than everyone above threshold is what enforces one message, one turn. The bound is not checked after the fact. There is no way to express two winners.
Two corrections fold into the bid rather than sitting beside it. Dominance
share is measured over grounded, surviving contributions rather than raw
message count, because raw count is a proxy an agent inflates for free, and
equality of turn taking is one of
the few robust predictors of a group's collective performance. Repetition
scores nothing once a topic has repetition_cap distinct supporters, because
the rumour has met enough peers who already know it. Step repetition is among
the
most commonly observed multi-agent failures,
and that is a protocol bug rather than a model one.
Bids also carry bonuses for a member that was cited or objected to, for a member that has backed neither side of a deadlock, and for the least-heard member when the room is lopsided, plus a penalty for a member over the dominance cap.
pub enum Phase { Deliberate, Commit }The transition is one way. Deliberation and commitment are different kinds of turn, and a room that has settled does not reopen because a late trace arrived.
commit_boundary records the sequence standings were folded to when the phase
first flipped. A !commit trace only counts toward Converged when its
sequence is strictly greater than that boundary, so a trace that happens to
share the carried topic and predates the commit turn cannot be misread as
evidence that turn recorded a decision.
pub enum Visibility { Blind, Full }A hive mind is normally built as fan-out: publish a task, wake N agents, gather the replies. This crate does not, and the reasoning is not only about safety.
Sparse communication topologies match or beat fully connected ones in multi-agent debate at much lower cost. Conformity rises with interaction time, so convergence is a warning signal as much as a success signal, which is the same concern groupthink names in people. Parallel fan-out wins only on genuinely decomposable work, and a room choosing between options is not that.
The one thing fan-out really buys is independence: a first position formed
without sight of peers. This crate buys that as Visibility::Blind, a filter
on what one turn sees, which costs a projection flag instead of concurrency.
It is worth 24 points of accuracy in the benchmark. Without it, rooms cascade onto whatever was proposed first and land level with a single agent. See Benchmarks and ADR 0002.
It is not a claim that group deliberation produces better answers. Almost every positive multi-agent result in the literature is confounded by compute, and self-consistency at a matched token budget is the honest control. This is a protocol for bounded deliberation with an auditable termination reason, and nothing more.
tinyhivemind is GPL-3.0-only. Built by @senamakel.
Start here
The algebra
- Shared medium
- Desks and rosters
- Mentions
- Cross-desk referral
- Transcript projection
- Threads
- Recall
- Responder ladder
Hive mechanics
Working on it
Reference