CoolFace
Modelpublic

Loria-MosAIk/xqdt-e2e-qwen3-1.7b

sourceHugging Faceupdated 23d agoView on Hugging Face
0likes25downloads
Model Card

XQDT E2E verifier: qwen3 1.7B

This repository contains the LoRA adapter for the qwen3 1.7B XQDT verifier from XQDT: eXplainable and Quantitative Data-Text Alignment Metric with Feedback Signals. It is used with `Qwen/Qwen3-1.7B`.

This E2E checkpoint was trained on the joint WebNLG--E2E synthetic training set.

Overview

XQDT verifies alignment between English text and structured triples. It returns missing, extra, and incorrect units, or All correct. missing identifies an input unit omitted from the text, extra identifies text content unsupported by the input, and incorrect identifies an input unit realised with incorrect information.

Example inputs and outputs are provided in smoke_test.json. Generated text may vary slightly across inference libraries and package versions.

Prompt format

text
Verify if the triples align with the text. Find missing, extra, or incorrect triples.
TEXT: {text}
TRIPLES:
1. [S] {subject} [P] {predicate} [O] {object}
Output as markdown table with Type and Triple columns.

ms-swift

python
import os
os.environ.setdefault("USE_HF", "1")
import torch
from swift.infer_engine import InferRequest, RequestConfig, TransformersEngine

BASE_MODEL = "Qwen/Qwen3-1.7B"
ADAPTER_ID = "Loria-MosAIk/xqdt-e2e-qwen3-1.7b"
SYSTEM_PROMPT = "Identify extra, missing and incorrect triples precisely."
QUERY = """Verify if the triples align with the text. Find missing, extra, or incorrect triples.
TEXT: Blue Spice is a coffee shop in city centre.
TRIPLES:
1. [S] Blue Spice [P] area [O] city centre
2. [S] Blue Spice [P] eat type [O] coffee shop
Output as markdown table with Type and Triple columns."""
MESSAGES = [{"role": "system", "content": SYSTEM_PROMPT}, {"role": "user", "content": QUERY}]

engine = TransformersEngine(
    BASE_MODEL,
    adapters=[ADAPTER_ID],
    max_batch_size=1,
    torch_dtype=torch.bfloat16,
    device_map="auto",
    template_type="qwen3",
    use_hf=True,
)
response = engine.infer(
    [InferRequest(messages=MESSAGES)],
    RequestConfig(max_tokens=1024, temperature=0.3, seed=2023),
    use_tqdm=False,
)[0]
print(response.choices[0].message.content)

Transformers and PEFT

python
import torch
from peft import PeftModel
from transformers import set_seed

BASE_MODEL = "Qwen/Qwen3-1.7B"
ADAPTER_ID = "Loria-MosAIk/xqdt-e2e-qwen3-1.7b"
SYSTEM_PROMPT = "Identify extra, missing and incorrect triples precisely."
QUERY = """Verify if the triples align with the text. Find missing, extra, or incorrect triples.
TEXT: Blue Spice is a coffee shop in city centre.
TRIPLES:
1. [S] Blue Spice [P] area [O] city centre
2. [S] Blue Spice [P] eat type [O] coffee shop
Output as markdown table with Type and Triple columns."""
MESSAGES = [{"role": "system", "content": SYSTEM_PROMPT}, {"role": "user", "content": QUERY}]
set_seed(2023)

from transformers import AutoModelForCausalLM, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL)
base = AutoModelForCausalLM.from_pretrained(
    BASE_MODEL, torch_dtype=torch.bfloat16, device_map="auto"
)
model = PeftModel.from_pretrained(base, ADAPTER_ID).eval()
prompt = tokenizer.apply_chat_template(MESSAGES, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.inference_mode():
    output = model.generate(**inputs, max_new_tokens=1024, do_sample=True, temperature=0.3)
generated = output[0, inputs["input_ids"].shape[-1]:]
print(tokenizer.decode(generated, skip_special_tokens=True))

vLLM

python
from huggingface_hub import snapshot_download
from vllm import LLM, SamplingParams
from vllm.lora.request import LoRARequest

BASE_MODEL = "Qwen/Qwen3-1.7B"
ADAPTER_ID = "Loria-MosAIk/xqdt-e2e-qwen3-1.7b"
SYSTEM_PROMPT = "Identify extra, missing and incorrect triples precisely."
QUERY = """Verify if the triples align with the text. Find missing, extra, or incorrect triples.
TEXT: Blue Spice is a coffee shop in city centre.
TRIPLES:
1. [S] Blue Spice [P] area [O] city centre
2. [S] Blue Spice [P] eat type [O] coffee shop
Output as markdown table with Type and Triple columns."""
MESSAGES = [{"role": "system", "content": SYSTEM_PROMPT}, {"role": "user", "content": QUERY}]

adapter_path = snapshot_download(ADAPTER_ID)
llm = LLM(model=BASE_MODEL, enable_lora=True)
outputs = llm.chat(
    MESSAGES,
    SamplingParams(max_tokens=1024, temperature=0.3, seed=2023),
    lora_request=LoRARequest("xqdt", 1, adapter_path),
)
print(outputs[0].outputs[0].text)

Citation

bibtex
@inproceedings{efimov-zhang-etal-2026-xqdt,
  title = {XQDT: eXplainable and Quantitative Data-Text Alignment Metric with Feedback Signals},
  author = {Efimov-Zhang, Kun and Song, Yifei and Gardent, Claire},
  booktitle = {Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing},
  year = {2026}
}