# Preregistration: BR Sovereign LLM **Protocol version:** 1.0.0 **Freeze date:** pending owner approval **Principal investigator:** Guilherme Monteiro, FIAP **ORCID:** 0009-0008-5294-224X **Current stage:** protocol and pipeline validation This document defines the confirmatory study before target-scale training. A signed protocol digest will be recorded before any result used for confirmatory claims is inspected. Pilot measurements may change the protocol only through a dated amendment that distinguishes exploratory from confirmatory analysis. ## Research question Can a Brazilian institution train, recover, evaluate, and serve a Brazilian Portuguese language model from scratch without mandatory external cloud services, while retaining complete legal and technical lineage for every critical artifact? The phrase *from scratch* means that the project trains the tokenizer and model weights from random initialization. It does not mean that the software, accelerators, or scientific ideas were created domestically. ## Unit of analysis A training run is defined by a study fingerprint and an execution fingerprint. The study fingerprint covers: - corpus snapshot and document order; - tokenizer specification and artifact digest; - model architecture; - optimizer and learning-rate schedule; - global batch, sequence length, token budget, and seed; - precision and numerical policy; - evaluation snapshot. The execution fingerprint covers: - container and software digests; - hardware and topology; - process count and parallelism dimensions; - driver, communication library, kernels, and scheduler; - site storage and rendezvous mechanism. Runtime profiles may change execution mechanics but may not change study parameters. ## Fixed model family All confirmatory models are causal decoder-only Transformers with RMSNorm, rotary position embeddings, SwiGLU feed-forward layers, and grouped-query attention. The context length is 2,048 tokens for the scaling study. The tokenizer is a project-trained byte-level BPE with lossless NFC normalization and byte fallback. The planning stages are nano (20–30M), micro (100–125M), small (about 350M), medium (about 1.3B), and target (about 3B). The largest admissible stage is selected only after measuring unique licensed tokens, accelerator throughput, storage bandwidth, and granted accelerator-hours. ## Confirmatory hypotheses ### H1: execution portability For the same study fingerprint, fixed global batch order, and token budget, local single-node and Slurm single-node executions are statistically equivalent. - Primary outcome: held-out cross-entropy in nats per token. - Equivalence margins: -0.02 and +0.02 nats per token. - Replications: at least three registered seeds. - Analysis: paired equivalence test and 95% confidence interval. - Support criterion: the complete interval lies strictly within both margins. - Failure criterion: either bound touches or crosses a margin. MPS runs are semantic smoke tests and cannot count as HPC portability evidence. ### H2: checkpoint recovery An interrupted and resumed run is equivalent to an uninterrupted run. For the same runtime, deterministic recovery requires identical hashes for the model, optimizer, scheduler, random generators, and data cursor. For cross-runtime recovery, the final held-out loss difference must not exceed 0.002 nats per token. At least ten interruptions will be injected at steps drawn from a frozen random schedule. Support requires ten successful recoveries out of ten. Failed attempts remain in the record. ### H3: small-scale prediction A scaling model fitted only to nano and micro runs predicts the held-out loss of the next unrevealed scale within 5% relative error. - Several parameter and token-budget combinations are fitted. - The prediction and model specification are hashed before the holdout result is revealed. - Failed and preempted runs remain in sensitivity analysis. - Error above 5% does not support the hypothesis. ### H4: licensed Brazilian data allocation Under equal architecture, tokenizer, training bytes, and estimated FLOPs, a Brazilian Portuguese-weighted licensed mixture improves Brazilian Portuguese bits per UTF-8 byte by at least 5% relative to a license-matched multilingual allocation. The tokenizer is trained once on the frozen union of both candidate pools. The non-Brazilian Portuguese validation guardrail permits no more than a 3% regression. The primary comparison uses three seeds and paired bootstrap intervals over held-out items. This is a data-allocation study. It is not a comparison between native and translated mathematics. ### H5: governance overhead Provenance and integrity controls add less than 10% to preprocessing wall time and less than 2% to steady-state training wall time on the same hardware. Both configurations process identical bytes. The control disables evidence writing and integrity verification but does not change normalization, deduplication, or model input. Storage cache state and repetitions are registered before measurement. ### H6: offline operability After creating an approved artifact mirror, a clean machine with outbound network access disabled can: 1. restore the environment; 2. load the corpus snapshot; 3. train for 100 steps; 4. save and resume a checkpoint; 5. run the frozen evaluation; 6. export a Hugging Face-compatible tokenizer and model. Support requires three complete repetitions from three clean environments. Warm caches outside the approved mirror invalidate a repetition. ## Data conditions The confirmatory corpus accepts only documents whose rights permit the intended processing and release. Each document must carry source, revision, retrieval time, content hashes, rights basis, exact license where applicable, attribution, evidence, transformation history, language variant, PII status, and takedown state. Records are rejected when they have: - unknown or missing rights evidence; - noncommercial or no-derivatives restrictions; - only an aggregate-package license for underlying web text; - unresolved third-party material; - disallowed personal data; - benchmark overlap above the frozen threshold. Source additions after the corpus freeze create a new snapshot and study fingerprint. ## Sampling and splits A stable document group key prevents revisions, mirrors, or sections of the same work from crossing train and validation boundaries. Split assignment uses a registered salted hash. Exact duplicates are removed before splitting. Near-duplicate and benchmark-overlap thresholds are frozen after pilot inspection and before confirmatory training. Data-mixture experiments compare: - a Brazilian Portuguese-weighted licensed mixture; - a Portuguese-wide license-matched mixture; - a controlled multilingual license-matched mixture. Mixtures are equalized by UTF-8 bytes and estimated training FLOPs. Token counts are reported but do not define the common budget because tokenizer efficiency can differ across languages. ## Outcomes Primary language-model outcome: - bits per UTF-8 byte on a native, licensed, source-stratified pt-BR holdout. Secondary outcomes: - nats per token and perplexity by source and domain; - tokenizer bytes per token, tokens per word, round-trip failures, and unknown rate; - benchmark accuracy or task-native score; - measured tokens per second, data wait time, checkpoint duration, and MFU when available; - checkpoint recovery rate; - provenance and redistribution coverage; - offline workflow completion; - measured energy when cluster telemetry permits. Translated and native benchmark results are reported separately. ## Seeds and exclusions Registered seeds are defined in the experiment configuration. A run can be excluded from the primary analysis only for: - confirmed hardware failure; - scheduler termination unrelated to the injected-recovery study; - corrupt input whose digest differs from the registered snapshot; - implementation defects that also invalidate every run using the same code. An exclusion requires a machine-readable incident record. Divergent loss, unexpectedly weak quality, or failure to support a hypothesis is not an exclusion reason. ## Stopping rules The token budget is fixed per experiment. There is no outcome-based early stopping in confirmatory runs. A safety or integrity failure can stop a run. The run remains recorded, and resumption requires either the same study fingerprint or a declared new experiment. Target-scale training does not begin until legal admissibility, corpus lineage, benchmark isolation, tokenizer validation, nano overfit, recovery, and HPC preflight gates pass. ## Amendments An amendment records: - previous and replacement text; - reason and supporting pilot evidence; - date, author, and Git commit; - whether any affected outcome was already observed; - new protocol digest. Post-outcome changes are exploratory and cannot replace the preregistered analysis.