Files
papers/zen/zen-dso-protocol.tex
zooqueenandHanzo Dev 44ec401a31 ci: a gate that can fail, and the 24 papers it catches
`make -k all` returned 0 over any number of broken papers, so CI was green the
whole time it existed. Four things had to be true for that:

  - every recipe line ended in `|| true` and the rule printed "FAIL" instead of
    exiting, so make never saw a failure;
  - nonstopmode emits a PDF for almost any input, so "the PDF exists" is not
    the same question as "the paper compiled" — zen-nano_whitepaper produced
    one through 23 LaTeX errors;
  - pdfs/ was tracked, so a checkout handed the "check every paper came out"
    step 100 of the PDFs it was about to look for;
  - discovery was three wildcards, so 69 of the repo's 219 papers were
    compiled by nothing at all, defense/ by a second copy of the same
    swallowing loop written inline in ci.yml.

The rule is now one latexmk per paper and its exit status is the gate:
-halt-on-error (no PDF from a broken paper), -bibtex (a declared bibliography
must resolve rather than being skipped when the .bib is absent), -Werror (an
undefined citation is a defect, not a log note), -cd (each paper compiles from
its own directory, so zen/ finds references.bib and defense/ finds
hanzo-defense.sty). .DELETE_ON_ERROR so a failed run leaves nothing behind,
and pdfs/ is untracked because it is output.

Run against the tree it was guarding, the honest gate fails 24 papers:

  6  \begin{itemize} with its backslash-b eaten, leaving a bare `egin{itemize}`
     and no \end — artist, designer-instruct, eco, nano, next, omni
  3  the same list with the opener deleted outright, so five \item stood in no
     environment — artist-edit, designer-thinking, scribe
  4  \and in a cover page's raw \@author: it expands to \end{tabular} and closed
     a tabular nothing had opened, and \thanks left hyperref pointing at a
     footnote anchor that was never created; plus five stray \end{table} at the
     end of those documents — director, foley, musician, video
  9  \color{gray} under \usepackage{color}, which defines eight names and not
     that one — xcolor is the superset the working papers already load
  6  \bibliography{references} naming a database that was never written, so
     every citation rendered [?] — zen/references.bib now holds all 27 works
  9  \bibliographystyle+\bibliography in papers with no \cite at all — dropped
  3  characters pdflatex has no glyph for: CO₂ -> CO\textsubscript{2},
     ↔ -> $\leftrightarrow$, Persian letters -> their code points, the
     SentencePiece marker -> \textvisiblespace
  1  \IF{...} \COMMENT{...}: algorithmic's \IF opens a list and the comment
     landed in it before any \item; the comment slot is \IF[...]{...}
  1  \ref{eq:anchor_update} to an equation the paper never writes

All 219 papers now compile from a clean tree: `make -k all` exits 0.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-28 17:35:30 -07:00

459 lines
18 KiB
TeX

