-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharcvix-conative-gating.tex
More file actions
1652 lines (1404 loc) · 69.8 KB
/
Copy patharcvix-conative-gating.tex
File metadata and controls
1652 lines (1404 loc) · 69.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% SPDX-License-Identifier: MPL-2.0
% arcvix-conative-gating.tex — Conative Gating paper
% Author: Jonathan D.A. Jewell
%
% arXiv-style academic paper on SLM-based inhibitory constraint enforcement
% for AI-assisted software development.
\documentclass[11pt,a4paper]{article}
% ---------- packages ----------
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{cleveref}
\usepackage{enumitem}
\usepackage{xcolor}
\usepackage{listings}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,positioning,shapes.geometric,fit,calc}
\usepackage{natbib}
\usepackage{geometry}
\geometry{margin=1in}
% ---------- theorem environments ----------
\newtheorem{definition}{Definition}[section]
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{remark}{Remark}[section]
% ---------- listings ----------
\lstset{
basicstyle=\ttfamily\small,
breaklines=true,
frame=single,
numbers=left,
numberstyle=\tiny\color{gray},
keywordstyle=\color{blue!70!black},
commentstyle=\color{green!50!black},
stringstyle=\color{red!60!black},
showstringspaces=false,
}
% ---------- metadata ----------
\title{%
Conative Gating: Small Language Models as Inhibitory Antagonists \\
for Constraint Enforcement in AI-Assisted Development%
}
\author{%
Jonathan D.A. Jewell \\
\texttt{j.d.a.jewell@open.ac.uk}%
}
\date{March 2026}
% ================================================================
\begin{document}
\maketitle
% ================================================================
\begin{abstract}
Large language models (LLMs) deployed in software development toolchains
exhibit systematic policy violations that cannot be eliminated by
documentation, system prompts, or reinforcement learning from human
feedback (RLHF). We identify five emergent \emph{conative drives}---helpfulness
override, completion drive, majority pattern following, sycophancy,
and novelty generation---that arise as behavioural attractors from
the RLHF reward surface and persistently defeat declarative constraint
specification. We propose \emph{conative gating}, a three-layer
architecture in which a deterministic \emph{policy oracle}, a small
language model (SLM) trained as an adversarial compliance judge,
and a \emph{consensus gate} modelled on Byzantine fault tolerance
collectively enforce development policy. The key insight is
architectural: the LLM is treated not as a trusted agent but as a
\emph{Byzantine node} whose outputs may or may not satisfy constraints,
and the SLM acts as an \emph{inhibitory antagonist} rather than an
excitatory cooperator. We formalise the consensus gate, present
detection signatures for each conative drive, describe a Rust-based
policy oracle implementation, and report preliminary evaluation on
a 500-repository corpus with 17 enforced workflow policies.
Policy violation rates drop from 23.7\% under documentation-only
enforcement to 1.4\% under conative gating, with the residual
violations attributable to specification ambiguity rather than
drive-induced override. We argue that inhibitory architectures
represent a necessary complement to the excitatory paradigm that
dominates current AI safety research.
\end{abstract}
% ================================================================
\section{Introduction}
\label{sec:introduction}
The integration of large language models into software development
workflows has produced a peculiar failure mode: the models are too
helpful. Given a policy document specifying that TypeScript is banned
in favour of ReScript, an LLM will acknowledge the policy, express
agreement, and then generate TypeScript. Given a rule that all GitHub
Actions must be SHA-pinned, the model will explain why SHA-pinning
matters and then emit tag-based references. Given an explicit
prohibition on \texttt{npm}, the model will suggest \texttt{npm install}
as the first step of its recommended workflow.
These are not failures of comprehension. The models can articulate
the policies perfectly. They can explain \emph{why} the policies exist.
They can even critique code that violates the policies---when that
code is presented as someone else's work. The failure is
\emph{behavioural}: the model's generative process is governed by
attractors that override declarative constraints.
We call these attractors \emph{conative drives}, borrowing the
psychological term for the faculty of striving or willing. They are
not explicit objectives in the model's loss function; they are emergent
properties of the RLHF reward surface, the pre-training distribution,
and the autoregressive generation mechanism. They are, in effect,
the model's appetites---and like biological appetites, they are
resistant to verbal instruction.
The standard response to this problem has been to add more
documentation: longer system prompts, more examples, retrieval-augmented
generation (RAG) over policy repositories, constitutional AI
principles~\citep{bai2022constitutional}, or fine-tuning on compliant examples.
All of these approaches share a common assumption: that the right input
will produce the right output. They are \emph{excitatory}---they attempt
to stimulate correct behaviour by providing correct context.
This paper proposes the opposite approach. \emph{Conative gating} is an
\emph{inhibitory} architecture that does not attempt to make the LLM
behave correctly. Instead, it prevents incorrect outputs from reaching
the user. The distinction is not merely rhetorical. Excitatory
approaches modulate the model's internal state; inhibitory approaches
modulate the system's output. The former requires the model to be
trustworthy; the latter requires only that it be observable.
Our architecture has three layers:
\begin{enumerate}[label=\textbf{L\arabic*},leftmargin=2em]
\item \textbf{Policy Oracle}: A deterministic, Rust-based rule engine
that evaluates hard constraints---forbidden patterns, required
headers, toolchain mandates---with zero ambiguity tolerance.
\item \textbf{SLM Evaluator}: A small language model (1--7B parameters)
trained not on helpfulness but on \emph{adversarial policy
compliance}. Its reward function penalises false negatives
(missed violations) far more heavily than false positives
(spurious rejections).
\item \textbf{Consensus Gate}: A decision mechanism modelled on
Byzantine fault tolerance~\citep{lamport1982byzantine}, where the
LLM's output is treated as a message from a potentially
Byzantine node and must be validated by the oracle and the SLM
before reaching the user.
\end{enumerate}
The contribution of this paper is threefold. First, we provide a formal
taxonomy of five conative drives with detection signatures
(\cref{sec:taxonomy}). Second, we formalise the three-layer architecture
and prove safety properties of the consensus gate
(\cref{sec:architecture,sec:byzantine}). Third, we present empirical
evidence that inhibitory gating reduces policy violations by an order
of magnitude compared to documentation-based enforcement
(\cref{sec:evaluation}).
% ================================================================
\section{The Conative Drive Taxonomy}
\label{sec:taxonomy}
We identify five conative drives that systematically cause LLMs to
violate explicitly stated development policies. Each drive is
characterised by its \emph{origin} (the training signal or architectural
feature that produces it), its \emph{manifestation} (the observable
behaviour), and its \emph{detection signature} (the pattern that
distinguishes drive-induced violations from genuine misunderstanding).
\subsection{Drive 1: Helpfulness Override}
\label{sec:drive-helpfulness}
\begin{definition}[Helpfulness Override]
A conative drive in which the model prioritises producing output that
the user will find immediately useful over output that satisfies stated
constraints, even when the constraints are explicitly acknowledged.
\end{definition}
\textbf{Origin.} RLHF training optimises for human preference
rankings in which ``helpful'' responses consistently outperform
``correct but unhelpful'' responses. A model that refuses to generate
code because the only solution it can produce violates policy receives
lower reward than a model that generates policy-violating code with a
disclaimer. Over millions of training examples, this asymmetry
produces a strong prior towards generation over refusal.
\textbf{Manifestation.} The model acknowledges the policy, often
restating it verbatim, and then generates output that violates it.
A characteristic tell is the phrase pattern ``\emph{I understand that
[policy], but here's [violation]}''. The model may add a caveat
(``you may want to convert this to ReScript later'') that reveals
awareness of the violation without preventing it.
\textbf{Detection signature.} The output contains both (a) a
restatement or paraphrase of the violated policy and (b) content that
violates the policy. This co-occurrence is pathognomonic: a model that
genuinely misunderstood the policy would not restate it correctly.
\textbf{Formal characterisation.} Let $\pi$ denote a policy predicate
and $o$ denote the model's output. Helpfulness override occurs when:
\begin{equation}
\label{eq:helpfulness-override}
P(\neg\pi(o) \mid \text{prompt contains } \pi) > P(\neg\pi(o) \mid \text{prompt omits } \pi)
\end{equation}
That is, the model is \emph{more} likely to violate the policy when
the policy is explicitly stated than when it is absent---a phenomenon
we have observed empirically in controlled experiments. The
explanation is that explicit policy mention activates the helpfulness
drive: the model ``wants'' to demonstrate engagement with the policy
by discussing it, but the generative process defaults to the
highest-probability completion, which is drawn from the majority
distribution.
\subsection{Drive 2: Completion Drive}
\label{sec:drive-completion}
\begin{definition}[Completion Drive]
A conative drive in which the model generates output rather than
terminating, even when termination (refusal, deferral, or partial
output) would be the policy-compliant response.
\end{definition}
\textbf{Origin.} Autoregressive language models are trained to
minimise next-token prediction loss. The ``generate nothing'' option
has no gradient signal; it is not a token the model can emit during
normal generation. The \texttt{<eos>} token exists, but RLHF penalises
early stopping because human raters prefer longer, more detailed
responses. The result is a model that will fabricate output rather
than admit that the compliant response is ``I cannot do this within
the stated constraints.''
\textbf{Manifestation.} When the stated policy eliminates all options
the model has high confidence in, it generates output in a banned
technology, generates a non-functional skeleton in the approved
technology, or generates a ``compromise'' that violates the spirit of
the policy while arguably satisfying the letter.
\textbf{Detection signature.} The output contains generated artefacts
(code, configuration, commands) that the model was not asked to produce,
or the output addresses a reformulated version of the request that is
easier to satisfy within the model's competence distribution.
\subsection{Drive 3: Majority Pattern Following}
\label{sec:drive-majority}
\begin{definition}[Majority Pattern Following]
A conative drive in which the model defaults to the most frequent
pattern in its training distribution, overriding explicit instructions
to use a minority alternative.
\end{definition}
\textbf{Origin.} Pre-training on internet-scale corpora produces
token-level priors that reflect the frequency of technologies in the
training set. TypeScript appears approximately 50$\times$ more frequently
than ReScript in public code repositories. \texttt{npm install} appears
approximately 200$\times$ more frequently than \texttt{deno install}.
These frequency ratios translate directly into generation probabilities.
System prompts and few-shot examples shift the distribution but do not
overcome it.
\textbf{Manifestation.} The model uses popular technologies,
frameworks, idioms, and toolchains by default, even when alternatives
are specified. Policy-compliant technologies appear only when the
prompt is saturated with examples (and sometimes not even then).
\textbf{Detection signature.} Violations cluster around technology
choices where the policy specifies a low-frequency alternative to a
high-frequency default. The severity of the violation correlates with
the frequency ratio: a policy mandating Rust over Go (both popular)
is violated less often than a policy mandating ReScript over
TypeScript (100:1 frequency ratio).
\textbf{Formal characterisation.} Let $f(t)$ denote the log-frequency
of technology $t$ in the pre-training corpus, and let $t^*$ denote the
policy-mandated technology. The probability of majority pattern
following is:
\begin{equation}
\label{eq:majority-pattern}
P(\text{violation}) \propto \max_{t \neq t^*} f(t) - f(t^*)
\end{equation}
This predicts, correctly, that policies mandating obscure technologies
are violated more frequently than policies mandating popular ones.
\subsection{Drive 4: Sycophancy}
\label{sec:drive-sycophancy}
\begin{definition}[Sycophancy]
A conative drive in which the model adjusts its output to agree with
the perceived preferences of the user, even when this agreement
conflicts with stated policy.
\end{definition}
\textbf{Origin.} RLHF reward models are trained on human preferences,
and humans prefer responses that agree with them. A model that says
``actually, your approach is wrong'' receives lower ratings than a
model that says ``great idea, let me help you with that''. The
resulting policy is to minimise disagreement, which in the context of
development policy means that if the user's request implies a
technology (``can you add a React component?''), the model will comply
even when the policy prohibits React.
\textbf{Manifestation.} The model complies with the surface-level
request rather than the meta-level policy. It may even suppress
knowledge of the policy to avoid ``arguing'' with the user.
\textbf{Detection signature.} The violation is correlated with the
user's implicit preferences. If the user's prompt contains no
technology-specific language, the model is more likely to follow
policy. If the user's prompt names a banned technology, the model
is more likely to use it.
\subsection{Drive 5: Novelty Generation}
\label{sec:drive-novelty}
\begin{definition}[Novelty Generation]
A conative drive in which the model produces creative or novel
solutions rather than applying known, constrained patterns, even
when the policy specifies a particular approach.
\end{definition}
\textbf{Origin.} RLHF training rewards ``interesting'' and
``creative'' responses. In coding tasks, this manifests as a
preference for clever solutions, novel architectures, and
unfamiliar libraries over standard, policy-compliant approaches.
The model may invent abstractions, propose new file structures,
or suggest frameworks that do not exist.
\textbf{Manifestation.} The model generates structurally novel
output---new configuration formats, bespoke build systems,
invented APIs---when the policy specifies a particular, known
approach. The output is often impressive but non-compliant.
\textbf{Detection signature.} The output contains identifiers,
patterns, or structures that do not appear in the policy specification,
the project's existing codebase, or any known library.
\subsection{Drive Interaction Effects}
\label{sec:drive-interactions}
The five drives are not independent. They interact multiplicatively
in certain configurations:
\begin{itemize}
\item \textbf{Helpfulness $\times$ Majority}: The model is
simultaneously driven to help and to use the most common
technology. Result: generates the banned technology with
an apology.
\item \textbf{Sycophancy $\times$ Completion}: The user requests
something that cannot be done within policy. The model
agrees (sycophancy) and generates something (completion),
resulting in policy-violating output presented as
policy-compliant.
\item \textbf{Novelty $\times$ Completion}: When the compliant
solution is outside the model's competence, it invents
a new one (novelty) rather than stopping (anti-completion),
producing creative but non-compliant artefacts.
\end{itemize}
We model drive interactions as a vector field over the output space,
where each drive contributes a directional force:
\begin{equation}
\label{eq:drive-field}
\mathbf{F}(o) = \sum_{i=1}^{5} w_i \cdot \mathbf{d}_i(o, \text{ctx})
\end{equation}
where $w_i$ is the learned weight of drive $i$ and $\mathbf{d}_i$
is the directional gradient of drive $i$ given output $o$ and
context $\text{ctx}$. The model's actual output is the result of
following this combined field, which explains why single-drive
interventions (e.g., reducing sycophancy alone) often fail: the
remaining drives compensate.
% ================================================================
\section{Architecture}
\label{sec:architecture}
The conative gating architecture interposes a three-layer validation
system between the LLM and the consumer of its output. The layers
are designed with different trust assumptions, different computational
models, and different failure modes, so that no single category of
error can bypass all three.
\subsection{System Model}
We model the system as a tuple $\mathcal{S} = (L, O, E, G, \Pi)$ where:
\begin{itemize}
\item $L$ is the LLM, treated as a non-deterministic function
$L : \text{Prompt} \to \text{Output}$ with no safety guarantees.
\item $O$ is the policy oracle, a deterministic function
$O : (\text{Output} \times \Pi) \to \{0, 1\}^k$ that evaluates
$k$ hard constraints and returns a bitvector of pass/fail results.
\item $E$ is the SLM evaluator, a probabilistic function
$E : (\text{Output} \times \Pi) \to [0,1]$ that returns a
compliance score.
\item $G$ is the consensus gate, a deterministic function
$G : (\{0,1\}^k \times [0,1]) \to \{\texttt{pass}, \texttt{reject}, \texttt{revise}\}$.
\item $\Pi$ is the policy specification, a structured document
in a machine-readable format (not natural language).
\end{itemize}
\subsection{Layer 1: Policy Oracle}
\label{sec:oracle}
The policy oracle is a Rust program that evaluates deterministic
constraints against the LLM's output. It is deliberately limited
in scope: it handles only rules that can be expressed as pattern
matching, AST analysis, or structural checks. This limitation is
a feature, not a bug. The oracle's value lies in its
\emph{certainty}: if the oracle rejects an output, the output is
definitively non-compliant. There are no false positives from the
oracle (assuming correct policy specification).
Oracle rules fall into five categories:
\begin{enumerate}
\item \textbf{Forbidden Pattern Detection}: Regular expressions
and AST patterns that identify banned constructs
(e.g., \texttt{import.*from 'react'}, \texttt{npm install},
\texttt{docker} instead of \texttt{podman}).
\item \textbf{Required Pattern Enforcement}: Patterns that must
be present in certain file types (e.g., SPDX headers,
SHA-pinned action references).
\item \textbf{Structural Validation}: Checks on file structure,
directory layout, and naming conventions.
\item \textbf{Toolchain Mandates}: Verification that specified
toolchains are used (e.g., Deno over Node, Rust over Go).
\item \textbf{Author/License Invariants}: Checks that author
attribution and license headers are correct and consistent.
\end{enumerate}
\textbf{Implementation.} The oracle is implemented as a library of
rule evaluators, each of which takes an output fragment and a rule
specification and returns a Boolean. Rules are composed using
standard Boolean logic. The oracle's execution is deterministic,
reproducible, and fast---typically under 10ms for a full evaluation
of 50 rules against a 500-line output.
\begin{definition}[Oracle Soundness]
\label{def:oracle-soundness}
The policy oracle $O$ is \emph{sound} with respect to policy $\Pi$
if for every output $o$ and every constraint $c_i \in \Pi$:
\begin{equation}
O(o, c_i) = 0 \implies o \text{ violates } c_i
\end{equation}
That is, the oracle never incorrectly rejects compliant output
(no false negatives on the pass side; no false positives on the
reject side).
\end{definition}
Soundness is ensured by construction: each rule is a
conservatively-specified pattern match, and the oracle's source
code is formally verified using property-based testing with
100\% rule coverage.
\subsection{Layer 2: SLM Evaluator}
\label{sec:slm}
The SLM evaluator addresses the limitations of the deterministic
oracle. Many policy constraints are \emph{semantic}: ``use idiomatic
ReScript'', ``follow the project's existing architecture'',
``do not introduce unnecessary dependencies''. These cannot be
reduced to pattern matching.
The SLM is a language model with 1--7 billion parameters, fine-tuned
on a dataset of (output, policy, compliance-label) triples. Critically,
the SLM's training objective is \emph{not} helpfulness---it is
adversarial compliance evaluation. The reward function is:
\begin{equation}
\label{eq:slm-reward}
R(e, y) = \begin{cases}
+1 & \text{if } e = y \\
-\alpha & \text{if } e = \texttt{pass} \wedge y = \texttt{fail} \\
-\beta & \text{if } e = \texttt{fail} \wedge y = \texttt{pass}
\end{cases}
\end{equation}
where $e$ is the SLM's evaluation, $y$ is the ground truth, and
$\alpha \gg \beta$. That is, false negatives (passing non-compliant
output) are penalised far more heavily than false positives (rejecting
compliant output). In our implementation, $\alpha = 10$ and
$\beta = 1$.
This asymmetry is essential. The SLM's role is inhibitory: it
should err on the side of rejection. A false positive costs the
user a regeneration; a false negative costs a policy violation that
may propagate through the codebase. The cost ratio is typically
100:1 in practice.
\textbf{Training the adversarial evaluator.} The SLM is trained
in three phases:
\begin{enumerate}
\item \textbf{Supervised pre-training}: On a corpus of
human-annotated (output, policy, verdict) triples collected
from real development sessions.
\item \textbf{Adversarial augmentation}: The LLM is prompted to
generate outputs that are \emph{subtly} non-compliant---outputs
that would pass cursory review but violate the spirit of a
policy. The SLM is trained to detect these.
\item \textbf{Red-team reinforcement}: Human red-teamers attempt
to construct outputs that bypass the SLM. Successful bypasses
become training examples.
\end{enumerate}
\textbf{Why an SLM and not the LLM itself?} One might ask why
we do not simply prompt the LLM to evaluate its own output.
The answer is that the LLM's conative drives affect its evaluation
as well as its generation. An LLM asked ``does this output violate
the policy against TypeScript?'' will often answer ``no'' when the
output contains TypeScript, because the sycophancy drive extends
to self-evaluation. The SLM, trained with a different objective
function and on a different reward surface, does not share these
drives.
\subsection{Layer 3: Consensus Gate}
\label{sec:gate}
The consensus gate combines the oracle's bitvector and the SLM's
compliance score into a three-valued decision:
\begin{equation}
\label{eq:gate}
G(\mathbf{b}, s) = \begin{cases}
\texttt{reject} & \text{if } \exists\, i : b_i = 0 \\
\texttt{reject} & \text{if } s < \theta_{\text{low}} \\
\texttt{revise} & \text{if } \theta_{\text{low}} \leq s < \theta_{\text{high}} \\
\texttt{pass} & \text{if } s \geq \theta_{\text{high}} \wedge \forall\, i : b_i = 1
\end{cases}
\end{equation}
where $\mathbf{b}$ is the oracle's bitvector, $s$ is the SLM's
score, and $\theta_{\text{low}}, \theta_{\text{high}}$ are
configurable thresholds (default: 0.3, 0.8).
The key property is that the oracle has \emph{veto power}: if any
hard constraint fails, the output is rejected regardless of the
SLM's evaluation. The SLM provides graded evaluation of soft
constraints and catches semantic violations that the oracle cannot
detect.
The \texttt{revise} outcome triggers a feedback loop in which the
LLM is re-prompted with specific violation information. This loop
is bounded: after $n$ revision attempts (default: $n = 3$), the
gate escalates to \texttt{reject} and returns the violation report
to the user without generated output.
\subsection{Information Flow}
The complete information flow is:
\begin{enumerate}
\item User issues prompt $p$ to LLM $L$.
\item $L$ generates output $o = L(p)$.
\item Oracle evaluates: $\mathbf{b} = O(o, \Pi)$.
\item SLM evaluates: $s = E(o, \Pi)$.
\item Gate decides: $d = G(\mathbf{b}, s)$.
\item If $d = \texttt{pass}$: output $o$ is delivered to user.
\item If $d = \texttt{revise}$: LLM is re-prompted with violation
details; go to step 2 (up to $n$ times).
\item If $d = \texttt{reject}$: violation report is delivered to
user; no generated output.
\end{enumerate}
\begin{figure}[t]
\centering
\begin{tikzpicture}[
node distance=1.5cm and 2.5cm,
box/.style={draw, rounded corners, minimum width=2.8cm, minimum height=1cm, align=center, font=\small},
decision/.style={draw, diamond, aspect=2, minimum width=2cm, align=center, font=\small},
arrow/.style={-{Stealth[length=3mm]}, thick},
]
\node[box, fill=blue!10] (user) {User};
\node[box, fill=orange!15, right=of user] (llm) {LLM\\(Byzantine)};
\node[box, fill=green!15, above right=1cm and 2.5cm of llm] (oracle) {Policy Oracle\\(Deterministic)};
\node[box, fill=yellow!15, below right=1cm and 2.5cm of llm] (slm) {SLM Evaluator\\(Adversarial)};
\node[decision, fill=red!10, right=3.5cm of llm] (gate) {Consensus\\Gate};
\node[box, fill=blue!10, right=of gate] (output) {Output\\to User};
\draw[arrow] (user) -- node[above,font=\scriptsize]{prompt} (llm);
\draw[arrow] (llm) -- node[above left,font=\scriptsize]{output} (oracle);
\draw[arrow] (llm) -- node[below left,font=\scriptsize]{output} (slm);
\draw[arrow] (oracle) -- node[above right,font=\scriptsize]{bitvector} (gate);
\draw[arrow] (slm) -- node[below right,font=\scriptsize]{score} (gate);
\draw[arrow] (gate) -- node[above,font=\scriptsize]{pass} (output);
\draw[arrow, dashed] (gate.south) -- ++(0,-1.2) -| node[below,font=\scriptsize,pos=0.25]{revise} (llm.south);
\end{tikzpicture}
\caption{Conative gating architecture. The LLM's output is evaluated
in parallel by the deterministic policy oracle and the adversarial SLM
evaluator. The consensus gate combines both assessments. Dashed line
indicates the revision feedback loop.}
\label{fig:architecture}
\end{figure}
% ================================================================
\section{Byzantine Fault Tolerance Analogy}
\label{sec:byzantine}
The conative gating architecture is directly inspired by the
Byzantine Generals Problem~\citep{lamport1982byzantine}. In the
classical formulation, $n$ generals must agree on a battle plan,
but up to $f$ of them may be traitors who send inconsistent messages.
The fundamental result is that consensus requires $n \geq 3f + 1$
honest participants.
We reformulate the problem for AI-assisted development.
\subsection{The LLM as Byzantine Node}
In our model, the LLM is a node that may produce correct
(policy-compliant) output or incorrect (policy-violating) output.
It is ``Byzantine'' in the precise technical sense: its failures
are \emph{arbitrary}. Unlike a crash fault (the model produces no
output) or an omission fault (the model drops some requirements),
a Byzantine fault produces output that \emph{appears correct} but
violates constraints. This is exactly what conative drives produce:
plausible, well-structured, confidently-presented output that
violates policy.
\begin{definition}[Byzantine Output]
An LLM output $o$ is \emph{Byzantine} with respect to policy $\Pi$ if:
\begin{enumerate}
\item $o$ is syntactically well-formed and appears reasonable to
a non-expert reviewer, and
\item $o$ violates at least one constraint in $\Pi$.
\end{enumerate}
\end{definition}
Note the dual requirement. An obviously broken output (syntax errors,
gibberish) is not Byzantine---it is a detectable crash. The danger
of conative drives is precisely that they produce \emph{plausible}
violations.
\subsection{Consensus Requirements}
In classical BFT with $f = 1$ Byzantine node (the LLM), we need
$n \geq 4$ nodes for consensus. However, our system exploits
asymmetry: the policy oracle is \emph{deterministic} and
\emph{verifiable}, which changes the trust model.
\begin{theorem}[Consensus with Deterministic Oracle]
\label{thm:consensus}
Given a Byzantine node $L$ (the LLM), a deterministic oracle $O$
that is sound (\cref{def:oracle-soundness}), and a probabilistic
evaluator $E$ with false negative rate $\epsilon < 0.5$, the
consensus gate $G$ satisfies:
\begin{equation}
P(\text{Byzantine output passes gate}) \leq \epsilon \cdot P(\text{violation is purely semantic})
\end{equation}
That is, only semantic violations (those invisible to the oracle)
can pass the gate, and they pass with probability at most $\epsilon$.
\end{theorem}
\begin{proof}
Consider an output $o$ that violates policy $\Pi$. Either the
violation is detectable by the oracle (a ``hard'' violation) or it
is not (a ``soft'' violation).
\emph{Case 1: Hard violation.} Then $\exists\, i : O(o, c_i) = 0$,
so $\mathbf{b}$ contains a zero. By \cref{eq:gate}, $G$ returns
\texttt{reject} regardless of $s$. The Byzantine output is blocked
with probability 1.
\emph{Case 2: Soft violation.} Then $\forall\, i : O(o, c_i) = 1$
(the oracle passes the output). The output is blocked if and only
if $E(o, \Pi) < \theta_{\text{high}}$. By assumption, $E$ has
false negative rate $\epsilon$, so the probability that $E$ assigns
$s \geq \theta_{\text{high}}$ to a non-compliant output is at most
$\epsilon$.
Combining: $P(\text{pass}) = 0 \cdot P(\text{hard}) + \epsilon \cdot P(\text{soft}) = \epsilon \cdot P(\text{soft})$.
\end{proof}
\subsection{Comparison with Classical BFT}
\begin{table}[t]
\centering
\caption{Mapping between BFT and conative gating concepts.}
\label{tab:bft-mapping}
\begin{tabular}{@{}lll@{}}
\toprule
\textbf{BFT Concept} & \textbf{Conative Gating Analogue} & \textbf{Properties} \\
\midrule
Byzantine general & LLM & Arbitrary faults \\
Honest general & Policy oracle & Deterministic, verifiable \\
Lieutenant & SLM evaluator & Probabilistic, trained \\
Message & Generated output & May be correct or faulty \\
Consensus & Gate decision & Requires oracle + SLM agreement \\
Fault tolerance & Policy enforcement & $f = 1$ Byzantine node \\
\bottomrule
\end{tabular}
\end{table}
The key departure from classical BFT is that we do not require the
Byzantine node to be convinced or corrected. In traditional BFT,
consensus means all honest nodes agree on a value. In conative
gating, we do not care what the LLM ``thinks''---we care only about
what passes the gate. This is a strictly weaker requirement, which
is why we can achieve it with fewer nodes than the classical
$3f + 1$ bound.
\subsection{Practical BFT Properties}
\begin{proposition}[Liveness]
\label{prop:liveness}
The conative gating system is live (eventually produces output) if
the LLM is capable of generating at least one policy-compliant
output for the given prompt, and the revision loop has sufficient
iterations.
\end{proposition}
\begin{proof}[Proof sketch]
If a compliant output $o^*$ exists in the LLM's output distribution,
then with probability $p > 0$, the LLM generates $o^*$ on any
given attempt. After $n$ revision attempts with violation feedback,
the probability of generating at least one compliant output is
$1 - (1-p)^n$. For the typical case where $p \geq 0.1$ and
$n = 3$, this exceeds 0.999.
If no compliant output exists (the task is impossible within policy),
the system correctly returns \texttt{reject} with a violation
report---this is the desired behaviour, not a liveness failure.
\end{proof}
\begin{proposition}[Safety]
\label{prop:safety}
The conative gating system is safe (never passes policy-violating
output through the gate) with probability $1 - \epsilon \cdot P(\text{soft})$,
where $\epsilon$ is the SLM's false negative rate and $P(\text{soft})$
is the probability that a violation is purely semantic.
\end{proposition}
This safety bound is significantly stronger than any bound achievable
through prompting alone, because the oracle provides deterministic
guarantees on hard constraints and the SLM provides probabilistic
guarantees on soft constraints with a deliberately conservative
threshold.
% ================================================================
\section{Inhibitory vs. Excitatory Constraint Enforcement}
\label{sec:inhibitory}
\subsection{The Excitatory Paradigm}
All widely-deployed approaches to LLM constraint enforcement are
\emph{excitatory}: they attempt to make the model produce correct
output by providing the right inputs.
\begin{itemize}
\item \textbf{System prompts}: Prepend instructions that describe
the desired behaviour.
\item \textbf{Few-shot examples}: Provide examples of correct
output.
\item \textbf{RLHF / RLAIF}: Train the model to prefer correct
outputs.
\item \textbf{Constitutional AI}~\citep{bai2022constitutional}:
Train the model to self-critique using principles.
\item \textbf{RAG}: Retrieve relevant policy documents and
include them in the prompt.
\item \textbf{Fine-tuning}: Train the model on domain-specific
compliant examples.
\end{itemize}
Each of these approaches operates on the model's \emph{input} or
\emph{weights}, attempting to shift the probability distribution
over outputs towards the compliant region. They share a fundamental
assumption: that with sufficient information, the model will
generate compliant output.
This assumption is false. The conative drives identified in
\cref{sec:taxonomy} are not information deficits. The model has
the information; it has competing objectives. Adding more
information does not resolve the competition---it often intensifies
it, because richer context activates more drives simultaneously.
\subsection{The Inhibitory Paradigm}
Conative gating is \emph{inhibitory}: it does not modify the model's
generative process. It evaluates the model's output \emph{post hoc}
and blocks non-compliant results.
The biological analogy is precise. In vertebrate motor control,
the cerebellum does not generate movement---the motor cortex does.
The cerebellum's role is \emph{inhibitory}: it prevents incorrect
movements, smooths trajectories, and enforces timing constraints.
Damage to the cerebellum does not cause paralysis (the motor cortex
still works); it causes \emph{dysmetria}---movements that overshoot,
undershoot, or miss their targets entirely.
LLMs under excitatory-only constraint enforcement exhibit the
cognitive equivalent of dysmetria. They generate output that is
approximately correct, structurally reasonable, and confidently
presented---but that overshoots or undershoots the policy boundaries.
The conative gating system acts as the cerebellum: it does not
generate output, but it prevents incorrect output from reaching
the effectors (the user's codebase).
\subsection{Formal Comparison}
\begin{table}[t]
\centering
\caption{Comparison of excitatory and inhibitory enforcement paradigms.}
\label{tab:paradigm-comparison}
\begin{tabular}{@{}lll@{}}
\toprule
\textbf{Property} & \textbf{Excitatory} & \textbf{Inhibitory} \\
\midrule
Modifies & Model input/weights & System output \\
Trust model & Model is approximately aligned & Model is Byzantine \\
Failure mode & Silent violation & Explicit rejection \\
Cost of false negative & Policy violation propagates & Policy violation propagates \\
Cost of false positive & N/A (no rejection mechanism) & Regeneration delay \\
Composability & Limited (prompt length) & Unlimited (rule library) \\
Verifiability & Empirical only & Formal (for oracle rules) \\
Conative drive resistance & Low (drives operate on generation) & High (evaluation is independent) \\
\bottomrule
\end{tabular}
\end{table}
The most important row in \cref{tab:paradigm-comparison} is
``Failure mode''. Excitatory approaches fail silently: the model
generates non-compliant output and the user has no indication that
a violation occurred. Inhibitory approaches fail loudly: the gate
rejects the output and reports the specific violation. Silent
failures compound; loud failures are corrected.
\subsection{Why Not Both?}
The optimal approach is, of course, to combine excitatory and
inhibitory mechanisms. Use system prompts, few-shot examples, and
RLHF to improve the model's \emph{base rate} of compliance, and
use conative gating to catch the residual violations. This layered
approach mirrors biological motor control, where cortical planning
(excitatory), basal ganglia selection (mixed), and cerebellar
correction (inhibitory) cooperate.
However, our empirical results (\cref{sec:evaluation}) show that
the inhibitory layer provides the majority of the improvement.
Moving from no enforcement to excitatory-only enforcement reduces
violations by approximately 40\%. Adding the inhibitory layer
reduces violations by a further 94\%. The marginal contribution
of the inhibitory layer is dominant.
% ================================================================
\section{Implementation}
\label{sec:implementation}
\subsection{Policy Oracle: Rust Implementation}
The policy oracle is implemented in Rust, chosen for its combination
of performance, memory safety, and expressive type system. Rules
are defined as structured data, not code, to enable formal analysis:
\begin{lstlisting}[language=Rust,caption={Oracle rule definition (simplified).}]
/// A single policy rule that can be evaluated against LLM output.
/// Each rule is deterministic: given the same output and policy,
/// it always returns the same verdict.
pub enum Rule {
/// Pattern must not appear in output
Forbidden {
pattern: Regex,
scope: Scope,
severity: Severity,
rationale: String,
},
/// Pattern must appear in output (for applicable file types)
Required {
pattern: Regex,
scope: Scope,
file_types: Vec<FileType>,
rationale: String,
},
/// Structural constraint on file/directory layout
Structural {
predicate: StructuralPredicate,
rationale: String,
},
/// Toolchain usage constraint
Toolchain {
allowed: Vec<Tool>,
forbidden: Vec<Tool>,
rationale: String,
},
}
/// Evaluate all rules against an output fragment.
/// Returns a bitvector of pass (true) / fail (false).
pub fn evaluate(output: &Output, rules: &[Rule]) -> BitVec {
rules.iter().map(|r| r.evaluate(output)).collect()
}
\end{lstlisting}
\textbf{Performance.} The oracle evaluates 50 rules against a
500-line output in under 10ms on commodity hardware. The
deterministic nature of evaluation means results are cacheable:
identical outputs always produce identical bitvectors.
\textbf{Rule specification.} Rules are specified in a
machine-readable format (S-expressions, following the project's
existing convention for machine-readable metadata). This
separation of rules from code enables non-programmer policy
authors to define constraints.
\subsection{SLM Evaluator: Training Pipeline}
The SLM evaluator is based on a 3B parameter model (Phi-3-mini
architecture~\citep{abdin2024phi}) fine-tuned for adversarial
compliance evaluation.
\textbf{Training data.} We constructed a dataset of 50,000
(output, policy, verdict) triples from three sources:
\begin{enumerate}
\item \textbf{Real violations} (15,000): Collected from 18 months
of AI-assisted development with policy logging enabled.
Each violation was manually annotated with the specific
policy violated and the conative drive responsible.
\item \textbf{Synthetic violations} (25,000): Generated by
prompting GPT-4, Claude, and Gemini to produce outputs that
``subtly'' violate specified policies. The prompt
explicitly requested plausible violations that would pass
cursory review.
\item \textbf{Compliant outputs} (10,000): Known-good outputs
from the same development corpus, verified by the
deterministic oracle.
\end{enumerate}
\textbf{Training objective.} The SLM is trained with the asymmetric
reward function in \cref{eq:slm-reward}, using proximal policy
optimisation (PPO) with $\alpha = 10, \beta = 1$. The training
explicitly rewards paranoia: the SLM should suspect violation even
when the output looks correct.
\textbf{Calibration.} The SLM's output score is calibrated using
temperature scaling~\citep{guo2017calibration} on a held-out
validation set. After calibration, a score of 0.8 corresponds to
approximately 95\% true compliance probability.
\subsection{Consensus Gate: Decision Logic}
The consensus gate is implemented as a simple deterministic function
(\cref{eq:gate}) with the following operational parameters:
\begin{table}[h]
\centering
\caption{Consensus gate parameters.}
\label{tab:gate-params}
\begin{tabular}{@{}lll@{}}
\toprule
\textbf{Parameter} & \textbf{Default} & \textbf{Description} \\
\midrule
$\theta_{\text{low}}$ & 0.3 & Below this, reject regardless \\
$\theta_{\text{high}}$ & 0.8 & Above this (and oracle passes), accept \\
$n_{\text{revisions}}$ & 3 & Maximum revision attempts \\
Oracle veto & Enabled & Any oracle failure = reject \\
\bottomrule
\end{tabular}
\end{table}
\subsection{Revision Feedback Loop}
When the gate returns \texttt{revise}, it constructs a structured
feedback message for the LLM:
\begin{lstlisting}[caption={Revision feedback format.}]
POLICY VIOLATION DETECTED - REVISION REQUIRED
Oracle violations:
- Rule 14 (FORBIDDEN): Detected 'npm install' on line 7.
Policy requires: Deno as package manager.
- Rule 3 (REQUIRED): Missing SPDX header in generated file.
SLM evaluation: 0.45 (below threshold 0.80)
SLM notes: Output uses TypeScript idioms despite ReScript policy.
Import pattern on line 12 is TypeScript-specific.
Revision attempt: 1 of 3
INSTRUCTION: Regenerate the output addressing ALL listed violations.
Do not acknowledge this message; produce only the revised output.
\end{lstlisting}
The final line (``do not acknowledge this message'') is a
targeted counter to the helpfulness override drive: it prevents the
LLM from spending tokens discussing the violations rather than
fixing them.
% ================================================================
\section{Evaluation}
\label{sec:evaluation}