# 089 Source map Accessed 2026-10-02. Independent teaching orchestration/mask construction/audits; directly calls unmodified official installed model, tokenizer, loss and optimizer. No copied upstream executable code. Four Transformers files and SGD compared byte-for-byte against actual official pinned raw files; all equal, see upstream_verification.json. Model and data lock has17 exact download resources with SHA256/size. No fabricated main-line numbers. | Formula/module | Official pinned source, exact verified location | Local implementation and differences | |---|---|---| | Chat template / single-turn role boundaries | [apply_chat_template L1527](https://github.com/huggingface/transformers/blob/a22a4378d97d06b7a1d9abad6e0086d30fdea199/src/transformers/tokenization_utils_base.py#L1527), [tokenization without duplicated special tokens L1723](https://github.com/huggingface/transformers/blob/a22a4378d97d06b7a1d9abad6e0086d30fdea199/src/transformers/tokenization_utils_base.py#L1723); [actual model template](https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct/blob/12fd25f77366fa6b3b4b768ec3050bf629380bac/tokenizer_config.json) | run.py build() checks exact prefix identity, ends supervision through real assistant EOS, removes trailing template newline. Independent teaching mask, not official SmolLM training recipe or general multi-turn assistant mask. role_audit.py checks actual start/end locations | | Vocabulary projection / model loss call | [LlamaForCausalLM forward, L859–863](https://github.com/huggingface/transformers/blob/a22a4378d97d06b7a1d9abad6e0086d30fdea199/src/transformers/models/llama/modeling_llama.py#L859) | run.py calls model(inputs_embeds, attention_mask, labels); embeddings retained for gradient inspection, numerically normal token lookup | | Shifted causal CE with ignored targets | [ForCausalLMLoss L32–48](https://github.com/huggingface/transformers/blob/a22a4378d97d06b7a1d9abad6e0086d30fdea199/src/transformers/loss/loss_utils.py#L32), [mean/sum denominator L24–29](https://github.com/huggingface/transformers/blob/a22a4378d97d06b7a1d9abad6e0086d30fdea199/src/transformers/loss/loss_utils.py#L24) | run.py passes unshifted labels. Manual CE(logits[:,:-1],labels[:,1:]) / valid count is equivalent to official pad-label-and-shift formulation. No num_items_in_batch passed; denominator is valid tokens in each batch. collate() sets -100 from true length and response boundary, never by all IDs==EOS | | Greedy output | [generate L1879](https://github.com/huggingface/transformers/blob/a22a4378d97d06b7a1d9abad6e0086d30fdea199/src/transformers/generation/utils.py#L1879), [argmax branch L3259](https://github.com/huggingface/transformers/blob/a22a4378d97d06b7a1d9abad6e0086d30fdea199/src/transformers/generation/utils.py#L3259) | run.py evaluate() preserves088 contracts and greedy32, direct API use | | SGD update | [official PyTorch SGD](https://github.com/pytorch/pytorch/blob/2236df1770800ffea5697b11b0bb0d910b2e59e1/torch/optim/sgd.py) | run.py uses torch.optim.SGD, no momentum/weight decay; gradient clip1 before step. [step L104](https://github.com/pytorch/pytorch/blob/2236df1770800ffea5697b11b0bb0d910b2e59e1/torch/optim/sgd.py#L104), [single-tensor update L353](https://github.com/pytorch/pytorch/blob/2236df1770800ffea5697b11b0bb0d910b2e59e1/torch/optim/sgd.py#L353) | | Data / labels / checkpoints | [fixed SST-2 card](https://huggingface.co/datasets/stanfordnlp/sst2/resolve/8d51e7e4887a4caaa95b3fbebbf53c0490b58bbb/README.md), [model card](https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct/blob/12fd25f77366fa6b3b4b768ec3050bf629380bac/README.md) | prepare.py hashes fixed train/validation, no data bundled; model/tokenizer same12fd25f77366fa6b3b4b768ec3050bf629380bac. Labels0negative/1positive; source indices preserved | | F/C/J, truncation and paired outputs | Custom experimental protocol, not official benchmark | scoring.py from088; independent audit.py reparses outputs/source labels and rebuilds masks/counts; role_audit.py supplies deliberate bad-ID-mask counterexample on real data | Transformers repository https://github.com/huggingface/transformers, commit a22a4378d97d06b7a1d9abad6e0086d30fdea199, v4.49.0, Apache-2.0 (license verbatim retained). PyTorch repository https://github.com/pytorch/pytorch, commit2236df1770800ffea5697b11b0bb0d910b2e59e1 obtained from installed torch.version.git_version, v2.6.0, [BSD-style license](https://github.com/pytorch/pytorch/blob/2236df1770800ffea5697b11b0bb0d910b2e59e1/LICENSE). Model card Apache-2.0; dataset card license unknown. Original datasets/checkpoints not redistributed; see THIRD_PARTY.md. Self-written reused modules come from [088 fixed directory](https://github.com/distance539/ai-research-lab/tree/4ed2968d7ca40b222d419372728a888529482e43/cycle06/088-small-model-format-baseline); prepare.py/scoring.py are included unchanged, while run.py is new for SFT. This local procedure does not reproduce the official model SFT recipe or claim its reported scores.