---
title: 'Shepherd: Swarm Control and Computational Systems'
url: https://www.emergentmind.com/topics/shepherd
type: topic
---

# Shepherd: Swarm Control and Computational Systems

In the arXiv literature represented here, **“shepherd”** most commonly denotes an external control agent that guides a population of interacting agents toward a global objective by exploiting collective dynamics, typically through alternating **collecting** and **driving** behaviors [1903.09297][1912.07796]. The same term also names several distinct computational systems: a 7B language-model critic, a runtime substrate for meta-agents, a post-login web-measurement framework, and an SE(3)-equivariant molecular diffusion model [2308.04592][2605.10913][1808.00840][2411.04130]. In addition, “Shepherd” appears eponymically in atmospheric energetics, graph theory, and quantum verification [1402.5637][2006.09160][2005.01510].

## 1. Swarm shepherding as a control paradigm

In swarm robotics and multi-agent control, shepherding is the external control of a group of interacting agents (“sheep”) by one or more external agents (“shepherds”) to achieve a global objective such as reaching a goal region while maintaining cohesion and safety [1903.09297]. A standard formalization places the swarm in a 2D continuous plane, with sheep positions $x_i(t)\in\mathbb{R}^2$, velocities $v_i(t)\in\mathbb{R}^2$, shepherd position $s(t)\in\mathbb{R}^2$, and goal $P_T$ or $g$ [1903.09297][2005.09476]. Canonical summary statistics are the centroid
$$
c(t)=\frac{1}{N}\sum_{i=1}^{N}x_i(t),
$$
the maximum dispersion
$$
R(t)=\max_i \|x_i(t)-c(t)\|,
$$
and mean-radius variants such as $D(t)=\frac{1}{N}\sum_i \|x_i(t)-c(t)\|$ [1903.09297].

The dominant heuristic lineage is the **Strömbom-style** collect/drive switch. If the furthest sheep lies within a collection threshold $f(N)$, the shepherd **drives** the cohesive group from a point behind the centroid relative to the goal; otherwise it **collects** by moving behind the furthest agent relative to the centroid [1903.09297][2008.12708][1912.07796]. In one widely used form,
$$
\|P_F-P_G\|<f(N)\Rightarrow \Psi=\Psi_D,\quad \text{else } \Psi=\Psi_C,
$$
with
$$
P_D=P_G+\frac{P_G-P_T}{\|P_G-P_T\|}\,r_a\sqrt{N},
\qquad
P_C=P_G+\frac{P_F-P_G}{\|P_F-P_G\|}(R+r_a),
$$
and normalized directions toward those target points [1903.09297]. The review literature generalizes this into a broader behavioral taxonomy including **collect**, **drive**, **protect/guard/patrol**, and obstacle steering, while also emphasizing that shepherd speed relative to agent speed, sensing locality, and obstacle structure materially change feasible strategies [1912.07796].

The sheep side of the model is usually force-based. Common ingredients are short-range repulsion, cohesion, alignment or inertia, and repulsion from the shepherd; in some formulations, angular or Gaussian noise is added [1903.09297][2008.12708][2210.11055]. Evaluation typically uses time-to-goal, success rate, dispersion metrics, path length, and safety events such as collision counts or boundary violations [1912.07796][2005.09476]. This structure makes shepherding a hybrid control problem: continuous motion control is subordinated to a discrete decision over behavioral mode.

## 2. Learning-based shepherds

A major research direction replaces hand-coded steering laws with learned policies while retaining interpretable collect/drive structure. “Transparent Machine Education of Neural Networks for Swarm Shepherding Using Curriculum Design” decomposes the policy into two supervised modules, one for collecting and one for driving, with a pre-scripted switch based on $R\lessgtr f(N)$ [1903.09297]. Training uses approximately **200,000 labeled samples across 480 simulations**, produced by human-in-the-loop demonstrations, and maps a 9-feature state vector to a 2D direction output [1903.09297]. The curriculum learner uses **two single-hidden-layer networks (10 hidden nodes each)**, whereas non-curriculum baselines use single networks with 10 or 20 hidden nodes [1903.09297]. In open-environment assessment, the curriculum learner achieved **32%** success versus **7%** for the strongest non-curriculum baseline, with learning-rate ratios of approximately **11.02** for collecting, **1.70** for driving, and **4.30** for success rate [1903.09297]. The driving and collecting metric improvements did not reach significance in the reported trials, but the success-rate difference did [1903.09297].

