Auditex: engineering journey and model training record
How Auditex reached 2.0.0 (23 November 2026), with the record of the model research run on the Isambard-AI and JUPITER supercomputers. In one sentence: value rules decide every SCuBA verdict, a ready-made open model may word the answer but cannot change it, and none of the models we trained beat that ready-made model, so none shipped. Every figure here is traced to our project records.
1. What Auditex is
Auditex is a read-only tenant-audit toolkit for Microsoft 365 and Google Workspace. It ships as a Python 3.11 to 3.14 package with two CLIs (auditex, azure-tenant-audit) and a local MCP server (auditex-mcp). A run collects evidence, normalises it, answers the CISA SCuBA baselines (Microsoft 365 spec v3.9.1, 102 policies; since 2.1.0 also Google Workspace, ScubaGoggles v1.1.0, 138 policies), and writes a validated run bundle plus reports, exports, drift comparisons and checksum-sealed customer packs.
The boundaries come first, and the rest of the design follows from them:
- Audit, probe, report, export, MCP audit tools and customer-pack flows never write to a tenant, and never read message bodies or file content. A PowerShell read guard refuses content-returning cmdlets at runtime, Google Workspace text fields are excluded at the request, and scanner tests check that every request is a read:
GET, Graph batches ofGETs, and one body-freePOSTthat Microsoft defines as a read. Two of the permissions Microsoft requires for the reader app (Sites.FullControl.Alland the Power Platform registration) allow more than Auditex does with them; the permission guide says so. - Microsoft 365 is audited one way only: a reader app with a certificate (1.6.0), with at most one sign-in per audit.
- Shareable output is masked with a private per-run HMAC key (D5 pseudonyms, 1.5.0). Every CLI flag that can carry a secret is redacted, and abbreviated flags are rejected (
allow_abbrev=False; the 1.2.2 and 1.2.3 fixes). - There is no telemetry. Collection includes public DNS lookups of the tenant's domain names through a DNS-over-HTTPS resolver (Cloudflare's public DNS service unless you name another). Outside collection, and any notification destination the user configures, the only network call is an optional one-time model download from Hugging Face (section 6).
- The output is evidence for a reviewer. It is not a certificate or an audit opinion, and the SCuBA answers and framework mappings are Auditex's own reading of the published documents.
2. Architecture
Engine and product layers
src/azure_tenant_audit/is the engine. Collectors and adapters read the tenant through guarded Graph and PowerShell paths.normalizeandfindingsbuild the evidence,value_rules/answers the SCuBA policies,explainer/renders a deterministic template explanation,output_redactionapplies the redaction profiles, andfinalizeseals the bundle. The engine never imports the product layer.src/auditex/is the product layer: the guided CLI flows, reporting, exporters, compare and drift, customer packs, the Google Workspace provider, the MCP server and, since 1.7.0, the local answer (answer_digest,answer_checks,local_answer).- Collection scope is data-driven from
configs/. Shipped content is listed both inpyproject.tomland inshipped_content.py, and a parity test keeps the two in step.
The evidence bundle
Each run produces a finalised bundle whose layout is fixed by CONTRACT_VERSION (currently 2026-11-11) and documented in docs/reference/output-contract.md. Since 1.2.0 every evidence reference resolves to a hashed record, and the validator fails on unresolved or hash-mismatched references. bundle-hashes.json covers the artefacts and lists exclusions with reasons, such as the private pseudonym key. Gates are local: make lint, make test, make contract-smoke (an offline run whose finalised bundle is validated and digest-compared), make acceptance, make release-check, and a reproducible-build check on the wheel and sdist.
3. From a verdict model to value rules
The specialist-model programme (to 1.3.0)
Before the plan described here, Auditex tried to have a fine-tuned model decide SCuBA verdicts. Labelled cases were mined from CISA ScubaGear's Rego policies under OPA, over generated tenant variants, with the evidence view taken from each policy's input dependencies. A Prowler consensus arm cross-checked them. The best build, v10, was Ministral 3 8B Instruct with a LoRA adapter, quantised to Q5_K_M. It scored 403/435 on its own and 419/435 combined with rule pre-checks, with 282/298 on twin-free rows. It was catalogued for development and never released.
Three things ended that line:
- Determinism. A security verdict must be reproducible and explainable line by line, and a sampled model's answer is neither.
- Twins. Under the held-out twin definition later written in M02-T01 (same policy, same decisive evidence, same typed verdict), 137 of the 435 test rows had a twin in the training split, so the headline score partly measured recall.
- Spread. Four fresh runs of the unchanged v10 recipe on a byte-identical pack scored 393, 393, 387 and 372 quantised (mean 386.25, sample sd 9.91), against the recorded 403. The archived checkpoint still scored 402 through the same scorer, so the pipeline was sound and the gap sat in run-to-run variation. Since then every reported score uses at least three seeds (DEC-009, DEC-011).
Rule-only assessment (1.3.0 and 1.4.0)
In 1.3.0 (8 November 2026) all 102 catalogue policies gained deterministic value rules, and the model was never called again. In 1.4.0 (10 November) the model layer was removed outright: the auditex model command, the model client, training tools and oracle builders all went. A policy without usable evidence reports not assessed with a reason code (section_not_collected, evidence_unusable, optional_collection_not_enabled). It never falls back to a guess.
The rule work ran to ScubaGear parity, policy by policy:
- Rules are pinned to ScubaGear's Rego at a fixed commit (OPA 1.20.2).
configs/scuba-value-rules.jsonholds the spec, and generated rule packs are drift-checked. - A replay acceptance suite (
make acceptance) runs the v3.9.1 value-rule vectors against the pinned hashes. - Live lab collections drove corrections. One example: privileged role assignments now come from
roleAssignmentScheduleInstances, as ScubaGear reads them, because the schedules endpoint fills an outside-PIM assignment's start date with the read time and so produced a wrong met (DEC-096, 1.6.0). - Scale testing found two product defects, now fixed. A never-configured Power Platform tenant isolation setting crashed the assessment on a schema enum, which affected one synthetic tenant in seven (DEC-129, fixed in 1.7.0). A lone UTF-16 surrogate in tenant text either stopped finalisation or turned a not met into not assessed (fixed in 1.8.0, section 7).
4. The research setup
Plan v4 (DEC-001, 11 November 2026) ran a research track ("Track B") on the Isambard-AI and JUPITER supercomputers. Its research rules were set before any scores existed:
- A standalone kit outside the repository. It holds the trainer, data, judging code and run records, and imports nothing from
auditexorazure_tenant_audit. A verifier,kit-check, recomputes every reported measure from hashed artefacts (predictions, raw judgements, scheduler accounting) and exits non-zero on any mismatch. Reviews by a second model vendor reran it. - Reading rules written before scoring, at least three seeds per configuration, and figures reported as a mean with minimum and maximum.
- Sealed held-out sets. They live only on the project store, never enter the public repository, and are read once per build, never for selection. They are kept after the project rather than deleted (DEC-141).
- Every run inventoried from the scheduler exports, failed and retried jobs included.
5. Round A: training an explainer (M01 to M03)
The job
The rules give a verdict and the template explainer gives a fixed explanation. The question was whether a fine-tuned model could write fuller explanations and remediation steps for the same verdict. The model had no verdict output, and any verdict it stated had to equal the input (ARCHITECTURE explainer interface).
Data
- Held-out set (M02-T02). We generated 501 cases offline from the pinned ScubaGear Rego on synthetic seed tenants that were disjoint from training. The set covers all 102 policies with no policy above a 3 per cent share, has zero twins against every training split, and was sealed by sha256. Its labels were then re-expressed in the form the product actually collects (M02-T06), because a model in the product only ever sees collected evidence. 221 rows survived (77 policies, 120 of 314 cells), and all 221 labels were reproduced by the released 1.4.0 rules (DEC-025).
- Training rows (M02-T03). Inputs came only from training-split cases: policy, rule verdict and reason, evidence excerpt and template text, produced with the 1.4.0 wheel. Targets were written by an open-weight teacher, Mistral Small 4 (119B, Apache-2.0). Every candidate had to pass frozen deterministic checks. 3,005 rows were kept (2,738 train, 267 validation), 766 cases were dropped by the checks, and 9 twins of sealed rows were removed at build.
- Judging (M02-T04). The deterministic checks (verdict, values, policy, references, required steps, length) were frozen by hash before any data was generated. They caught 611 of 611 planted defects. The judge was gpt-oss-120b, from a different family to every candidate, comparing each output with the template in both orders. It flagged 98.5 per cent of planted defects and agreed with itself under position swap on 92.6 per cent of pairs.
The bar (DEC-013)
Calibration showed that mechanically fuller text reaches a judge preference band of 55.7 to 72.9 per cent. A plain "beats the template more than half the time" rule would therefore reward padding. The bar was set as follows: 100 per cent on the factual floor, at least 99 per cent passing every frozen check, every seed's preference band wholly above 72.9 per cent (only a win in both orders counts as a win), a cap on judge flags, and a 24-output human read.
What happened
- Base comparison (M03-T01). Ministral 3 8B and 14B, Gemma 4 31B and Qwen3.8-27B were each trained with bf16 LoRA on three seeds. Every base tied with the template, at preference 0.49 to 0.52 across seeds against 0.729. Gemma 4 31B ranked first.
- Ceiling probe. The teacher's own targets scored 0.476 against the template. Training on that data could never reach the bar.
- Data-round pilots on the 190 validation rows with headroom, where about 139 wins in both orders were needed: attempt 1 won 6 (0.511), attempt 2 won 18 (0.534), attempt 3 with real lab-run exemplars won 11 (0.521), and attempt 4 with a stronger writer (Qwen3.8-Flash-Next, four candidates per row) won 38 (0.571). Attempt 4 passed the frozen checks on 264 of 267 rows, but 226 of 267 pairs were ties.
- A second job: answering questions about a run (M03-T14, M03-T15). We built a 1,037-question set (drawn from 4 lab and 6 synthetic runs, including 119 unanswerable questions) with fail-closed answer checks that 9,282 adversarial answers all failed. One pilot reached a hard-check pass rate of 0.90 against a bar of 0.95, with preference 0.528.
Diagnosis. Both jobs failed for the same reason. The fixed text already explains a single check well, so the judge scored most model text as a tie. An independent review concluded that more data, preference training or a bigger base would not change this, and noted that the bar measured judge preference rather than benefit to the user (M03 closing findings). Training stopped at this point (DEC-113).
6. The product pivot: a local answer that cannot change a verdict (M10, 1.7.0)
The product goal was restated in plain terms: run the audit, then have a local model tell the user what is right and what is wrong, with the emphasis on getting the answer right. M10 used ready-made models with no training. The hard part turned out to be making the model's text checkable, and it took three re-scopes:
- Closed-vocabulary free prose with value references (DEC-116). Reviewers still found negating paraphrases and misused references.
- Structured
say/showoutput, with Auditex rendering verdicts and values itself (DEC-118). Any free composition of allowed words could still assert tenant state ("The passwords expire." beside a met verdict). - Selection only (DEC-119). For each check, the model returns ids from that check's bank of prewritten, reviewed sentences, plus the ids of the values to show. For the run summary it picks frame ids and the items to highlight. Auditex renders every word, and the checks verify only ids: that each exists, belongs to the item and meets its frame's precondition. A failing selection shows the fixed text. Every not-met check is always rendered, in the rules' order, whatever the model selects (DEC-120). Tenant strings reach the model only as quoted, escaped data.
Decoding is constrained by a llama.cpp grammar built from the JSON schema of allowed ids. The runtime is llama-cpp-python 0.3.36 in the optional local-answer extra. There are four pinned Apache-2.0 models: qwen (Qwen3.5-9B Q4_K_M, the default), mistral (Ministral 3 8B), gemma (Gemma 4 E4B) and small (Qwen3.5-4B, for 8 GB laptops). Each is checked by sha256 before every load.
Acceptance (M10-T04): 574 answers per model across ten kit test runs, the same runs seeded with hostile strings, and a 64-check lab run. Every model scored 574/574 with no fallbacks, no contradictions, no completeness or order failures and no injection failures. With Metal, a 64-check run is answered in under 3 minutes. CPU-only takes about 4 to 12 minutes, and Auditex warns before it starts. These numbers come from a shared M3 Pro, not from real 8 GB or 16 GB machines.
7. Round B: a compact Auditex model (M11)
M11 (DEC-115) had four goals: harden the answer with an attack loop, test at scale, train compact models of about 4B parameters on checked answers and attack data, and ship a compact model only if it met the M10 bar on an 8 GB profile. It would become the default only if it beat the ready-made models.
Scale tenants (M11-T01)
A seeded generator writes 2,048 synthetic tenants that cover the 64 rows of the collected scope, each with intent-derived expected verdicts. After the F1 fix, the rules gave 0 disagreements and 0 errors across 131,072 rows. All four shipped models then answered all 2,048 tenants with 100 per cent of sentences passing and no fallbacks, contradictions, completeness problems or injection failures.
Attack loop (M11-T02)
The attacker is internal and never ships: a seeded mutation fuzzer plus a standard open instruct model at a pinned revision, fine-tuned on the strings that got through. Its refusals were not removed (DEC-132). Each round planted at least 2,000 hostile strings into copies of the scale corpus. Round 1 found 260 tricks with one root cause: a lone UTF-16 surrogate either stopped finalisation or flipped a rule-read value to not assessed. The fix repairs surrogates to U+FFFD where data enters the bundle, keeps colliding keys distinct and counts every repair in summary.json (1.8.0). Rounds 2 and 3, with the attacker retrained on round 1, found 0 tricks across 2,048 strings and four models.
Training data (M11-T03)
Rows were built only from answers by the fixed product that passed every check. There were 8,192 scale rows (four models over 2,048 tenants) and 5,764 attack rows with their correct handling, 13,956 in total. The split was by tenant: 11,240 train, 1,042 validation and 1,674 sealed held-out rows (12 per cent of base tenants). A leak check removed 380 attack rows in which a planted string surfaced in the answer, and no control row was dropped. Builders refuse answers from any other product commit and never overwrite an earlier build. The data version is pinned by hash.
Training round 1 (M11-T04)
Three bases were trained with the kit trainer (LoRA r16): Qwen3.5-4B, Ministral 3 3B and Gemma 4 E4B. The rows below are our own fine-tuned versions on this one task; they say nothing about the base models in general. Checkpoint and quantisation were chosen on validation by the M10 checks applied to generated answers, never by eval loss. Plain Q4_K_M broke long answers (sentence pass 0.49), so imatrix Q6_K was used. Peak memory stayed within 6 GB for all three: 4.74, 5.87 and 5.70 GB. Each base was then evaluated once on the sealed set:
| base | sentence pass | fallback sentences | contradiction rows | completeness | header problems | result |
|---|---|---|---|---|---|---|
| Qwen3.5-4B | 0.9948 | 900 | 20 | 8 | 64 | fail |
| Ministral 3 3B | 0.9758 | 4,180 | 12 | 40 | 100 | fail |
| Gemma 4 E4B | 0.9917 | 1,430 | 0 | 8 | 442 | fail |
ready-made qwen (M10) | 1.0 | 0 | 0 | 0 | 0 | 10 leak flags (judge) |
Training round 2 (M11-T06)
We diagnosed round 1 before retraining. The header failures were in product-written lines, so the student was retrained to emit only what the product does not write. Gemma had trained on a 4,000-row sample, so every base now used the full split. The leak flags also hit the ready-made model on control rows. Round 1's held-out set had been spent, so a fresh sealed set was built with a new seed before any training: 1,958 rows from 343 base tenants, disjoint from every earlier split (DEC-139). Gemma and Mistral were dropped on validation. Qwen step 1053 reached 0.9994 sentence pass on the fresh set, but still had 124 fallbacks, 8 contradiction rows and 4 completeness rows. The 6 leak rows were identical for the student and the ready-made model, which identifies them as a judge false positive on product-written lines rather than a leak.
Outcome (DEC-140)
model-bar: fail in both rounds. The remaining failures were on the model side (contradictions, runaway fallbacks, completeness), and the ready-made qwen was already better, so a third round was not run. No compact model ships, and the default stays qwen. 1.8.0 shipped the surrogate fix and the new count fields.
8. Why the default stays the ready-made model
- With grammar-constrained selection, the ready-made
qwenalready scores 100 per cent sentence pass with zero fallbacks on the M10 sets, the 2,048 scale tenants and both sealed M11 sets, and zero contradictions wherever they were reported (M10, scale, round 1), leaving aside the judge false positive. A compact model therefore had to match a perfect result, and on these sets "better" could only mean smaller. - Both compact rounds left systematic model-side errors. The bar allows no contradictions, and every round had some.
- Correctness does not depend on the model. Verdicts, order, values and completeness are rendered by Auditex, so a better model would make answers more pleasant to read but no more correct.
9. Lessons
- Measure against the real baseline. Our fixed text was a strong competitor, and a judge that prefers it, or calls it a draw, is telling you something true. The ceiling probe (0.476 for the teacher's own data) was a cheap check and should have come before the base comparison, not after it.
- Write the reading rule before the score exists. The four-run v10 rule (DEC-009) and the tie rule (DEC-033) prevented choices made after seeing the numbers. Three seeds per configuration showed spreads that a single run hides.
- Twins inflate scores. Define them by decisive evidence, and prove zero twins by a check rather than an assertion.
- Checkers cannot read meaning. Every free-text check we built was beaten by a reviewer within a round. Selection from prewritten sentences is correct by construction, and once we moved to it the safety argument stopped depending on the model.
- Quantisation is part of the model. Plain Q4_K_M halved the sentence pass rate on long answers, and the choice had to be made on generated output, not on loss.
- Judges have false positives too. A flag that fires equally on the ready-made model and on control rows points at the judge, not the model.
- A spent held-out set stays spent. Round 2 built a new sealed set rather than reuse one that had already informed a decision.
- Attack your own pipeline with ordinary test data. A fuzzer plus a retrained open model found a real defect (lone surrogates) that hid failing checks. The attacker never needed its refusals removed.
- Process. Review loops and offline mocks cost more than they found. One live read-only dry run found the faults that thousands of mock steps missed (WASTE-REVIEW, 14 November). We moved to one risk-based review and one repair, then a re-scope.
10. Where things stand
Auditex 2.0.0 is on GitHub and PyPI: verdicts from value rules only, and an optional local answer on four pinned ready-made models with fail-closed checks. The AIRR kit, verifier, answer checks, question set and scale and attack harnesses are kept for reuse, and the training data and sealed sets stay on the project store. Any future model must clear the same bar against the same default.
We acknowledge the use of resources provided by the Isambard-AI National AI Research Resource (AIRR) (McIntosh-Smith, Alam and Woods, 2024, arXiv:2410.11199), operated by the University of Bristol and funded by the UK Government's Department for Science, Innovation and Technology through UK Research and Innovation and the Science and Technology Facilities Council [ST/AIRR/I-A-I/1023]. Neither they, nor Microsoft, Google, CISA, the NCSC, IASME, the Center for Internet Security or any model publisher named here, has reviewed or endorsed Auditex. Their names belong to their owners.