Energraft-EBT-Qwen3-1.7B-Base
Energraft-EBT-Qwen3-1.7B-Base is an energy-based language model adapted from Qwen3-1.7B-Base. It generates text through energy-gradient refinement of a random next-token candidate. This release uses two updates per token by default and also supports one-update decoding.
Model Overview
- Base model: Qwen/Qwen3-1.7B-Base
- Model type: Energy-based language model
- Backbone: 1.7B parameters, 28 Transformer layers
- Energy head: 2048 → 256 → 1 residual MLP
- Generation: Two energy-gradient updates per token by default
- Candidate initialization: Gaussian logits, σ=1
- Refinement: Unit first update; second-update residual relaxation β=0.05
- Release: v0.3
Quickstart
pip install "torch==2.8.0" "transformers==4.57.1" "huggingface_hub>=0.34,<1.0" "safetensors>=0.6.2"
hf download dimweak/Energraft-EBT-Qwen3-1.7B-Base --revision v0.3 --local-dir Energraft-EBT-Qwen3-1.7B-Base
cd Energraft-EBT-Qwen3-1.7B-Base
python generate.py --prompt "The capital of France is" --max-new-tokens 64 --seed 1234
Python
From the downloaded model directory:
from energraft import EnergraftEBT
model = EnergraftEBT.from_pretrained(".", device="cuda")
text = model.generate("The capital of France is", max_new_tokens=64, seed=1234)
print(text)
# Optional: use one energy update per token.
text = model.generate("The capital of France is", max_new_tokens=64,
seed=1234, inference_steps=1)
The CLI accepts --steps 1 for the same one-update option.
The release includes FP32 backbone weights, the energy head, the tokenizer, and the inference code.
Training
The model was adapted over 176Mi supervised prediction positions, covering English, Chinese, code, and mathematics. Training combines corpus text with teacher- and student-generated prefixes, using full-vocabulary distribution distillation. The final adaptation stage trains intermediate-candidate corrections with first-update distillation and native-AR distribution regularization. The Transformer backbone and energy head are jointly optimized, while the tied token embeddings remain frozen.
Evaluation
Results use the task definitions and scoring from lm-evaluation-harness v0.4.9.2, with an EBT inference adapter.
| Benchmark | Shots | Metric | 1 update | 2 updates (default) |
|---|---|---|---|---|
| PIQA | 0 | Accuracy / normalized accuracy | 70.24 / 72.20 | 70.40 / 71.93 |
| ARC-Easy | 0 | Normalized accuracy | 65.45 | 64.73 |
| ARC-Challenge | 0 | Normalized accuracy | 39.42 | 39.16 |
| HellaSwag | 0 | Normalized accuracy | 59.40 | 59.59 |
| WinoGrande | 0 | Accuracy | 62.75 | 63.54 |
| C-Eval | 5 | Accuracy | 64.19 | 64.04 |
| GSM8K | 5 | Exact match, strict | 61.49 | 58.07 |
| GSM8K | 5 | Exact match, flexible extraction | 68.23 | 68.99 |
Scores are percentages. Evaluation covers 19,360 examples, including all 52 C-Eval validation subjects and the complete GSM8K test split. GSM8K uses greedy decoding with a maximum of 512 generated tokens. Both columns evaluate the same 176Mi checkpoint with FP32 inference, Gaussian candidate initialization with σ=1, and seed 1234. Two-update decoding uses second-update relaxation β=0.05.
Acknowledgements
Built on Qwen3, with inspiration from Energy-Based Transformers.