Obstacle-rich environments motivated reinforcement-learning formulations. “Learning to Herd Agents Amongst Obstacles” casts shepherding as an MDP with local $84\times84$ frame stacks, a semi-discrete eight-direction action space with continuous perturbation, and reward shaping based on projection progress and PRM geodesic progress [2005.09476]. The learning algorithm is **Double Deep Q-Learning with prioritized experience replay**, and the PRM supplies obstacle-aware waypoints and path-length estimates [2005.09476]. Across layered U-turn and gap environments, the learned model showed **higher success rate, shorter completion time and path length than the rule-based behavioral methods**, with advantages of at least **20–40%** in several difficult settings [2005.09476].

A continuous-control variant appears in “Continuous Deep Hierarchical Reinforcement Learning for Ground-Air Swarm Shepherding,” where a UAV shepherd learns separate **DDPG** policies for collection and driving and fuses them through a Strömbom-style gate [2004.11543]. For $N=3$ UGVs, the method reached **100% success** in both $4\times4$ and $6\times6$ environments and transferred from simulation to indoor physical experiments with **100% success** in the reported scenarios [2004.11543]. The article attributes part of this performance to hierarchical decomposition and continuous action outputs, which reduced the zig-zag behavior associated with discrete-action baselines [2004.11543].

## 3. Heterogeneity, noise, and contextual adaptation

Once the assumption of a homogeneous flock is relaxed, the shepherd must infer which agents are responsive and how they respond. “Shepherding Heterogeneous Flock with Model-Based Discrimination” introduces **virtual sheep** simulated under an estimated nominal model and classifies actual agents by residuals
$$
r_i(k)=\|x_i(k)-\xi_i(k)\|
$$
computed at observation times [2210.11055]. Static thresholding uses a fixed $L$, while dynamic thresholding sets
$$
L(k)=q_3(k)+1.5\,\mathrm{IQR}(k),
$$
where $q_1,q_3$ are quartiles of the residuals [2210.11055]. Across 14 variant types, the proposed methods reported **success rates > 63% regardless of variant type**, with **average execution time < 530 steps**, while a conventional FAT baseline dropped below **13%** for variant types lacking both attraction and shepherd repulsion [2210.11055].

Context awareness can also be embedded at the level of tactic selection rather than residual classification. “Contextually Aware Intelligent Control Agents for Heterogeneous Swarms” organizes control into an S2AI-to-AI2A pipeline that classifies agent types, infers scenario probabilities, and selects among **25 tactic pairs** formed from five drive variants and five collect variants [2211.12560]. Across 11 scenarios, the context-aware version achieved an overall **Mission Success Rate of 74% ± 28%**, versus **64% ± 33%** without context, and reduced mission length from **3320.1 ± 1646.6** to **2157.5 ± 1959.9** over all trials [2211.12560]. The same study reports a significant increase in the number of swarm agents directly influenced by the shepherd in **100% of scenarios** [2211.12560].

Noise changes not only performance but preferred parameterization. “Disturbances in Influence of a Shepherding Agent is More Impactful than Sensorial Noise During Swarm Guidance” studies perception noise $\alpha$ and actuation disturbance $\lambda$ under Strömbom’s rule [2008.12708]. The central empirical finding is that **actuation disturbance is more detrimental than perception noise**, even though the tested $\lambda$ magnitudes are an order of magnitude smaller than the tested $\alpha$ magnitudes [2008.12708]. The same work shows that the collect/drive threshold should move in opposite directions depending on noise type: increase the threshold under high perception noise to avoid spurious collection, and decrease it under high actuation noise to re-compact the group more aggressively [2008.12708].

A related adaptive idea appears in “Re-Solving the Shepherding Problem: Lead When Possible, Herd When Necessary,” which switches between a **leading** mode and a **herding** mode based on whether the closest agent is approaching or receding [2602.16750]. In the reported simulations, the mixed controller transported groups with any follower/evader composition $p\in[0,1]$, whereas herd-only succeeded only at $p=0$ and lead-only only at $p=1$ [2602.16750]. Under time-varying strategy switching, the mixed controller remained effective up to $\pi=0.5$ when the time limit was removed, and succeeded within a 6000-step horizon for $\pi$ up to approximately **0.01** [2602.16750].

