Article-by-article mapping

Where each obligation lives in the code

Each card maps a Regulation (EU) 2024/1689 article to the ForgeLM module that fulfils it.

Article 9

Risk management

A continuous, iterative process: identify foreseeable risks, evaluate, mitigate.

forgelm/safety/ · forgelm/compliance.py
Article 10

Data & data governance

Quality, relevance, representativeness criteria you declare. PII counts and masking, cross-split leakage report. Optional Presidio ML-NER PII layer and Croissant 1.0 dataset card emitted alongside the audit. Every audit report can be filed as part of your Article 10 evidence; collection, provenance and bias-examination documentation still come from you.

forgelm/data_audit/ · forgelm/ingestion.py
Article 11

Technical documentation

Annex IV's nine required §1-9 sections — auto-populated from the run.

compliance/annex_iv_metadata.json
Article 12

Record-keeping (logs)

Append-only event log over training start/end, eval gates, auto-revert decisions, human-approval gates, GDPR Article 17 erasure, and Article 15 access-request queries.

forgelm/compliance.py · audit_log.jsonl
Article 13

Transparency

Auto-generated model card (capabilities, intended use, training data summary) plus deployer instructions, written every successful run.

final_model/README.md · final_model/deployer_instructions.md
Article 14

Human oversight

Optional evaluation.require_human_approval: true moves the trained checkpoint into a staging directory; forgelm approve / forgelm reject + forgelm approvals record a human sign-off, with the approver identity stamped into the audit log. It supports design-time oversight documentation; oversight of the deployed system stays with the deployer.

forgelm approve · forgelm reject · forgelm approvals
Article 15

Accuracy & robustness

Benchmark gates per-task floor; with evaluation.auto_revert: true, a post-train number below the floor deletes the trained artefacts and the run exits 3. Cybersecurity: secrets / PII at ingest, dependency CVE awareness.

forgelm/benchmark.py
Article 16-17

Conformity & QMS

QMS SOPs in docs/qms/ cover model training, data management, incident response, change management, plus access control / encryption-at-rest / risk treatment / Statement of Applicability.

docs/qms/
GDPR

PII redaction at ingest

--pii-mask redacts emails, phones, credit cards (Luhn), IBAN, national IDs (TR/DE/FR/US-SSN) before chunks land in JSONL. It reduces what reaches training and supports data minimisation (Article 5(1)(c)); names and free text are not detected, so it is an aid, not a guarantee.

forgelm/data_audit/ · forgelm/data_audit/_pii_regex.py
GDPR Art. 15

Right of access

forgelm reverse-pii searches JSONL corpora for a data-subject identifier, as plain text or as a salted SHA-256 digest written by an external masking pipeline, and reports every line in the scanned files that contains it. By default the match is literal and case-sensitive (--type custom takes a regex). It is an input to your Article 15 response, which must also give a copy of the data and the Article 15(1)(a)-(h) information; raw sources and the trained model are not searched.

forgelm reverse-pii
GDPR Art. 17

Right to erasure

forgelm purge deletes rows by id from a training corpus and records data.erasure_requested + data.erasure_completed events in the append-only audit log. It is one step of an Article 17 erasure: trained weights, source documents and copies elsewhere are not changed.

forgelm purge
ISO 27001 · SOC 2 Type II

Aligned, not certified

Software cannot be ISO 27001 or SOC 2 certified — only organisations can. ForgeLM is aligned with the controls an auditor asks the deployer about: it produces the audit-trail, change-management, data-lineage, and supply-chain evidence on every run, ready to drop into your audit binder.

Pillar 1

Audit trail

Append-only audit_log.jsonl per run with HMAC + SHA-256 hash chain + genesis manifest sidecar. forgelm verify-audit validates the chain end-to-end. HMAC integrity is active when FORGELM_AUDIT_SECRET is KMS-managed and rotated per output-dir lifecycle.

audit_log.jsonl · forgelm verify-audit
Pillar 2

Change control

Article 14 staging gate (forgelm approve / forgelm reject) plus human_approval.required/granted/rejected audit events plus forgelm verify-audit chain integrity — with the gate on, every model promotion is attributed to the recorded approver identity; keeping trainer and approver different people is the deployer's control.

forgelm approve · forgelm verify-audit
Pillar 3

Data lineage

data_provenance.json (SHA-256 fingerprint + size + mtime + HF Hub revision pin, graded by whether a pinned load stands behind it) and data_governance_report.json (collection method, annotation process, known biases, personal-data flag, DPIA completion) cover the lineage questions an auditor asks first.

data_provenance.json · data_governance_report.json
Pillar 4

Supply chain

CycloneDX 1.5 SBOM emitted per release tag for every (OS x Python-version) cell of the publish matrix. Wave 4 added pip-audit nightly + bandit in CI for static + dynamic security scanning of the build itself.

SBOM · pip-audit · bandit

For the full audit cookbook, including 8 audit-floor questions and a 93-control coverage map, see docs/guides/iso_soc2_deployer_guide.md.

What you get on disk

A run's compliance footprint

After every successful (or failed) run, this is what lands in your output directory.

checkpoints/policy-bot/
checkpoints/policy-bot/             # training.output_dir from your YAML
├── audit_log.jsonl                 # Article 12 append-only event log
├── audit_log.jsonl.manifest.json   # SHA-256 sidecar over the audit log
├── data_audit_report.json          # Article 10 quality/PII/leakage audit — you place it here (see note)
├── compliance/                     # Annex IV bundle (Articles 9-17)
│   ├── annex_iv_metadata.json      # Article 11 technical documentation (flat JSON)
│   ├── compliance_report.json      # Full Article 9-17 manifest — superset of the per-artefact files
│   ├── training_manifest.yaml      # Human-readable summary (model, data, params, final metrics)
│   ├── data_provenance.json        # Data lineage extracted from the manifest (Article 10)
│   ├── risk_assessment.json        # Article 9 risk-management output (when risk_assessment block is set)
│   └── data_governance_report.json # Article 10 governance summary (sources, licenses)
└── final_model/                    # PEFT adapter or merged weights
    ├── README.md                   # Article 13 model card (HuggingFace-compatible) — auto-generated
    ├── deployer_instructions.md    # Article 13 downstream-deployer guidance
    └── model_integrity.json        # SHA-256 over weights/adapter for Article 15

# Note on data_audit_report.json: the training run does not produce it.
#   `forgelm audit` writes it to --output DIR (default ./audit/). The trainer
#   looks for it at training.output_dir and, when found, inlines it into
#   compliance/data_governance_report.json as the Article 10 data-quality
#   section. When absent the run still succeeds, but that section is dropped
#   and a compliance.governance_section_missing event lands on the audit log.
#   So: forgelm audit data/train.jsonl --output ./checkpoints/policy-bot/
Honest limits

What ForgeLM does not claim

Want a deeper look?

The compliance module, audit log schema, and Annex IV generator are all in forgelm/compliance.py.