Q-ReAlign GGUF

GGUF conversions of Q-ReAlign by Q-Future, for llama.cpp. Q-ReAlign is a Qwen3.5-VL model fine-tuned as a Q-Align judge: it rates the aesthetics or technical quality of an image as a score from 0 to 1.

File Source Size
Q-ReAlign-Lite-4B-Q8_0.gguf q-future/Q-ReAlign-Lite-4B @ 06add46 5.2 GB
Q-ReAlign-Lite-4B-mmproj-F16.gguf same, vision projector 0.67 GB

All credit for the model goes to its authors; see the original model card for the method, benchmarks and citation. This repo only changes the file format.

Serving

llama-server -m Q-ReAlign-Lite-4B-Q8_0.gguf --mmproj Q-ReAlign-Lite-4B-mmproj-F16.gguf \
  -ngl 99 --ctx-size 4096 --reasoning off

Don't pass --image-min-tokens: it upscales small images, and the scores drift from the reference. A 1 MP image takes about 1040 prompt tokens.

Scoring

Q-ReAlign is not a chat model. Send the image with the rating prompt, prefill the assistant's answer with the stem, and read the next-token logprobs of the five level words:

import base64, math, requests

LEVELS = {"excellent": 1.0, "good": 0.75, "fair": 0.5, "poor": 0.25, "bad": 0.0}
image = base64.b64encode(open("photo.png", "rb").read()).decode()
resp = requests.post("http://localhost:8080/v1/chat/completions", json={
    "messages": [
        {"role": "user", "content": [
            {"type": "image_url", "image_url": {"url": f"data:image/png;base64,{image}"}},
            {"type": "text", "text": "How would you rate the aesthetics of this image?"},
        ]},
        {"role": "assistant", "content": "The aesthetics of the image is"},
    ],
    "max_tokens": 1, "temperature": 0, "logprobs": True, "top_logprobs": 20,
    "chat_template_kwargs": {"enable_thinking": False},
}).json()
top = resp["choices"][0]["logprobs"]["content"][0]["top_logprobs"]
probs = {t["token"][1:]: math.exp(t["logprob"]) for t in top
         if t["token"].startswith(" ") and t["token"][1:] in LEVELS}
score = sum(LEVELS[w] * p for w, p in probs.items()) / sum(probs.values())

For technical quality, ask "How would you rate the quality of this image?" and prefill "The quality of the image is".

For best agreement with the reference, send images at up to 1 MP with both sides a multiple of 32 px (patch 16 ร— merge 2), as PNG, so the server doesn't resize them again.

Conversion

Converted with convert_hf_to_gguf.py from llama.cpp build 11541 (f2918cabb): --outtype q8_0 for the text model, --mmproj --outtype f16 for the projector. The checkpoint's tokenizer_config.json names tokenizer_class: TokenizersBackend, a transformers 5 name the converter's transformers can't load, so the text model was converted from a copy naming Qwen2TokenizerFast; the tokenizer data itself (tokenizer.json) is unchanged. The untied lm_head is kept as a separate output.weight.

Verification

Scored 20 wallpapers (4K, HD, 640 px, plus crop/blur/noise-degraded copies) with these files on llama-server (q8_0 KV cache, flash attention) and with the authors' transformers bf16 code, for both the aesthetics and quality prompts:

  • Pearson correlation 1.000, largest score difference 0.006.
  • Identical prompt token counts; all five level words always in the top 20 logprobs.
  • Degraded copies scored 0.02โ€“0.22, their originals 0.78โ€“0.99.
Downloads last month
97
GGUF
Model size
5B params
Architecture
qwen35
Hardware compatibility
Log In to add your hardware

8-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for VERIGEN/q-realign-GGUF

Quantized
(1)
this model