Text Generation
Transformers
Safetensors
GGUF
English
qwen2
decompilation
reverse-engineering
python
bytecode
code
verified-generation
conversational
text-generation-inference
Instructions to use BlazingCustoms/pybytecode-v3-1.5b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BlazingCustoms/pybytecode-v3-1.5b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="BlazingCustoms/pybytecode-v3-1.5b") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("BlazingCustoms/pybytecode-v3-1.5b") model = AutoModelForCausalLM.from_pretrained("BlazingCustoms/pybytecode-v3-1.5b", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use BlazingCustoms/pybytecode-v3-1.5b with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf BlazingCustoms/pybytecode-v3-1.5b:F16 # Run inference directly in the terminal: llama cli -hf BlazingCustoms/pybytecode-v3-1.5b:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf BlazingCustoms/pybytecode-v3-1.5b:F16 # Run inference directly in the terminal: llama cli -hf BlazingCustoms/pybytecode-v3-1.5b:F16
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf BlazingCustoms/pybytecode-v3-1.5b:F16 # Run inference directly in the terminal: ./llama-cli -hf BlazingCustoms/pybytecode-v3-1.5b:F16
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf BlazingCustoms/pybytecode-v3-1.5b:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf BlazingCustoms/pybytecode-v3-1.5b:F16
Use Docker
docker model run hf.co/BlazingCustoms/pybytecode-v3-1.5b:F16
- LM Studio
- Jan
- vLLM
How to use BlazingCustoms/pybytecode-v3-1.5b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "BlazingCustoms/pybytecode-v3-1.5b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BlazingCustoms/pybytecode-v3-1.5b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/BlazingCustoms/pybytecode-v3-1.5b:F16
- SGLang
How to use BlazingCustoms/pybytecode-v3-1.5b with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "BlazingCustoms/pybytecode-v3-1.5b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BlazingCustoms/pybytecode-v3-1.5b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "BlazingCustoms/pybytecode-v3-1.5b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BlazingCustoms/pybytecode-v3-1.5b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use BlazingCustoms/pybytecode-v3-1.5b with Ollama:
ollama run hf.co/BlazingCustoms/pybytecode-v3-1.5b:F16
- Unsloth Studio
How to use BlazingCustoms/pybytecode-v3-1.5b with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for BlazingCustoms/pybytecode-v3-1.5b to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for BlazingCustoms/pybytecode-v3-1.5b to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for BlazingCustoms/pybytecode-v3-1.5b to start chatting
- Pi
How to use BlazingCustoms/pybytecode-v3-1.5b with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf BlazingCustoms/pybytecode-v3-1.5b:F16
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "BlazingCustoms/pybytecode-v3-1.5b:F16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- OpenClaw new
How to use BlazingCustoms/pybytecode-v3-1.5b with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf BlazingCustoms/pybytecode-v3-1.5b:F16
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "BlazingCustoms/pybytecode-v3-1.5b:F16" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- Docker Model Runner
How to use BlazingCustoms/pybytecode-v3-1.5b with Docker Model Runner:
docker model run hf.co/BlazingCustoms/pybytecode-v3-1.5b:F16
- Lemonade
How to use BlazingCustoms/pybytecode-v3-1.5b with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull BlazingCustoms/pybytecode-v3-1.5b:F16
Run and chat with the model
lemonade run user.pybytecode-v3-1.5b-F16
List all available models
lemonade list
- Hermes Agent
How to use BlazingCustoms/pybytecode-v3-1.5b with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf BlazingCustoms/pybytecode-v3-1.5b:F16
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default BlazingCustoms/pybytecode-v3-1.5b:F16
Run Hermes
hermes
- Atomic Chat
File size: 9,771 Bytes
ff9936a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | #!/usr/bin/env python3
"""SELF-VERIFICATION — the check that lets the tool KNOW when it is right.
This is the measurement instrument behind the Phase-3 design proposal. It is NOT the product
(no CLI, no service, no retry loop is built here) -- it exists so the projected lift of a
best-of-k + verify loop can be grounded in a measured number instead of a guess.
THE KEY IDEA, and it is stronger than differential execution:
RECOMPILE THE PREDICTION AND COMPARE THE BYTECODE TO THE ORIGINAL.
If `compile(predicted_source)` yields the same code object as the bytecode we were asked to
decompile, the prediction is CORRECT BY CONSTRUCTION -- it is a genuine inverse, not merely a
plausible one. This matters enormously for the product:
* COVERAGE IS 100%. It needs no runnable environment, no fuzzing, no stubs, no imports. It works
on framework-coupled code, on decorated code, on the 91% of real Python that neither the real
nor the stubbed differential oracle can touch. The 5.43%/9% execution ceiling does not apply.
* A POSITIVE IS A PROOF. Not evidence -- a proof. Identical code object => identical behaviour.
* IT IS CHEAP AND DETERMINISTIC. One compile. Microseconds. No LLM judge, ever.
Its limit, stated honestly: it is STRICTER than semantic equivalence. A decompilation that is
correct but compiles differently (a `while` where the original had a `for`, a differently-ordered
but equivalent boolean) does NOT verify. So:
verified = PROVABLY correct (sound; no false "verified")
unverified = UNKNOWN, not wrong (incomplete; false "unverified" is common)
That asymmetry is exactly the right one for a tool: it never lies about being right, and it is
honest about not knowing. Differential execution is then the SECOND-tier verifier that rescues the
semantically-equivalent-but-not-byte-identical cases where the code happens to be runnable.
NORMALISATION: we compare `disassemble_v2` of both code objects rather than the raw marshalled
bytes, because the latter embeds line numbers, filenames and a few interning artefacts that differ
without any semantic content.
"""
from __future__ import annotations
import argparse, json, re, sys, types
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent))
from rep import disassemble_v2 # noqa: E402
def strip_fences(text: str) -> str:
m = re.search(r"```(?:python|py)?\s*\n(.*?)(?:```|\Z)", text, re.S)
return (m.group(1) if m else text).strip()
def normalised_asm(src: str) -> str | None:
"""The offset-free, line-number-free disassembly of `src`. None if it does not compile."""
try:
return disassemble_v2(compile(src, "<v>", "exec"))
except (SyntaxError, ValueError, RecursionError, MemoryError, TypeError):
return None
UNORDERED_CONST = (set, frozenset)
def canon_const(c, depth: int = 0) -> str:
"""A CANONICAL, order-independent encoding of one non-code constant.
This replaced a bare `repr(c)` on 2026-08-04, because `repr()` of a set/frozenset/dict follows
the COMPILING PROCESS'S string hash seed, not anything about the program. That made the oracle
NON-DETERMINISTIC on any input carrying such a constant: certifying the same 600 wild .pyc under
PYTHONHASHSEED 0/1/2/3/4 gave 585/592/584/585/589 -- five different answers to one question.
It was also the single largest cause of false rejection when verifying against a FOREIGN .pyc
(13 of 15 failures on that corpus; in every case a set of EQUAL VALUES in a different order).
Type tags are mandatory rather than cosmetic: without them `1`, `1.0` and `True` would collapse
into one encoding, and those are behaviourally distinct. `repr()` is retained for scalars
precisely because it already separates them, and keeps `-0.0` apart from `0.0`.
LOSSLESS, and tested rather than asserted (see GATE-RESULT.md):
mutation kill stayed 100% with 0 true survivors, false accepts stayed 0 across 2,190 effective
mutants, all 18 blind-spot probes still behaved as required, and the published greedy scores were
bit-identical before and after (335/400 CSN, 254/279 OOD).
"""
if depth > 20:
return "DEPTH"
t = type(c).__name__
if isinstance(c, UNORDERED_CONST):
return f"{t}({','.join(sorted(canon_const(x, depth + 1) for x in c))})"
if isinstance(c, dict):
items = sorted(f"{canon_const(k, depth + 1)}:{canon_const(v, depth + 1)}"
for k, v in c.items())
return f"dict({','.join(items)})"
if isinstance(c, tuple):
return f"tuple({','.join(canon_const(x, depth + 1) for x in c)})"
if isinstance(c, list):
return f"list({','.join(canon_const(x, depth + 1) for x in c)})"
return f"{t}:{c!r}"
def code_fingerprint(co) -> tuple:
"""A STRUCTURAL fingerprint of the real code object — recursively, including the EXCEPTION TABLE.
The verifier must NOT compare my textual disassembly. It did, and that made it UNSOUND: the
v2.0 rep omitted the exception table's `end`, so a `try: A; B; C` and a `try: A ... else: B; C`
rendered identically, and a behaviourally WRONG prediction was stamped VERIFIED (a false proof,
caught at n=279). A proof of correctness must rest on the code object itself, not on my
rendering of it -- otherwise every bug in the rendering silently becomes a bug in the proof.
Constants are encoded by canon_const(), NOT by repr() -- see that function for why.
"""
kids = tuple(code_fingerprint(c) for c in co.co_consts if isinstance(c, types.CodeType))
consts = tuple(canon_const(c) for c in co.co_consts if not isinstance(c, types.CodeType))
return (
co.co_code, # the instruction bytes
co.co_exceptiontable, # <- the field whose omission caused the false proof
consts, co.co_names, co.co_varnames, co.co_freevars, co.co_cellvars,
co.co_argcount, co.co_posonlyargcount, co.co_kwonlyargcount, co.co_flags,
kids,
)
def compiles_to(src: str):
try:
return compile(src, "<v>", "exec")
except (SyntaxError, ValueError, RecursionError, MemoryError, TypeError):
return None
def verify(prediction: str, reference_src: str) -> tuple[bool, str]:
"""Does the prediction RECOMPILE to the SAME CODE OBJECT as the original?
At inference the reference is the .pyc itself (we hold the real code object). Here, in
measurement, we reconstruct it by compiling the reference source -- which yields exactly the
code object the model was asked to invert.
Compared STRUCTURALLY on the code object (instructions + EXCEPTION TABLE + consts + names +
flags, recursively), never on my textual disassembly. See code_fingerprint().
"""
src = strip_fences(prediction)
if not src.strip():
return False, "empty prediction"
got = compiles_to(src)
if got is None:
return False, "prediction does not compile"
want = compiles_to(reference_src)
if want is None:
return False, "REFERENCE does not compile — cannot verify"
if code_fingerprint(got) == code_fingerprint(want):
return True, "VERIFIED: recompiles to an identical code object (proof of correctness)"
return False, "compiles, but to a different code object (unverified — may still be correct)"
def main() -> None:
ap = argparse.ArgumentParser()
ap.add_argument("--results", required=True, help="the --out json from grade_outputs.py")
ap.add_argument("--out", required=True, help="PERSIST the verification report here")
ap.add_argument("--label", default="")
a = ap.parse_args()
samples = json.loads(Path(a.results).read_text())["samples"]
n = len(samples)
vflag = [verify(s["got"], s["expected"])[0] for s in samples]
verified = sum(vflag)
behav = sum(1 for s in samples if s["verdict"]["pass"])
# the interesting cell: verified is a PROOF, so it must never exceed behavioural truth
verified_and_behav = sum(1 for s, v in zip(samples, vflag) if v and s["verdict"]["pass"])
verified_but_failed = verified - verified_and_behav
# a false proof is the one result that would sink the whole thesis, so name the offenders
false_proofs = [{"i": s.get("i"), "note": s["verdict"].get("note", "")[:160],
"expected": s["expected"][:400], "got": s["got"][:400]}
for s, v in zip(samples, vflag) if v and not s["verdict"]["pass"]]
rep = {
"label": a.label,
"results_file": a.results,
"n": n,
"behaviourally_correct": behav,
"behaviourally_correct_pct": round(100 * behav / max(1, n), 1),
"VERIFIED_by_recompile": verified,
"VERIFIED_by_recompile_pct": round(100 * verified / max(1, n), 1),
"verified_AND_behaviourally_correct": verified_and_behav,
"VERIFIED_BUT_BEHAVIOURALLY_WRONG": verified_but_failed,
"soundness_note": ("a recompile-verified prediction that FAILS differential execution would "
"mean the verifier is unsound. Expect exactly 0. Any non-zero is a bug."),
"false_proof_cases": false_proofs,
"unverified_but_correct": behav - verified_and_behav,
"incompleteness_note": ("these are correct decompilations the recompile check cannot PROVE "
"(equivalent source, different bytecode). Differential execution is "
"the second-tier verifier that rescues them where code is runnable."),
}
print(json.dumps({k: v for k, v in rep.items() if k != "false_proof_cases"}, indent=2))
Path(a.out).write_text(json.dumps(rep, indent=2))
print(f"artifact -> {a.out}", file=sys.stderr)
if __name__ == "__main__":
main()
|