Views
No views yet
[!WARNING] Superseded bypiyushptiwari/ebrm-v4-qwen3-4b(2026-05). v4 was trained on top of v2 with hard-negative mining and beats v2/v3 by +2.8 pp on BBH best-of-6. Neither v2 nor v4 beats self-consistency majority voting at k=6 — see the v4 model card for an honest benchmark table. v2 is retained for reproducibility of earlier results.
Qwen/Qwen3-4B for self-consistency reasoning.
Used together with the ebrm-system pipeline (intent routing → Langevin candidate generation → SymPy/Lean/exec verifiers → voting).| File | Purpose |
|---|---|
ebrm_state.pt | Full training checkpoint (pooler, projector, energy_head, answer_decoder, optimizer, EMA) |
ebrm_inference.pt | Inference-only state (heads + EMA, no optimizer) — load this for inference |
training_log.json | Per-step training metrics |
ebrm_state.pt includes the optimizer state (≈ half the file size) and is intended for resuming training.
For inference, use ebrm_inference.pt.Qwen/Qwen3-4B backbone:Qwen3-4B hidden states ──► pooler (mean over tokens)
│
▼
projector (MLP → latent z)
│
┌───────────────┴───────────────┐
▼ ▼
energy_head (z → E) answer_decoder (z → tokens)energy_head is the scoring function used by the EBRM voter; answer_decoder reconstructs an answer from the latent for self-consistency.pip install ebrm-system transformers torch huggingface_hub1import torch
2from huggingface_hub import hf_hub_download
3from transformers import AutoModelForCausalLM, AutoTokenizer
4
5# 1. Download the inference checkpoint
6ckpt_path = hf_hub_download("piyushptiwari/ebrm-v2-qwen3-4b", "ebrm_inference.pt")
7ckpt = torch.load(ckpt_path, map_location="cpu", weights_only=False)
8
9# 2. Load the base LM (frozen during EBRM training)
10tok = AutoTokenizer.from_pretrained("Qwen/Qwen3-4B")
11lm = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-4B", dtype=torch.float16, device_map="auto")
12
13# 3. Use the ebrm-system pipeline
14from ebrm_system.intent import Intent
15from ebrm_system.verifiers.routing import chain_for_intent
16
17chain = chain_for_intent(Intent.MATH_REASONING)
18# ... generate candidates with `lm`, score with energy_head, verify with chain, vote.scripts/demo_e2e.py
in the ebrm-system repository.ebrm-system also supports CPU inference for small batches.Qwen/Qwen3-4B (Apache-2.0).1@software{ebrm_system_2026,
2 author = {Tiwari, Piyush},
3 title = {ebrm-system: Energy-Based Reasoning Machine pipeline},
4 year = {2026},
5 url = {https://github.com/piyushptiwari1/ebrm-system}
6}