## 4. Selective guidance, safety, and trusted-shepherd formulations

Some work narrows the objective from transporting an entire swarm to manipulating a designated subset. “Shepherding Control for Separating a Single Agent from a Swarm” formulates target separation under an $R$-disc connectivity constraint on the remaining $N-1$ agents [2209.09411]. The method defines a **pinning sheep**, constructs an ideal velocity from distance- and velocity-based surrogates, and projects the shepherd’s target point onto analytically derived feasibility sets $\mathcal{C}_1,\mathcal{C}_2,\mathcal{C}_3$ from a two-sheep analysis [2209.09411]. In numerical experiments, it produced larger connected components among the non-target agents than a bipartite baseline, especially for boundary targets [2209.09411].

“Collision-Free Shepherding Control of a Single Target within a Swarm” instead gives a continuous-time control law for driving one target sheep to the origin while avoiding sheep-sheep collisions [2306.12044]. The key sufficient safety condition is
$$
f_y^{\max}=\frac{\gamma_1}{\ell_y}<M_b,
$$
which bounds the shepherd’s maximal repulsive influence by the saturated sheep-sheep repulsion [2306.12044]. Under this condition, the paper proves noncollision and gives a Lyapunov-based feedback controller with local asymptotic convergence of the target to the origin [2306.12044]. Simulations up to **N = 200** showed the proposed method consistently regulated the target below a small threshold before $t=200$, while the baseline heuristic did not achieve consistent convergence [2306.12044].

A more abstract selective-control role appears in distributed algorithms on graphs. “Dispersion, Capacitated Nodes, and the Power of a Trusted Shepherd” introduces a **trusted shepherd** robot that is never Byzantine and can orchestrate exploration, mapping, and allocation on capacitated anonymous graphs [2311.01511]. With knowledge of $n$ and $k$, the shepherd achieves Byzantine dispersion in **$O(X(n)+n^3)$ rounds** when
$$
f<\left\lfloor\frac{k-1}{2}\right\rfloor,
$$
and with knowledge of $k$ and $f$ it achieves the same asymptotic time under the weaker knowledge assumption but stricter tolerance
$$
f<\frac{k-1}{3}
$$
[2311.01511]. In the benign setting, the paper shows that any uncapacitated dispersion algorithm with time $T_{\mathcal A}$ can be wrapped into a capacitated version with time **$O(T_{\mathcal A}+m)$**, concentrating the additional memory cost on the shepherd [2311.01511]. This suggests a broader interpretation of “shepherd” as a trusted, more capable coordinator within an otherwise decentralized or adversarial system.

## 5. “Shepherd” as a named computational system

Outside swarm control, several papers use **Shepherd** as the name of a concrete model or runtime.

| System | Domain | Defining property |
|---|---|---|
| Shepherd [2308.04592] | LLM criticism | 7B critic model tuned to provide natural-language feedback |
| Shepherd [2605.10913] | Meta-agent runtime | Typed effect trace with fork/merge/discard semantics |
| Shepherd [1808.00840] | Web security measurement | Automated login and post-login scanning framework |
| ShEPhERD [2411.04130] | Drug design | SE(3)-equivariant diffusion over molecules and interaction fields |

“Shepherd: A Critic for Language Model Generation” defines a **7B-parameter** critic, based on **LLaMA-7B**, trained by supervised fine-tuning on approximately **8K critique instances**, including **1,317** human-annotated examples [2308.04592]. Its role is not to answer questions directly but to inspect a candidate answer, identify specific errors, and suggest refinements [2308.04592]. In GPT-4 pairwise evaluation, it achieved average win-rates of **87.0%** versus Alpaca, **53.0%** versus SelFee, and **56.0%** versus ChatGPT; in human evaluation it reached **72.4%**, **59.7%**, and **49.6%** respectively, with especially strong performance on the distribution-shifted CritiqueEval set [2308.04592].

