CrossEncoder based on Qwen/Qwen3.5-0.8B
This is a Cross Encoder model finetuned from Qwen/Qwen3.5-0.8B on the image_to_text and text_to_image datasets using the sentence-transformers library. It computes scores for pairs of texts, which can be used for text reranking and semantic search.
Model Details
Model Description
- Model Type: Cross Encoder
- Base model: Qwen/Qwen3.5-0.8B
- Maximum Sequence Length: 262144 tokens
- Number of Output Labels: 1 label
- Supported Modalities: Text, Image, Video, Message
- Training Datasets:
Model Sources
Full Model Architecture
CrossEncoder(
(0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}, 'image': {'method': 'forward', 'method_output_name': 'last_hidden_state'}, 'video': {'method': 'forward', 'method_output_name': 'last_hidden_state'}, 'message': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'message_format': 'auto', 'processing_kwargs': {'chat_template': {'add_generation_prompt': True}}, 'architecture': 'Qwen3_5Model'})
(1): Pooling({'embedding_dimension': 1024, 'pooling_mode': 'lasttoken', 'include_prompt': True})
(2): Dense({'in_features': 1024, 'out_features': 1, 'bias': False, 'activation_function': 'torch.nn.modules.linear.Identity', 'module_input_name': 'sentence_embedding', 'module_output_name': 'scores'})
)
Usage
Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
pip install -U sentence-transformers
Then you can load this model and run inference.
from sentence_transformers import CrossEncoder
model = CrossEncoder("tomaarsen/reranker-Qwen3.5-0.8B-doodles-image-text-to-text-pooling-dense")
pairs = [
['https://huggingface.co/tomaarsen/reranker-Qwen3.5-0.8B-doodles-image-text-to-text-pooling-dense/resolve/main/assets/image_0.jpg', 'a content character with a tan head and purple puffballs hair wearing a blue fleece, green background'],
['https://huggingface.co/tomaarsen/reranker-Qwen3.5-0.8B-doodles-image-text-to-text-pooling-dense/resolve/main/assets/image_0.jpg', 'a grumpy character with a green head and pink hair wearing a light blue puffer, iridescent background'],
['https://huggingface.co/tomaarsen/reranker-Qwen3.5-0.8B-doodles-image-text-to-text-pooling-dense/resolve/main/assets/image_0.jpg', 'a surprised character with a pale head and green mullet hair wearing a blue backpack, purple background'],
['https://huggingface.co/tomaarsen/reranker-Qwen3.5-0.8B-doodles-image-text-to-text-pooling-dense/resolve/main/assets/image_0.jpg', 'a default character with a med head and green brushcut hair wearing a holographic sweater, gradient 4 background'],
['https://huggingface.co/tomaarsen/reranker-Qwen3.5-0.8B-doodles-image-text-to-text-pooling-dense/resolve/main/assets/image_0.jpg', 'a sunglasses character with a orange head and pink hair wearing a green hoodie, grey background'],
]
scores = model.predict(pairs)
print(scores)
Evaluation
Metrics
Cross Encoder Reranking
- Datasets:
doodles-image-to-text-eval and doodles-text-to-image-eval
- Evaluated with
CrossEncoderRerankingEvaluator with these parameters:{
"at_k": 10
}
| Metric |
doodles-image-to-text-eval |
doodles-text-to-image-eval |
| map |
0.9933 |
0.9175 |
| mrr@10 |
0.9933 |
0.9175 |
| ndcg@10 |
0.995 |
0.9386 |
Training Details
Training Datasets
image_to_text
text_to_image
Evaluation Datasets
image_to_text
text_to_image
Training Hyperparameters
Non-Default Hyperparameters
num_train_epochs: 1
learning_rate: 5e-06
warmup_steps: 0.1
gradient_accumulation_steps: 4
bf16: True
eval_strategy: steps
per_device_eval_batch_size: 32
prompts: {'image_to_text': "Given the image, judge whether the text matches it. Respond with 1 if they match, 0 if they don't.", 'text_to_image': "Given the text, judge whether the image matches it. Respond with 1 if they match, 0 if they don't."}
All Hyperparameters
Click to expand
per_device_train_batch_size: 8
num_train_epochs: 1
max_steps: -1
learning_rate: 5e-06
lr_scheduler_type: linear
lr_scheduler_kwargs: None
warmup_steps: 0.1
optim: adamw_torch_fused
optim_args: None
weight_decay: 0.0
adam_beta1: 0.9
adam_beta2: 0.999
adam_epsilon: 1e-08
optim_target_modules: None
gradient_accumulation_steps: 4
average_tokens_across_devices: True
max_grad_norm: 1.0
label_smoothing_factor: 0.0
bf16: True
fp16: False
bf16_full_eval: False
fp16_full_eval: False
tf32: None
gradient_checkpointing: False
gradient_checkpointing_kwargs: None
torch_compile: False
torch_compile_backend: None
torch_compile_mode: None
use_liger_kernel: False
liger_kernel_config: None
use_cache: False
neftune_noise_alpha: None
torch_empty_cache_steps: None
auto_find_batch_size: False
log_on_each_node: True
logging_nan_inf_filter: True
include_num_input_tokens_seen: no
log_level: passive
log_level_replica: warning
disable_tqdm: False
project: huggingface
trackio_space_id: trackio
eval_strategy: steps
per_device_eval_batch_size: 32
prediction_loss_only: True
eval_on_start: False
eval_do_concat_batches: True
eval_use_gather_object: False
eval_accumulation_steps: None
include_for_metrics: []
batch_eval_metrics: False
save_only_model: False
save_on_each_node: False
enable_jit_checkpoint: False
push_to_hub: False
hub_private_repo: None
hub_model_id: None
hub_strategy: every_save
hub_always_push: False
hub_revision: None
load_best_model_at_end: False
ignore_data_skip: False
restore_callback_states_from_checkpoint: False
full_determinism: False
seed: 42
data_seed: None
use_cpu: False
accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
parallelism_config: None
dataloader_drop_last: False
dataloader_num_workers: 0
dataloader_pin_memory: True
dataloader_persistent_workers: False
dataloader_prefetch_factor: None
remove_unused_columns: True
label_names: None
train_sampling_strategy: random
length_column_name: length
ddp_find_unused_parameters: None
ddp_bucket_cap_mb: None
ddp_broadcast_buffers: False
ddp_backend: None
ddp_timeout: 1800
fsdp: []
fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
deepspeed: None
debug: []
skip_memory_metrics: True
do_predict: False
resume_from_checkpoint: None
warmup_ratio: None
local_rank: -1
prompts: {'image_to_text': "Given the image, judge whether the text matches it. Respond with 1 if they match, 0 if they don't.", 'text_to_image': "Given the text, judge whether the image matches it. Respond with 1 if they match, 0 if they don't."}
batch_sampler: batch_sampler
multi_dataset_batch_sampler: proportional
router_mapping: {}
learning_rate_mapping: {}
Training Logs
| Epoch |
Step |
Training Loss |
image to text loss |
text to image loss |
doodles-image-to-text-eval_ndcg@10 |
doodles-text-to-image-eval_ndcg@10 |
| -1 |
-1 |
- |
- |
- |
0.8248 |
0.4728 |
| 0.1030 |
29 |
0.2942 |
- |
- |
- |
- |
| 0.2060 |
58 |
0.2192 |
- |
- |
- |
- |
| 0.2522 |
71 |
- |
0.1373 |
0.1687 |
0.9457 |
0.8544 |
| 0.3091 |
87 |
0.1332 |
- |
- |
- |
- |
| 0.4121 |
116 |
0.0915 |
- |
- |
- |
- |
| 0.5044 |
142 |
- |
0.0587 |
0.0508 |
0.995 |
0.9221 |
| 0.5151 |
145 |
0.0537 |
- |
- |
- |
- |
| 0.6181 |
174 |
0.0560 |
- |
- |
- |
- |
| 0.7211 |
203 |
0.0803 |
- |
- |
- |
- |
| 0.7567 |
213 |
- |
0.0408 |
0.0427 |
0.995 |
0.9432 |
| 0.8242 |
232 |
0.0628 |
- |
- |
- |
- |
| 0.9272 |
261 |
0.0656 |
- |
- |
- |
- |
| -1 |
-1 |
- |
- |
- |
0.995 |
0.9386 |
Environmental Impact
Carbon emissions were measured using CodeCarbon.
- Energy Consumed: 0.290 kWh
- Carbon Emitted: 0.078 kg of CO2
- Hours Used: 1.025 hours
Training Hardware
- On Cloud: No
- GPU Model: 1 x NVIDIA GeForce RTX 3090
- CPU Model: 13th Gen Intel(R) Core(TM) i7-13700K
- RAM Size: 31.78 GB
Framework Versions
- Python: 3.11.6
- Sentence Transformers: 5.4.0.dev0
- Transformers: 5.3.0
- PyTorch: 2.10.0+cu128
- Accelerate: 1.13.0.dev0
- Datasets: 4.3.0
- Tokenizers: 0.22.2
Citation
BibTeX
Sentence Transformers
@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/1908.10084",
}