Training & alignment

Six post-training paradigms, parameter-efficient methods, and distributed configs.

SFT

Supervised fine-tuning on instruction-formatted JSONL.

DPO & SimPO

Direct Preference Optimization on chosen/rejected pairs; SimPO for reference-free, lower-memory variants.

KTO

Kahneman-Tversky preference learning on binary feedback.

ORPO

Single-pass odds-ratio preference optimization.

GRPO

Group Relative Policy Optimization for reasoning RL.

QLoRA + DoRA

4-bit NF4 quantization with LoRA.

GaLore

Gradient low-rank projection for full-parameter training.

DeepSpeed & FSDP

Multi-GPU distributed training. ZeRO presets, FSDP, Unsloth backend.

Long-context

RoPE scaling, NEFTune noise injection, sample packing.

Evaluation & safety

Benchmarks, judges, harm classification, and the auto-revert that ties them together.

Benchmark integration

Plug-in lm-evaluation-harness tasks. Per-task floor thresholds.

LLM-as-judge

Quality scoring via OpenAI API or a local judge model.

Llama Guard safety

Confidence-weighted scoring across 14 harm categories.

Auto-revert

If thresholds fail, ForgeLM rolls back to the last-good checkpoint.

Trend tracking

Cross-run safety history (safety_trend.jsonl per output_dir).

Exit codes

0 / 1 / 2 / 3 / 4 — a public contract for CI/CD.

Standalone safety eval

forgelm safety-eval runs Llama Guard against a --probes JSONL prompt file (or --default-probes for the bundled 50-prompt set) and emits a per-category safety summary (safety_results.json + safety_trend.jsonl).

Data ingestion & audit

Raw documents to clean JSONL, with PII / secrets / quality / leakage all surfaced before training.

Multi-format ingest

PDF, DOCX, EPUB, TXT, Markdown → SFT-ready JSONL.

PII masking

Email, phone, credit card, IBAN, national IDs.

Secrets scrubbing

AWS keys, GitHub PATs, JWTs — redacted with [REDACTED-SECRET].

Near-duplicate detection

LSH-banded simhash or MinHash LSH.

Quality filter

Gopher / C4 / RefinedWeb-style heuristics.

Language detection

Top-3 language counts per split via langdetect.

Cross-split leakage

Catches train rows that also appear in validation/test.

Annex IV provenance

Audit report embedded in EU AI Act Article 10 governance artifact.

Enterprise & MLOps

Built for pipelines: containers, webhooks, structured outputs, air-gap, model cards.

Webhook notifications

Slack, Teams, Discord, or any HTTP webhook receiver alerts on training events.

Experiment tracking

W&B, MLflow, TensorBoard via report_to.

JSON output mode

--output-format json emits a machine-readable envelope.

Air-gap operation

No mandatory internet calls.

Docker & compose

Official Dockerfile and docker-compose.yaml.

Model card auto-gen

HuggingFace-compatible README with metrics and config.

GPU cost estimation

Auto-detection across 16 GPU profiles with cost tracking.

Synthetic data pipeline

Teacher-to-student distillation with --generate-data.

Model merging

TIES, DARE, SLERP, linear merge via --merge.

Library API

from forgelm import … exposes ForgeTrainer, audit_dataset, verify_audit_log, verify_annex_iv_artifact, mask_pii, and friends as Python functions for embedding inside other pipelines.

Environment diagnostics

forgelm doctor probes Python, GPU, drivers, optional extras, disk space, network, and prints a pass / warn / fail triage report.

Air-gap pre-cache

forgelm cache-models and forgelm cache-tasks stage HuggingFace models and lm-eval-harness datasets for offline runs.

Deterministic audit workers

--workers N parallelises the data audit while preserving deterministic, byte-identical reports across runs.

Supply-chain security

CycloneDX 1.5 SBOM emitted per release tag, plus pip-audit nightly and bandit in CI.

Compliance & GDPR tooling

EU AI Act Articles 9-17, GDPR Article 15 + 17, ISO 27001 / SOC 2 Type II alignment evidence.

Article 14 staging gate

forgelm approve / forgelm reject + forgelm approvals implement the human-oversight staging directory with audit-stamped sign-off.

GDPR Article 17 erasure

forgelm purge drops a data-subject's rows from training corpora and stamps the deletion in the append-only audit log.

GDPR Article 15 access

forgelm reverse-pii scans masked JSONL corpora for forensic substring or salted-digest matches that surface every row in which a data-subject identifier appears.

Annex IV verifier

forgelm verify-annex-iv validates the Annex IV §1-9 schema completeness and the bundle's manifest_hash for tampering detection. (Audit-chain integrity is the separate forgelm verify-audit command.)

GGUF integrity verifier

forgelm verify-gguf validates the GGUF magic header, parses the metadata block, and re-checks the SHA-256 sidecar (when present) before you ship a quantized model.

ISO 27001 / SOC 2 alignment

Audit-trail, change-management, data-lineage, and supply-chain evidence the deployer's auditor asks for. Software is aligned, not certified.

Want to see it in YAML?

Every feature on this page maps to a field on a single YAML config.