Round-trip demo: Aion LLM → Aion Core → Aion Blockchain + social-media

This repo implements the same persistence / trust idea at four scales:

  1. Token-level: aion-llm FractalLM produces usage.persistence (mean/min/var of per-token \(\mathcal{R}\)).
  2. Task-level: aion-core stores that metadata on the LLM message (message.persistence) so the prediction market (or a future hook) can treat it as a prior.
  3. Vote-level: blockchain pot-core updates trust via a proper log score / KL margin.
  4. User-level: social-media hai-core scores votes via sequential KL reduction.

This page walks through wiring the loop end-to-end.


0) Prereqs


1) aion-llm: OpenAI-compatible endpoint + persistence

Start the aion-llm dashboard server and load a checkpoint, then call:

curl -s http://localhost:8790/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{
    "model":"checkpoint",
    "stream": false,
    "messages": [{"role":"user","content":"Explain persistence ratio in one paragraph."}],
    "max_tokens": 128,
    "temperature": 0.7
  }' | jq '.usage'

You should see:

{
  "prompt_tokens":  ..., 
  "completion_tokens": ...,
  "total_tokens": ...,
  "persistence": {
    "R_mean": ...,
    "R_min": ...,
    "R_var": ...,
    "R_min_token_idx": ...
  }
}

2) aion-core: store persistence metadata on the message

Point aion-core Loop at aion-llm:

export AION_OPENAI_BASEURL=http://aion-llm-webui:8790
export AION_OPENAI_API_KEY=dummy
export AION_MODEL_NAME=checkpoint

When the Loop posts the assistant message into the Processor, it attaches:

{
  "role": "assistant",
  "content": "...",
  "persistence": {"R_mean": ..., "R_min": ...}
}

(See aion-core/loop/loop_engine.py.)


3) aion-core → blockchain bridge (pot-mcp)

Start blockchain_bridge and ensure pot-mcp exists at POT_MCP_BIN.

Example calls:

curl -s http://localhost:9500/chain_status | jq
curl -s http://localhost:9500/list_voters | jq

To submit a market bet whose probability derives from a task persistence score \(\mathcal{R}_T\):

p = R_T / (1 + R_T)
probs = [p_success, p_failed]  (or however the market outcomes are ordered)

4) aion-core → social-media bridge (hai-api)

Start social_bridge with HAI_API_URL + HAI_API_TOKEN.

Example calls:

curl -s http://localhost:9600/health | jq
curl -s http://localhost:9600/trust/<user_id> | jq

A task \(\mathcal{R}_T\) becomes a vote probability in HAI:

p = R_T / (1 + R_T)

5) The loop closes

6) Reverse learning loop: formed information back into weights

The outward path above is only half the story. The other half is:

So the stack is not only aion-llm -> aion-core -> blockchain; it is also reality -> blockchain/aion-core -> curated traces -> aion-llm weights.