Llama-3.1-8B-Instruct-CIRF-Full
Built with Llama. A CIRF reasoning model fine-tuned from Llama 3.1 8B Instruct, trained with full explicit result supervision: every intermediate result is written out in the training targets.
The LoRA update is merged into the dense BF16 weights and the 514 new tokens ([sof], [eof], [f_0] to [f_511])
are included with their trained embedding and output rows, so the model loads with plain Transformers (no PEFT, base checkpoint or CIRF code needed).
Prompt format
<|begin_of_text|>QUESTION[sof]
No chat template. The model writes a trace of functional tokens with optional result values, then [eof] and the final answer, and stops at the tokenizer's EOS token. Stop on EOS, not on [eof], and decode with skip_special_tokens=False to keep the boundaries.
Inference
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo_id = "JhCIFT/Llama-3.1-8B-Instruct-CIRF-Full"
tokenizer = AutoTokenizer.from_pretrained(repo_id)
model = AutoModelForCausalLM.from_pretrained(repo_id, dtype=torch.bfloat16, device_map="auto").eval()
prompt = tokenizer.bos_token + "What is 2 + 2?[sof]"
inputs = tokenizer(prompt, add_special_tokens=False, return_tensors="pt").to(model.device)
with torch.inference_mode():
output = model.generate(**inputs, max_new_tokens=384, do_sample=False,
eos_token_id=tokenizer.eos_token_id, pad_token_id=tokenizer.pad_token_id)
ids = output[0, inputs.input_ids.shape[1]:].tolist()
if tokenizer.eos_token_id in ids:
ids = ids[:ids.index(tokenizer.eos_token_id)]
trace = tokenizer.decode(ids, skip_special_tokens=False)
print(trace)
print(trace.split("[eof]", 1)[1].strip() if "[eof]" in trace else None)
The evaluation below additionally limits each trace to 32 functional tokens (forcing [eof] when the limit is reached). The included inference.py reproduces that protocol and needs only Torch and Transformers:
python inference.py --model JhCIFT/Llama-3.1-8B-Instruct-CIRF-Full --question "What is 2 + 2?"
Test accuracy
| Test set | Questions | Accuracy |
|---|---|---|
| GSM8K | 1,319 | 58.07% |
| MultiArith | 178 | 98.88% |
| SVAMP | 300 | 79.00% |
| CommonsenseQA | 1,221 | 79.69% |
| Coin Flip (parity-corrected) | 3,333 | 83.74% |
Greedy decoding, at most 384 new tokens and 32 functional tokens, exact-match answer scoring. Coin Flip is scored against the parity of the flips stated in the question, because about 20% of the dataset's labels disagree with it. The full per-dataset results, including MATH-500, StrategyQA and batch-1 latency, are in test_results.json; training_config.json, provenance.json and export_verification.json record the training settings, source checkpoint hashes and export checks.
Related models
- Llama-3.1-8B-Instruct-CIRF-Full (this model)
- Llama-3.1-8B-Instruct-CIRF-Zero-Results
- Llama-3.1-8B-Instruct-CIRF-Backward-Greedy-3
- Llama-3.1-8B-Instruct-CIRF-Backward-Greedy-6
- Llama-3.1-8B-Instruct-CIRF-Backward-Greedy-12
- Llama-3.1-8B-Instruct-CIRF-Backward-Greedy-18
- Llama-3.1-8B-Instruct-CIRF-Backward-Greedy-24
Revision
Updated on 2026-11-08 with the final selection of the evaluation, made after all 91 candidate designs had been tested. The weights first published on 2026-11-02 (design c_llama_6ca69c405aa5, seed 2, selected when 56 of 91 designs had been tested) remain available at revision f135f05.
License
The base model is Meta Llama 3.1 8B Instruct, licensed under the Llama 3.1 Community License (see LICENSE and USE_POLICY.md). Llama 3.1 is licensed under the Llama 3.1 Community License, Copyright © Meta Platforms, Inc. All Rights Reserved. This derivative adds the CIRF functional-token vocabulary, learned embedding and output rows, supervised adaptation, and the merged LoRA update.