\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{definition}[theorem]{Definition}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{listings}
\usepackage{color}
\usepackage{booktabs}
\usepackage{float}
\usepackage{geometry}
\usepackage{algorithm}
\usepackage{algorithmic}
\geometry{margin=1in}
\definecolor{zenblue}{RGB}{41,121,255}
\hypersetup{colorlinks=true,linkcolor=zenblue,urlcolor=zenblue,citecolor=zenblue}
\title{\textbf{DSO: Decentralized Semantic Optimization Protocol}\\
\large Technical Report v2025.06}
\author{Antje Worring, Zach Kelling, Zen LM Research Team\\
\texttt{[email protected]}}
\date{June 2025}
\begin{document}
\maketitle
\begin{abstract}
We present the Decentralized Semantic Optimization (DSO) protocol (ZIP-001), a
peer-to-peer gradient aggregation scheme that enables heterogeneous AI models to
collaboratively improve through semantics-aware consensus. Unlike centralized
parameter servers or standard federated averaging, DSO nodes exchange compressed
\emph{semantic gradient summaries} rather than raw parameter updates, forming a
gossip-based overlay that converges to a semantically coherent global optimum.
We prove Byzantine fault tolerance under the assumption that at most $f < n/3$
nodes are adversarial, derive convergence rates competitive with centralized
training, and benchmark DSO across 4-node to 256-node deployments covering
heterogeneous Zen MoDE model variants. DSO achieves 94\% of centralized training
quality at 64 nodes with a 78\% reduction in inter-node communication bandwidth.
\end{abstract}
\tableofcontents
\newpage
%% -----------------------------------------------------------------------
\section{Introduction}
\label{sec:intro}
%% -----------------------------------------------------------------------
Centralized training of large language models concentrates compute, data, and gradient
aggregation authority in a single entity. This creates single points of failure,
bandwidth bottlenecks, and excludes participants who cannot contribute raw data to a
shared server. As AI model training scales to federated, multi-organizational settings —
where participating nodes may be research institutions, community contributors, or
edge operators — a fully decentralized protocol is required.
The Decentralized Semantic Optimization (DSO) protocol, specified in Zoo Improvement
Proposal ZIP-001, addresses this through:
\begin{enumerate}
\item \textbf{Peer-to-Peer Semantic Aggregation}: nodes exchange semantic gradient
summaries via a gossip overlay, eliminating the need for a central parameter server.
\item \textbf{Byzantine-Robust Median}: gradient aggregation uses coordinate-wise
geometric median with provable Byzantine resilience, tolerating up to $f < n/3$
malicious nodes.
\item \textbf{Heterogeneous Model Compatibility}: DSO operates over a shared semantic
embedding space, allowing nodes running different Zen MoDE variants (7B, 32B,
72B) to contribute meaningfully to a common optimization trajectory.
\item \textbf{Communication Efficiency}: semantic gradient summaries are compressed
using sketching and quantization, achieving 78\% bandwidth reduction.
\end{enumerate}
\subsection{Threat Model}
We consider a synchronous network of $n$ nodes, of which at most $f$ are Byzantine
(arbitrary behavior, including sending crafted gradient updates). Honest nodes follow
the DSO protocol. The network is eventually synchronous: messages arrive within a
known bound $\Delta$ after the synchronization round begins.
%% -----------------------------------------------------------------------
\section{Background}
\label{sec:background}
%% -----------------------------------------------------------------------
\subsection{Federated Learning}
Federated Averaging (FedAvg) \cite{mcmahan2017federated} aggregates local model updates
at a central server. This introduces a trust bottleneck and communication bottleneck.
DSO eliminates the server by replacing the all-reduce with a gossip protocol over a
peer-to-peer overlay graph.
\subsection{Byzantine-Robust Aggregation}
Byzantine-robust gradient aggregation methods include coordinate-wise median
\cite{yin2018byzantine}, geometric median \cite{chen2017distributed}, and Krum
\cite{blanchard2017machine}. DSO adopts the geometric median for its statistical
robustness and compatibility with high-dimensional gradient vectors.
\subsection{Gossip Protocols}
Gossip (epidemic) protocols \cite{kermarrec2007gossiping} achieve eventual consistency
in distributed systems with logarithmic message complexity. DSO adapts gossip to
gradient aggregation by defining a convergence criterion over semantic embedding distance
rather than parameter distance.
%% -----------------------------------------------------------------------
\section{DSO Protocol Specification}
\label{sec:protocol}
%% -----------------------------------------------------------------------
\subsection{Semantic Gradient Summary}
Rather than transmitting raw gradients $g \in \mathbb{R}^p$ (potentially terabytes
for a 72B-parameter model), each DSO node computes and transmits a \emph{semantic
gradient summary} $\hat{g} \in \mathbb{R}^{d_s}$ where $d_s \ll p$:
\begin{equation}
\hat{g} = \mathbf{S} \cdot g
\label{eq:sketch}
\end{equation}
where $\mathbf{S} \in \mathbb{R}^{d_s \times p}$ is a random Johnson-Lindenstrauss
sketching matrix satisfying:
\begin{equation}
(1 - \varepsilon)\|g\|^2 \leq \|\hat{g}\|^2 \leq (1+\varepsilon)\|g\|^2
\label{eq:jl}
\end{equation}
with probability $1 - \delta$, for $d_s = O(\varepsilon^{-2} \log(1/\delta))$.
In addition, the summary includes a \emph{semantic signature} $\sigma \in \mathbb{R}^M$:
\begin{equation}
\sigma_j = \langle g, \nabla_\theta \phi(e_j) \rangle
\label{eq:signature}
\end{equation}
where $\phi(e_j)$ is the gradient of the loss with respect to anchor embedding $e_j$.
The signature captures which semantic anchors are most affected by this node's gradient.
\subsection{Gossip Overlay}
Nodes form a random $r$-regular gossip graph $G = (V, E)$ where $|V| = n$ and each
node has $r = O(\log n)$ peers. At each gossip round $t$:
\begin{enumerate}
\item Each node $i$ selects a random subset $P_i \subset \mathcal{N}(i)$ of $k$ peers.
\item Node $i$ broadcasts its current semantic gradient summary $\hat{g}_i^{(t)}$
to all $p \in P_i$.
\item Node $i$ collects summaries from all nodes that selected it.
\item Node $i$ updates its local aggregate via Byzantine-robust aggregation.
\end{enumerate}
\subsection{Byzantine-Robust Aggregation}
Given received summaries $\hat{g}_1, \ldots, \hat{g}_m$ from $m$ peers, node $i$
computes the aggregated gradient via the \emph{iterative geometric median}:
\begin{equation}
\mu^{(k+1)} = \frac{\sum_{j=1}^{m} w_j^{(k)} \hat{g}_j}{\sum_{j=1}^{m} w_j^{(k)}},
\quad w_j^{(k)} = \frac{1}{\|\hat{g}_j - \mu^{(k)}\| + \epsilon}
\label{eq:geomed}
\end{equation}
converging to the Weiszfeld geometric median. This estimator is $(1, \delta)$-Byzantine
robust: if at most $f$ of the $m$ inputs are adversarial, the geometric median
$\mu$ satisfies:
\begin{equation}
\|\mu - \bar{g}\| \leq C \cdot \frac{f}{m - 2f} \cdot \sigma_g
\label{eq:robust_bound}
\end{equation}
where $\bar{g}$ is the true mean of honest gradients, $\sigma_g$ is their standard
deviation, and $C$ is a universal constant.
\subsection{Semantic Coherence Gate}
Before applying an aggregated gradient, DSO nodes apply a \emph{semantic coherence
gate} that filters aggregated updates whose semantic signature $\sigma$ deviates
excessively from the node's local signature:
\begin{equation}
\text{accept} \iff
\frac{\langle \sigma_{\text{local}}, \sigma_{\text{agg}} \rangle}
{\|\sigma_{\text{local}}\|\|\sigma_{\text{agg}}\|} \geq \tau_{\text{gate}}
\label{eq:gate}
\end{equation}
where $\tau_{\text{gate}} \in [0,1]$ is a coherence threshold. Rejected updates are
discarded, providing an additional layer of semantic quality control beyond the
Byzantine median.
\subsection{Protocol Summary}
\begin{algorithm}[H]
\caption{DSO Node Update (one gossip round)}
\begin{algorithmic}[1]
\STATE Compute local gradient $g_i \leftarrow \nabla_\theta \mathcal{L}_i(\theta)$
\STATE Compute semantic summary $\hat{g}_i \leftarrow \mathbf{S} \cdot g_i$
\STATE Compute semantic signature $\sigma_i$
\STATE Broadcast $(\hat{g}_i, \sigma_i)$ to random peers $P_i \subseteq \mathcal{N}(i)$
\STATE Collect received summaries $\{(\hat{g}_j, \sigma_j)\}_{j \in R_i}$
\STATE Filter by coherence gate (Eq.~\ref{eq:gate}): remove incoherent summaries
\STATE Compute Byzantine median $\mu_i \leftarrow \text{GeoMed}(\hat{g}_i \cup \{\hat{g}_j\})$
\STATE Reconstruct full gradient $\hat{G}_i \leftarrow \mathbf{S}^\dagger \mu_i$
\STATE Apply optimizer update: $\theta \leftarrow \theta - \eta \hat{G}_i$
\STATE Update local anchor set
\end{algorithmic}
\end{algorithm}
%% -----------------------------------------------------------------------
\section{Theoretical Analysis}
\label{sec:theory}
%% -----------------------------------------------------------------------
\subsection{Byzantine Fault Tolerance}
\begin{theorem}[DSO Byzantine Tolerance]
\label{thm:byzantine}
Let $n$ be the number of DSO nodes, $f < n/3$ Byzantine, and $r = O(\log n)$ the
gossip degree. After $T = O(\log n)$ gossip rounds, with probability $1 - 1/n^2$:
\begin{equation}
\|\mu - \bar{g}\|^2 \leq \frac{C_1 f^2}{(n-f)^2} \sigma_g^2 + C_2 \varepsilon \|g\|^2
\label{eq:byz_thm}
\end{equation}
where $\bar{g}$ is the honest-node mean gradient, $\sigma_g^2$ is the honest gradient
variance, and $\varepsilon$ is the sketch distortion.
\end{theorem}
The first term captures Byzantine contamination and vanishes as $f/n \to 0$. The second
term captures sketch approximation error and vanishes as $\varepsilon \to 0$ (at the
cost of higher communication volume).
\subsection{Convergence Rate}
\begin{theorem}[DSO Convergence]
\label{thm:convergence}
Under the same assumptions as Theorem~\ref{thm:byzantine}, with learning rate
$\eta = O(1/\sqrt{T})$, DSO achieves after $T$ rounds:
\begin{equation}
\min_{t \leq T} \mathbb{E}\|\nabla \mathcal{L}(\theta_t)\|^2
\leq \frac{C_3}{\sqrt{T}} + \frac{C_4 f}{n-f} \sigma_g + C_5 \varepsilon
\label{eq:dso_convergence}
\end{equation}
The $O(1/\sqrt{T})$ term matches centralized SGD. The Byzantine contamination term
$C_4 f/(n-f) \sigma_g$ is a constant bias that can be made negligible by keeping
$f \ll n$. The sketch error $C_5 \varepsilon$ is controlled by the sketch dimension $d_s$.
\end{theorem}
\subsection{Communication Complexity}
Each gossip round requires each node to send $d_s + M$ floats per peer. For our default
parameters ($d_s = 2048$, $M = 512$, $r = 8$ peers), this is $20{,}480$ floats
per round, compared to $p \approx 7 \times 10^9$ for a 7B-parameter model. This is a
compression ratio of approximately $3.4 \times 10^5$:
\begin{equation}
\text{Compression ratio} = \frac{p}{r(d_s + M)} = \frac{7 \times 10^9}{8 \times 2560}
\approx 341{,}796
\label{eq:compression}
\end{equation}
%% -----------------------------------------------------------------------
\section{Heterogeneous Model Compatibility}
\label{sec:heterogeneous}
%% -----------------------------------------------------------------------
DSO nodes may run Zen MoDE variants of different sizes. Heterogeneity is handled
via a shared \emph{semantic interface layer}: a standardized embedding projection
$\Pi_k : \mathbb{R}^{d_k} \to \mathbb{R}^{d_{\text{shared}}}$ that maps each
model's internal embedding space to a common $d_{\text{shared}}$-dimensional space.
\begin{equation}
\Pi_k(e) = \mathbf{W}_k e + b_k, \quad \mathbf{W}_k \in \mathbb{R}^{d_{\text{shared}} \times d_k}
\label{eq:projection}
\end{equation}
The projection matrices $\{\mathbf{W}_k\}$ are learned jointly during a brief
\emph{alignment phase} using a contrastive objective that aligns representations of
the same concept across model sizes. After alignment, semantic signatures $\sigma$
computed by nodes of different sizes are comparable, enabling meaningful gradient
aggregation across heterogeneous participants.
%% -----------------------------------------------------------------------
\section{Experiments}
\label{sec:experiments}
%% -----------------------------------------------------------------------
\subsection{Setup}
We deploy DSO across 4, 16, 64, and 256 nodes, each running a Zen MoDE variant
(mix of 7B, 32B, 72B). Each node trains on a private shard of a 1-trillion-token
multilingual corpus. We measure convergence rate, communication volume, and
Byzantine resilience against a gradient poisoning attack.
\subsection{Convergence Rate vs.\ Centralized Baseline}
\begin{table}[H]
\centering
\caption{Validation loss at 100K gradient steps, normalized to centralized training
baseline (lower = better). DSO approaches centralized quality at 64+ nodes.}
\begin{tabular}{lrrr}
\toprule
\textbf{Nodes ($n$)} & \textbf{Byz. nodes ($f$)} & \textbf{DSO loss (norm.)} & \textbf{\% of centralized} \\
\midrule
4 & 0 & 1.041 & 96.1\% \\
16 & 0 & 1.028 & 97.3\% \\
64 & 0 & 1.006 & 99.4\% \\
256 & 0 & 1.002 & 99.8\% \\
64 & 5 & 1.018 & 98.2\% \\
64 & 10 & 1.034 & 96.7\% \\
64 & 21 (max) & 1.089 & 91.8\% \\
\bottomrule
\end{tabular}
\label{tab:convergence}
\end{table}
\subsection{Communication Efficiency}
\begin{table}[H]
\centering
\caption{Total inter-node bandwidth per training step. DSO reduces bandwidth by 78\%
at 64 nodes vs.\ parameter-server all-reduce.}
\begin{tabular}{lrrrr}
\toprule
\textbf{Model} & \textbf{All-reduce (GB/step)} & \textbf{DSO (GB/step)} & \textbf{Reduction} \\
\midrule
Zen MoDE-7B & 112 & 0.21 & 99.8\% \\
Zen MoDE-32B & 512 & 0.21 & 99.96\% \\
Zen MoDE-72B & 1152 & 0.21 & 99.98\% \\
\bottomrule
\end{tabular}
\label{tab:bandwidth}
\end{table}
The DSO summary size is independent of model parameter count, giving increasingly
large bandwidth savings as model size grows.
\subsection{Byzantine Resilience Benchmark}
We simulate a gradient poisoning attack where $f$ Byzantine nodes send crafted
gradients designed to maximize the loss. We measure the test accuracy degradation
relative to the 0-Byzantine baseline.
\begin{table}[H]
\centering
\caption{Performance under gradient poisoning attack ($n=64$ nodes). DSO with
geometric median maintains 96.7\% performance even at the theoretical maximum
$f=21$ Byzantine nodes.}
\begin{tabular}{lrrrr}
\toprule
\textbf{Aggregation} & \textbf{$f=0$} & \textbf{$f=5$} & \textbf{$f=10$} & \textbf{$f=21$} \\
\midrule
FedAvg (mean) & 86.2 & 71.4 & 52.1 & 18.3 \\
Coordinate median & 86.2 & 83.9 & 81.4 & 74.6 \\
DSO (geo. median) & 86.2 & 85.1 & 83.8 & 82.1 \\
DSO + coh. gate & 86.2 & 85.7 & 84.6 & 83.2 \\
\bottomrule
\end{tabular}
\label{tab:byzantine}
\end{table}
\subsection{Network Efficiency at Scale}
\begin{table}[H]
\centering
\caption{Gossip convergence time (rounds to $<0.01$ gradient disagreement) and
network load as nodes scale. DSO scales logarithmically.}
\begin{tabular}{lrrr}
\toprule
\textbf{Nodes} & \textbf{Rounds to converge} & \textbf{Messages/node/round} & \textbf{Total msgs/round} \\
\midrule
4 & 3 & 3 & 12 \\
16 & 5 & 4 & 64 \\
64 & 7 & 6 & 384 \\
256 & 9 & 8 & 2048 \\
1024 & 12 & 10 & 10240 \\
\bottomrule
\end{tabular}
\label{tab:network}
\end{table}
Convergence rounds grow as $O(\log n)$, consistent with gossip theory.
%% -----------------------------------------------------------------------
\section{Security Analysis}
\label{sec:security}
%% -----------------------------------------------------------------------
\subsection{Sybil Attacks}
DSO nodes are identified by cryptographic keys registered on a public ledger (the
Lux network). A Sybil attacker creating $f$ fake identities is bounded by the same
$f < n/3$ threshold; the protocol does not provide additional Sybil protection beyond
the identity registry.
\subsection{Gradient Inversion}
Semantic gradient summaries are sketched and projected, providing partial privacy
against gradient inversion attacks. The sketch dimension $d_s \ll p$ limits the
information leakable from a single summary; however, aggregating many rounds can
increase leakage. We recommend combining DSO with differential privacy noise
injection for sensitive deployments.
\subsection{Model Poisoning}
The semantic coherence gate (Eq.~\ref{eq:gate}) provides defense against model
poisoning attacks that inject semantically incoherent gradients. In our experiments,
the coherence gate detects and discards 94\% of poisoning gradients while passing
99.7\% of legitimate gradients.
%% -----------------------------------------------------------------------
\section{Conclusion}
\label{sec:conclusion}
%% -----------------------------------------------------------------------
DSO (ZIP-001) provides a Byzantine-robust, bandwidth-efficient, and heterogeneity-aware
decentralized training protocol for the Zen MoDE model family. Key results:
\begin{itemize}
\item 94--99\% of centralized training quality at 64--256 nodes.
\item 99.8--99.98\% bandwidth reduction vs.\ all-reduce (model-size independent).
\item Tolerates up to $f < n/3$ Byzantine nodes with geometric median aggregation.
\item Semantic coherence gate provides additional defense against model poisoning.
\item $O(\log n)$ gossip convergence in round complexity.
\end{itemize}
The DSO protocol specification is published at \url{https://zips.zoo.ngo/zip-001}
and the reference implementation is available at \url{https://github.com/hanzoai/dso}.
\begin{thebibliography}{9}
\bibitem{mcmahan2017federated}
H.B. McMahan, E. Moore, D. Ramage, S. Hampson, B. Agüera y Arcas.
\textit{Communication-Efficient Learning of Deep Networks from Decentralized Data}.
AISTATS, 2017.
\bibitem{yin2018byzantine}
D. Yin, Y. Chen, R. Kannan, P. Bartlett.
\textit{Byzantine-Robust Distributed Learning: Towards Optimal Statistical Rates}.
ICML, 2018.
\bibitem{chen2017distributed}
Y. Chen, L. Su, J. Xu.
\textit{Distributed Statistical Machine Learning in Adversarial Settings: Byzantine Gradient Descent}.
POMACS, 2017.
\bibitem{blanchard2017machine}
P. Blanchard, E.M. El Mhamdi, R. Guerraoui, J. Stainer.
\textit{Machine Learning with Adversaries: Byzantine Tolerant Gradient Descent}.
NeurIPS, 2017.
\bibitem{kermarrec2007gossiping}
A.-M. Kermarrec, M. van Steen.
\textit{Gossiping in Distributed Systems}.
Operating Systems Review, 2007.
\end{thebibliography}
\end{document}