193 lines
7.0 KiB
Markdown
193 lines
7.0 KiB
Markdown
---
|
|
language:
|
|
- pt
|
|
library_name: transformers
|
|
pipeline_tag: text-generation
|
|
base_model: Qwen/Qwen3-0.6B
|
|
license: apache-2.0
|
|
tags:
|
|
- open-information-extraction
|
|
- openie
|
|
- portuguese
|
|
- abstractive-openie
|
|
- qwen3
|
|
---
|
|
|
|
# Qwen3OIE-0.6B
|
|
|
|
Qwen3OIE-0.6B is a Portuguese **abstractive Open Information Extraction (OpenIE)**
|
|
model fine-tuned from [Qwen/Qwen3-0.6B](https://huggingface.co/Qwen/Qwen3-0.6B).
|
|
Given one sentence, it generates one or more binary extractions with the fields
|
|
`ARG0`, `V`, and `ARG1` in JSON.
|
|
|
|
This is the smallest published Qwen3OIE checkpoint and the recommended first model
|
|
for local experiments. It may normalize or infer wording instead of copying every
|
|
span literally from the source; applications that require strict provenance should
|
|
validate every generated field against the input or use an extractive model.
|
|
|
|
## Model details
|
|
|
|
| Field | Value |
|
|
|---|---|
|
|
| Public repository | [`bratao/Qwen3OIE-0.6B`](https://huggingface.co/bratao/Qwen3OIE-0.6B) |
|
|
| Base model | [`Qwen/Qwen3-0.6B`](https://huggingface.co/Qwen/Qwen3-0.6B) |
|
|
| Architecture | decoder-only causal language model |
|
|
| Task | Portuguese abstractive OpenIE |
|
|
| Parameters | 596,049,920 |
|
|
| Published weight precision | bfloat16 |
|
|
| Approximate repository size | 1.21 GB |
|
|
| Audited revision | `140ed13943b107f281600ddc2d3caa37f4a4d062` (2026-08-30) |
|
|
|
|
The thesis reports this model as “Qwen 0.5B”, following the label used during the
|
|
experiments. The public upstream checkpoint and this repository are named 0.6B; the
|
|
parameter count above comes from the published configuration.
|
|
|
|
## Use with `portuguese-openie`
|
|
|
|
```bash
|
|
pip install "portuguese-openie[transformers]"
|
|
```
|
|
|
|
```python
|
|
from portuguese_openie import Model, PortugueseOpenIE
|
|
|
|
extractor = PortugueseOpenIE(Model.QWEN3_OIE_0_6B)
|
|
triples = extractor.extract("A UFBA está localizada em Salvador.")
|
|
print([triple.to_dict() for triple in triples])
|
|
```
|
|
|
|
No model path is required. On first use, the library downloads the public model
|
|
files from Hugging Face and stores them in the standard local Hugging Face cache;
|
|
later runs reuse that cache.
|
|
|
|
Validated output at the audited revision:
|
|
|
|
```python
|
|
[{"ARG0": "A UFBA", "V": "está localizada em", "ARG1": "Salvador"}]
|
|
```
|
|
|
|
The end-to-end validation used Python 3.12.9, PyTorch 2.13, Transformers 4.57.6,
|
|
and Accelerate 1.14 on CPU. Model loading took about 8.5 seconds, generation plus
|
|
parsing about 4.1 seconds, and peak process RSS was about 1.58 GB. These are a
|
|
single-machine smoke test, not a benchmark.
|
|
|
|
## Direct Transformers use
|
|
|
|
```python
|
|
import torch
|
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
|
model_id = "bratao/Qwen3OIE-0.6B"
|
|
revision = "140ed13943b107f281600ddc2d3caa37f4a4d062"
|
|
tokenizer = AutoTokenizer.from_pretrained(model_id, revision=revision)
|
|
model = AutoModelForCausalLM.from_pretrained(
|
|
model_id,
|
|
revision=revision,
|
|
dtype="auto",
|
|
device_map="auto",
|
|
)
|
|
|
|
sentence = "A UFBA está localizada em Salvador."
|
|
messages = [
|
|
{
|
|
"role": "system",
|
|
"content": (
|
|
"Dada uma frase S você consegue fazer extrações em JSON no formato "
|
|
"ARG0 , V, ARG1. Realize a extração para a frase abaixo:"
|
|
),
|
|
},
|
|
{"role": "user", "content": f"S: {sentence}"},
|
|
]
|
|
prompt = tokenizer.apply_chat_template(
|
|
messages,
|
|
tokenize=False,
|
|
add_generation_prompt=True,
|
|
enable_thinking=False,
|
|
)
|
|
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
|
with torch.inference_mode():
|
|
output = model.generate(
|
|
**inputs,
|
|
max_new_tokens=512,
|
|
do_sample=False,
|
|
pad_token_id=tokenizer.eos_token_id,
|
|
)
|
|
generated = output[0, inputs["input_ids"].shape[-1]:]
|
|
print(tokenizer.decode(generated, skip_special_tokens=True))
|
|
```
|
|
|
|
Keep the system prompt, `S:` prefix, chat template, and `enable_thinking=False`.
|
|
The fine-tuning configuration used a sequence length of 2,048 tokens. Longer task
|
|
contexts, even if accepted by the base architecture, were not evaluated here.
|
|
|
|
## Evaluation
|
|
|
|
The thesis evaluates the public model family on 100 Portuguese test sentences with
|
|
238 reference extractions from WikiPUD-Portuguese-Abstractive. The reference set was
|
|
generated with an LLM from OIEC-PT Gold source sentences and manually spot-checked;
|
|
it is therefore described as **silver-standard**, not fully human-authored gold data.
|
|
|
|
| Criterion | Precision | Recall | F1 |
|
|
|---|---:|---:|---:|
|
|
| Perfect match | 0.1136 | 0.1723 | 0.1369 |
|
|
| Lexical match | 0.2493 | 0.3782 | 0.3005 |
|
|
|
|
Perfect match requires an exact triple match. Lexical match gives partial credit for
|
|
token overlap. Precision and recall come from the associated local evaluation
|
|
summary; the F1 values are also reported in the thesis. These are research results
|
|
on one small dataset, not general Portuguese language guarantees.
|
|
|
|
## Training-data provenance
|
|
|
|
The abstractive OpenIE training corpus described in the thesis contains 29,026
|
|
Portuguese sentences and 102,788 synthetic extractions derived from 2,015 Portuguese
|
|
Wikipedia paragraphs with Gemini 2.5 Flash. The public model repository does not
|
|
declare a Hugging Face dataset identifier and does not include that training corpus;
|
|
accordingly, this card deliberately omits a `datasets` field.
|
|
|
|
## Requirements and hardware
|
|
|
|
- Python 3.10+ with recent `torch`, `transformers`, and `accelerate`.
|
|
- The bfloat16 weights occupy about 1.2 GB. Around 4 GB of system RAM is a practical
|
|
starting point for CPU inference; GPU execution is optional.
|
|
- Actual memory and latency depend on sequence length, software versions, and device.
|
|
|
|
## Limitations and responsible use
|
|
|
|
- Generative OpenIE can omit relations, duplicate extractions, hallucinate content,
|
|
or emit malformed JSON. Always parse defensively and retain the source sentence.
|
|
- The model was evaluated on only 100 mostly encyclopedic Portuguese sentences.
|
|
- It may perform poorly on dialectal, conversational, specialized, very long, or
|
|
adversarial text and has not been audited for demographic bias.
|
|
- An extraction is not a verified fact. Do not use it as the sole basis for medical,
|
|
legal, financial, or other high-impact decisions.
|
|
|
|
## License
|
|
|
|
This repository declares the Apache License 2.0. Use also remains subject to the
|
|
terms of the upstream Qwen model and to any applicable rights in input or training
|
|
data. The training dataset itself is not distributed by this model card.
|
|
|
|
## Citation
|
|
|
|
```bibtex
|
|
@phdthesis{cabral2025evolving,
|
|
author = {Cabral, Bruno Souza},
|
|
title = {Evolving Open Information Extraction for Portuguese employing Language Models},
|
|
school = {Universidade Federal da Bahia},
|
|
year = {2025}
|
|
}
|
|
|
|
@inproceedings{cabral2022portnoie,
|
|
author = {Cabral, Bruno and Souza, Marlo and Claro, Daniela Barreiro},
|
|
title = {PortNOIE: A Neural Framework for Open Information Extraction for the Portuguese Language},
|
|
booktitle = {Computational Processing of the Portuguese Language (PROPOR 2022)},
|
|
year = {2022},
|
|
doi = {10.1007/978-3-030-98305-5_23}
|
|
}
|
|
```
|
|
|
|
Project: [Portuguese-OpenIE](https://github.com/FORMAS/Portuguese-OpenIE) ·
|
|
[PortNOIE paper](https://doi.org/10.1007/978-3-030-98305-5_23) ·
|
|
[Generative OpenIE paper](https://aclanthology.org/2024.propor-1.13/)
|