Instructions to use BlossomsAI/petalRE-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BlossomsAI/petalRE-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="BlossomsAI/petalRE-4B")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("BlossomsAI/petalRE-4B") model = AutoModelForCausalLM.from_pretrained("BlossomsAI/petalRE-4B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use BlossomsAI/petalRE-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "BlossomsAI/petalRE-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BlossomsAI/petalRE-4B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/BlossomsAI/petalRE-4B
- SGLang
How to use BlossomsAI/petalRE-4B 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 "BlossomsAI/petalRE-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BlossomsAI/petalRE-4B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "BlossomsAI/petalRE-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BlossomsAI/petalRE-4B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use BlossomsAI/petalRE-4B with Docker Model Runner:
docker model run hf.co/BlossomsAI/petalRE-4B
petal-RE
A small, fast model that translates disassembly β C (asm β C). It does one
job β structural translation β with no reasoning trace. Function naming, type
recovery and analysis are delegated to a separate downstream model that reads
petal-RE's C output plus the asm as context.
binary ββΆ disassembler ββΆ petal-RE (asmβC, tiny+local) ββΆ clean C ββΆ reasoning model
Model
- Base:
Qwen/Qwen3.5-4B-Base, re-tokenized to a compact 24,576-token asm/C BPE vocabulary (down from 248k β frees ~25-30% of params, no human-language tokens), embeddings warm-started via Fast Vocabulary Transfer. - Training: LoRA continued-pretraining (settle transplanted embeddings) β merge β
LoRA SFT (asmβC, loss masked to the C).
embed_tokensfully trained throughout. - Corpus: BlossomsAI/PetalRE-Corpus β Decompile-Bench (clean x86-64), repo-gen (clean multi-arch), obf-exebench + Tigress (obfuscated: control-flow flattening, MBA / encode-arithmetic).
Prompt format
petal-RE uses structured tags. The model is trained to emit C between <c> and </c>:
<src=asm><arch=x86_64><opt=O2><dec=raw>
<func>
<normalized AT&T assembly>
</func>
<c>
Generate until </c>. Calls are normalized to fn/fn0/fn1... and RIP-relative
operands to REL(%rip) β symbol names are deliberately stripped, so the model
recovers structure, not identifiers (that's the downstream model's job).
Usage
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
m = AutoModelForCausalLM.from_pretrained("BlossomsAI/petalRE-4B", torch_dtype=torch.bfloat16).cuda()
t = AutoTokenizer.from_pretrained("BlossomsAI/petalRE-4B")
asm = "push %rbp\nmov %rsp,%rbp\nmov %edi,%eax\nimul %edi,%eax\nadd %edi,%eax\npop %rbp\nret"
prompt = "<src=asm><arch=x86_64><opt=O2><dec=raw>\n<func>\n" + asm + "\n</func>\n<c>\n"
out = m.generate(**t(prompt, return_tensors="pt").to("cuda"),
max_new_tokens=512, do_sample=False,
stop_strings=["</c>"], tokenizer=t)
print(t.decode(out[0], skip_special_tokens=False))
Limitations
- No identifier recovery. Input is symbol-stripped; the model produces the correct control-flow / call skeleton with placeholder names. Pair with a reasoning model that has symbol/context access for production decompilation.
- Best on x86-64 and AArch64 (priority arches); other ISAs are lower-coverage.
Apache-2.0, same as the base model.
- Downloads last month
- -
Model tree for BlossomsAI/petalRE-4B
Base model
Qwen/Qwen3.5-4B-Base