How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-generation", model="Ambition0303/Qwen-HTML")
messages = [
    {"role": "user", "content": "Who are you?"},
]
pipe(messages)
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("Ambition0303/Qwen-HTML")
model = AutoModelForCausalLM.from_pretrained("Ambition0303/Qwen-HTML", 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=256)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
Quick Links

Qwen-HTML 4B

Qwen-HTML is a lightweight HTML-specialized model for Co-Scraper, a query-aware web data extraction framework. It is initialized from Qwen/Qwen3-4B and trained for two complementary tasks:

  1. Node identification: select the DOM nodes most likely to contain query-relevant records and attributes.
  2. Scraper synthesis: generate reusable Python extraction code over the pruned HTML.

The model is designed to reduce the cost and failure rate of web information extraction by working with compact, query-aware DOM views instead of full raw pages.

Model description

  • Base model: Qwen3-4B
  • Architecture: Qwen3ForCausalLM
  • Precision: bfloat16
  • Context length: 131,072 tokens

Intended use

Deploy the model with vLLM as an OpenAI-compatible service:

pip install vllm

vllm serve Ambition0303/Qwen-HTML \
  --served-model-name qwen-html \
  --dtype bfloat16 \
  --tensor-parallel-size 1 \
  --max-model-len 131072 \
  --port 8000

Then use the endpoint with the Co-Scraper inference pipeline:

export OPENAI_BASE_URL="http://localhost:8000/v1"
export OPENAI_API_KEY="not-required"

coscraper \
  "Extract the camera model and price." \
  schema.json \
  seed_1.html seed_2.html seed_3.html \
  --model qwen-html

Set --tensor-parallel-size to the number of GPUs used for tensor parallelism. If GPU memory is insufficient for the full 131,072-token context, reduce --max-model-len according to your deployment budget.

Evaluation

Results from the Co-Scraper paper. Higher is better except Unex.f.

Dataset Precision Recall F1 Corp Corf Unex.f
SWDE 95.93 96.24 96.00 85.87 95.51 3.19
LiveWeb-IE 92.29 92.68 92.40 82.00 91.28 6.08

Metric definitions:

  • F1 : field-level extraction quality.
  • Corp : page-level perfect extraction rate.
  • Corf : field-level cross-page reuse success rate.
  • Unex.f : fraction of fields with unexecutable or invalid output.

Limitations

Generated scrapers should still be reviewed before being executed on untrusted pages. Model performance can vary with HTML quality, site structure, and query clarity.

Citation

If you use this model, please cite the Co-Scraper work:

@misc{coscraper2026,
  title={Co-Scraper: Query-Aware DOM Pruning and Reusable Scraper Synthesis for Lightweight Web Data Extraction},
  author={Wang, Shoupeng and Qiu, Jiantao and Zhang, Wuyang and He, Conghui},
  year={2026},
  url={https://arxiv.org/abs/2606.14821}
Downloads last month
-
Safetensors
Model size
196k params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Ambition0303/Qwen-HTML

Finetuned
Qwen/Qwen3-4B
Finetuned
(1190)
this model

Paper for Ambition0303/Qwen-HTML