“Shepherd: A Runtime Substrate Empowering Meta-Agents with a Formalized Execution Trace” treats an agent and its execution as first-class runtime objects with typed events, branchable scopes, and a Git-like persistent trace [2605.10913]. The system reports **5× faster** process-and-filesystem forking than Docker commit and **>95%** prompt-cache reuse on replay [2605.10913]. In applications, a live supervisor increased pair-coding pass rates on CooperBench from **28.8%** to **54.7%**; counterfactual meta-optimization improved benchmark scores by up to **11 points** while reducing wall-clock time by up to **58%**; and Tree-RL training improved TerminalBench-2 from **34.2%** to **39.4%** [2605.10913].

“Shepherd: Enabling Automatic and Large-Scale Login Security Studies” is a web-measurement framework for discovering login forms, submitting credentials, verifying authenticated state, and running post-login scans [1808.00840]. Using BugMeNot credentials, it automatically verified logins on **6,273 unknown sites**, or **12.4%** of the test set, and found **2,579** of those sites—**41.4%**—vulnerable to simple session hijacking under the paper’s criterion [1808.00840].

“ShEPhERD: Diffusing shape, electrostatics, and pharmacophores for bioisosteric drug design” uses the same lexical label in a different capitalization pattern, but again denotes a concrete system rather than a control agent [2411.04130]. The model jointly diffuses 3D molecular graphs, shape surfaces, electrostatic potential surfaces, and directional pharmacophores [2411.04130]. Reported conditional validities are **96.0%** for $p(x_1\mid x_2)$, **91.9%** for $p(x_1\mid x_3)$, and **80.7%** for $p(x_1\mid x_4)$, with applications to natural-product ligand hopping, protein-blind hit diversification, and bioisosteric fragment merging [2411.04130].

## 6. Eponymic and formal uses

In atmospheric energetics, **T. G. Shepherd’s** pseudo-energy is a Hamiltonian-Casimir construction for compressible, hydrostatic flow [1402.5637]. The central quantity is
$$
\mathcal{A}=\mathcal{J}(\mathbf{v})-\mathcal{J}(\mathbf{V})+\mathcal{K}(\mathbf{v})-\mathcal{K}(\mathbf{V}),
$$
which becomes the sum of kinetic energy and generalized available potential energy [1402.5637]. For an isothermal/isobaric reference state, the construction yields the available enthalpy
$$
a_h=(h-h_r)-T_r(s-s_r),
$$
establishing a direct link between Shepherd’s pseudo-energy and exergy formulations in thermodynamics [1402.5637].

In graph theory, “Shepherd” refers to the finite Hamiltonicity results of F. B. Shepherd on claw-free and net-free graphs [2006.09160]. The cited 1991 theorem states that if a finite graph is claw-free and net-free, then connectedness implies a Hamilton path and 2-connectedness implies Hamiltonicity; for $k\ge 2$, $(k+1)$-connectedness is equivalent to $k$-leaf-connectedness [2006.09160]. The 2020 extension to locally finite graphs replaces finite Hamilton cycles with **Hamilton circles** in the Freudenthal compactification and proves that every locally finite, 2-connected, claw-free, net-free graph is Hamiltonian in that topological sense [2006.09160].

In quantum verification, the **Shepherd–Bremner** protocol is an IQP-based cryptographic test of quantum computational power [2005.01510]. Its basic statistic is the secret-string correlator
$$
\beta_s=\mathbb{E}_{x\sim p}[(-1)^{x\cdot s}]=\langle Z_s\rangle,
$$
or equivalently the parity bias $P_{s^\perp}=\frac{1}{2}(\langle Z_s\rangle+1)$ [2005.01510]. The 2020 “Anti-Forging Quantum Data” paper explains that the original construction can be broken by the Kahanamoku-Meyer attack, then generalizes the protocol by introducing multiple hidden secrets, a decomposition $H=H_M+H_R$ with $H_M$ anticommting and $H_R$ commuting with the relevant $Z_{s_i}$, and verifier-side estimators for the correlators [2005.01510]. A notable design feature is that multiple secret strings can be encoded simultaneously, which the paper presents as a significant strengthening of anti-forging hardness [2005.01510].

Across these usages, “shepherd” consistently marks one of two roles. It either denotes an **external guide or supervisor** acting on a more complex collective process, or it designates a **framework that inspects, branches, verifies, or redirects** another system’s behavior. The recurrence of that role vocabulary across robotics, distributed algorithms, machine learning, security, physics, and combinatorics suggests a stable conceptual pattern, even though the underlying mathematical objects differ substantially.

Source: https://www.emergentmind.com/topics/shepherd