Active Fedference — Robust Federated Active Inference
Active Fedference is a research project that reimplements FedGVI (Federated
Generalized Variational Inference; Mildner, Hamelijnck, Giampouras & Damoulas,
2025, PMLR 267; arXiv:2502.00846) in the discrete-categorical setting and connects it to
the federated belief-sharing scenario of Friston et al.
(2024), Federated inference and belief sharing (Neurosci. Biobehav. Rev.
156:105500).
Contents
Start here
The complete path for applying the software to your own categorical beliefs is
the application guide. It covers installation,
the shared-state input contract, method selection, result diagnostics,
recipient-specific sharing, local process/socket boundaries, CLI receipts, and
troubleshooting.
The default runtime requires Python 3.11 or newer and
uv; it does not
require Torch or a GPU. These commands use a POSIX shell. To validate the
included labeled request, aggregate it, and verify its application receipt from
the root of the source revision containing this guide:
uv sync --locked
FEDFERENCE_APP_ROOT="$(mktemp -d /tmp/active-fedference-app.XXXXXX)"
uv run --locked fedference aggregate \
--input examples/data/labeled_aggregation_request.json \
--output-dir "$FEDFERENCE_APP_ROOT/run" \
--project-root .
uv run --locked fedference verify \
"$FEDFERENCE_APP_ROOT/run/receipt.json" \
--require-nominal-solver
This source carries the 1.1.0 release identity and reserved version DOI
10.5281/zenodo.22149133.
The intended UTC publication date is 2026-09-19. Check the
v1.1.0 release record
for publication and the five verified assets; a source version or reserved DOI
alone does not establish publication. See the
release installation and checksum instructions.
The v1.0.4 release predates this application interface; its DOI applies only
to that earlier release and PDF.
The same labeled envelope is available as a pure Python operation:
from fedference import LabeledAggregationRequest, aggregate_labeled
from pathlib import Path
request = LabeledAggregationRequest.from_json(
Path("examples/data/labeled_aggregation_request.json").read_text()
)
result = aggregate_labeled(request)
print(result.state_labels, result.aggregation.consensus)
print(result.aggregation.solver_status)
Every posterior must be a one-dimensional, finite, non-negative categorical
mass vector over the same ordered state labels. Caller masses are preserved in
the canonical request and exposed separately as normalized rows in the result.
For iterative rules, accept a result only under your application's explicit
policy for solver_status and fallback_events; see the
input and result contract.
Choose the narrowest interface that matches the job:
| Need |
Use |
Boundary |
| Fuse labeled caller data and retain evidence |
fedference aggregate |
Strict JSON plus request/result/application receipt |
| Fuse labeled caller data in Python |
aggregate_labeled |
Pure typed operation; no file I/O |
| Use the smallest numeric operation |
aggregate_result |
Labels/provenance remain caller-owned |
| Give each agent a shared belief |
share_round_result |
In-process; optionally excludes the recipient's own belief |
| Exercise process isolation |
fedference.federation.run_multiprocess_round_result |
Spawned worker processes on one machine |
| Exercise transport and replay |
fedference.federation.run_socket_round_result |
Loopback TCP, optional HMAC, digest-checked replay |
| Run a registered research profile |
fedference run / verify |
Isolated outputs plus a content-bound receipt |
| Use the BNN complement |
install the bnn extra |
Optional Torch path, outside the default import graph |
The complete five-example ladder is in examples/README.md,
and the source-owned application guide explains how to adapt each boundary.
It compares all three aggregation rules, distinguishes aggregation from belief
sharing and federation, and demonstrates application/research receipts and
replay. An application receipt proves declared input/output/provenance
integrity, not scientific validity or a downstream decision. These are
usage examples, not a complete Friston protocol reconstruction, a universal
robustness result, a production multi-host network, or confirmatory evidence.
Release records
The prior source-bound v1.0.4 reviewer snapshot is published and its release metadata
has been checked against the live Zenodo record. The public source, release tag,
and immutable research artifact now cross-reference the same version.
The released PDF embeds the published DOI and public repository URL as release
metadata; both cross-references were rechecked after publication. The v1.0.3,
v1.0.2, v1.0.1, and v0.1.0 records remain available as public prior versions.
This checkout is
the standalone development/review source; its configured origin is the canonical
ActiveInferenceInstitute/Active_Fedference
repository. docxology/active_fedference
remains a separate interim evidence mirror and is not configured as a remote here.
The headline result is a project-local identity. On the same categorical
inputs, the zero-robustness server path is bit-identical to the project's
log-linear pool. In code:
import numpy as np
from fedference.aggregation import log_linear_pool, robust_aggregate
local_posteriors = np.array(
[[0.70, 0.20, 0.10], [0.60, 0.30, 0.10], [0.10, 0.10, 0.80]],
dtype=np.float64,
)
# Exact project identity: zero-robustness robust pooling == log-linear pooling.
assert np.array_equal(
robust_aggregate(local_posteriors, robustness=0.0).consensus,
log_linear_pool(local_posteriors),
)
The comparison with Friston et al. (2024) Eq. 7 is a categorical
posterior-log-potential specialization, not a reconstruction of its complete
message-passing protocol. It assumes a shared categorical support,
q_n = softmax(m_n) for the admitted local message potential m_n, and a
fixed project weight mapping. Then softmax(sum_n w_n log q_n) equals
softmax(sum_n w_n m_n) because the local normalizers are state-independent.
It does not reproduce the source factor graph, cavity/message schedule, or all
source protocol choices.
Robustness is therefore a tested recovery-limit extension of the project's
categorical pool, not a competitor to or full reconstruction of Friston's
protocol. The source-conditional robust client loss has its own
bounded-influence result; the objective-backed variational server rule instead
bounds its raw effective-weight update and shows redescending behavior only on
declared paths. The client KLD/NLL/beta=0 limit and the server
zero-robustness identity are separate recovery statements. The sharper
server-side robust_aggregate rule is reported separately as a heuristic whose
proven property is the project-local recovery limit.
The problem this solves
The project log-linear pool is a product-of-experts: every agent holds a
multiplicative veto. Under the categorical bridge assumptions, it gives a
scoped view of the belief-sharing mechanism related to Friston. In the fixed
categorical world and attack geometry studied here, a miscalibrated or
adversarial sentinel can drag the colony off the truth; the source mechanism
itself is not a contamination experiment. FedGVI provides robust
federated-learning machinery, and Active Fedference evaluates this scoped
categorical bridge rather than claiming a universal literature gap.
Architecture
Thin orchestrators provide stable subprocess/CI boundaries for root selection,
validation, and release sequencing; reusable mathematics and publication
logic remain importable in src/, with named boundary adapters for evidence,
data, checkpoints, and transport.
The installed CLI follows the same modular contract: fedference_cli/__init__.py
is a compatibility facade, _parser.py owns the process grammar,
_commands.py owns registry-backed dispatch, and _support.py owns atomic
writes, output isolation, validation, and receipts. The package map and
extension recipe are documented in
src/fedference_cli/README.md and
docs/development/modularity.md.
flowchart TD
accTitle: Reader-level Active Fedference architecture
accDescr: Callers enter through typed library or CLI boundaries, the mathematical core owns aggregation, explicit adapters own effects, and source-bound reports feed accessible publication surfaces.
callers["Library callers, applications, and tests"] --> boundary["Typed Python API and installed CLI"]
boundary --> core["NumPy/SciPy mathematical and active-inference core"]
core --> federation["In-process, spawned-process, and loopback federation adapters"]
core --> analysis["Typed analysis reports and evidence receipts"]
adapters["Explicit data, checkpoint, replay, and optional-Torch boundaries"] --> core
config["Source configuration, registries, and dependency lock"] --> core
config --> analysis
analysis --> publication["Figures, hydrated manuscript, HTML, PDF, and slides"]
publication --> gates["Freshness, accessibility, package, and release gates"]
Text equivalent.
| From |
To |
Meaning |
| Library callers, applications, and tests |
Typed Python API and installed CLI |
Callers select the narrowest stable boundary instead of reimplementing domain logic. |
| Typed boundary |
NumPy/SciPy core |
Validated requests delegate to reusable aggregation and active-inference operations. |
| Core |
Federation adapters |
In-process, process, and loopback routes reuse the same aggregation rules. |
| Explicit adapters |
Core |
Data, checkpoint, replay, and optional-Torch effects enter only through named boundaries. |
| Configuration and registries |
Core and typed analysis |
Source-owned controls determine execution and report interpretation. |
| Typed analysis |
Reader surfaces |
Reports feed figures and hydrated HTML, PDF, and slide outputs. |
| Reader surfaces |
Publication gates |
Freshness, accessibility, packaging, and release checks remain separate from scientific claims and publication authority. |
The architecture diagram is source documentation, not an import-graph claim:
the executable layer gate remains src/fedference/-only and the report-schema
validator remains the single JSON write boundary. All README/docs Mermaid
blocks use GitHub-compatible fenced syntax. Check them without a browser with:
uv run --locked python scripts/validate_mermaid.py
uv run --locked python scripts/validate_mermaid.py --render --renderer npx \
--output-dir .tmp/mermaid-render
The second command invokes Mermaid CLI and writes only review scratch files;
the .mmd