Feature Extraction
PEFT
Safetensors
English
lora
multimodal
embedding
retrieval
chain-of-thought
qwen3-vl
Instructions to use zhanglx/TWN-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use zhanglx/TWN-8B with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse files- README.md +47 -0
- embedding/adapter_config.json +38 -0
- embedding/adapter_model.safetensors +3 -0
- gate_mlp.pt +3 -0
- queries.pt +3 -0
- reasoning/adapter_config.json +38 -0
- reasoning/adapter_model.safetensors +3 -0
README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: Qwen/Qwen3-VL-8B-Instruct
|
| 3 |
+
library_name: peft
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
tags:
|
| 8 |
+
- lora
|
| 9 |
+
- multimodal
|
| 10 |
+
- embedding
|
| 11 |
+
- retrieval
|
| 12 |
+
- chain-of-thought
|
| 13 |
+
- qwen3-vl
|
| 14 |
+
pipeline_tag: feature-extraction
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# TWN-8B
|
| 18 |
+
|
| 19 |
+
The 8B version of [Think When Needed (TWN)](https://github.com/winterfell00/Think-When-Needed), a framework for adaptive reasoning-driven multimodal embeddings. TWN introduces a dual-LoRA architecture on top of [Qwen3-VL-8B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-8B-Instruct) with a learned routing gate that adaptively activates chain-of-thought reasoning.
|
| 20 |
+
|
| 21 |
+
## Weight Structure
|
| 22 |
+
|
| 23 |
+
```
|
| 24 |
+
TWN-8B/
|
| 25 |
+
reasoning/ # LoRA adapter for CoT generation
|
| 26 |
+
adapter_config.json
|
| 27 |
+
adapter_model.safetensors
|
| 28 |
+
embedding/ # LoRA adapter for embedding extraction
|
| 29 |
+
adapter_config.json
|
| 30 |
+
adapter_model.safetensors
|
| 31 |
+
gate_mlp.pt # Routing gate MLP weights
|
| 32 |
+
queries.pt # Learnable query embeddings
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
## Citation
|
| 36 |
+
|
| 37 |
+
```bibtex
|
| 38 |
+
@article{zhang2026thinkneeded,
|
| 39 |
+
title={Think When Needed: Adaptive Reasoning-Driven Multimodal Embeddings with a Dual-LoRA Architecture},
|
| 40 |
+
author={Longxiang Zhang and Weilong Dai and Guanghao Zhang and Hao Jiang and Pipei Huang},
|
| 41 |
+
year={2026},
|
| 42 |
+
eprint={2605.14448},
|
| 43 |
+
archivePrefix={arXiv},
|
| 44 |
+
primaryClass={cs.CV},
|
| 45 |
+
url={https://arxiv.org/abs/2605.14448},
|
| 46 |
+
}
|
| 47 |
+
```
|
embedding/adapter_config.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alora_invocation_tokens": null,
|
| 3 |
+
"alpha_pattern": {},
|
| 4 |
+
"arrow_config": null,
|
| 5 |
+
"auto_mapping": null,
|
| 6 |
+
"base_model_name_or_path": "Qwen/Qwen3-VL-8B-Instruct",
|
| 7 |
+
"bias": "none",
|
| 8 |
+
"corda_config": null,
|
| 9 |
+
"ensure_weight_tying": false,
|
| 10 |
+
"eva_config": null,
|
| 11 |
+
"exclude_modules": null,
|
| 12 |
+
"fan_in_fan_out": false,
|
| 13 |
+
"inference_mode": true,
|
| 14 |
+
"init_lora_weights": true,
|
| 15 |
+
"layer_replication": null,
|
| 16 |
+
"layers_pattern": null,
|
| 17 |
+
"layers_to_transform": null,
|
| 18 |
+
"loftq_config": {},
|
| 19 |
+
"lora_alpha": 128,
|
| 20 |
+
"lora_bias": false,
|
| 21 |
+
"lora_dropout": 0.0,
|
| 22 |
+
"megatron_config": null,
|
| 23 |
+
"megatron_core": "megatron.core",
|
| 24 |
+
"modules_to_save": null,
|
| 25 |
+
"peft_type": "LORA",
|
| 26 |
+
"peft_version": "0.18.0",
|
| 27 |
+
"qalora_group_size": 16,
|
| 28 |
+
"r": 64,
|
| 29 |
+
"rank_pattern": {},
|
| 30 |
+
"revision": null,
|
| 31 |
+
"target_modules": "^(?!.*visual\\.).*(q_proj|k_proj|v_proj|o_proj|gate_proj|up_proj|down_proj)$",
|
| 32 |
+
"target_parameters": null,
|
| 33 |
+
"task_type": "FEATURE_EXTRACTION",
|
| 34 |
+
"trainable_token_indices": null,
|
| 35 |
+
"use_dora": false,
|
| 36 |
+
"use_qalora": false,
|
| 37 |
+
"use_rslora": false
|
| 38 |
+
}
|
embedding/adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3396188f161fef48aee411cda276371e5527b4132672386a721e0860cb7248b4
|
| 3 |
+
size 349251816
|
gate_mlp.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:50e13ca2f68b931e40aa1d1d80163583364b586df3190debed1e97eae162f587
|
| 3 |
+
size 8428334
|
queries.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6832f262f597e24cec336ec54c2c74f5a9a286ed3ba0aa7c374a389c3ec0b532
|
| 3 |
+
size 263388
|
reasoning/adapter_config.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alora_invocation_tokens": null,
|
| 3 |
+
"alpha_pattern": {},
|
| 4 |
+
"arrow_config": null,
|
| 5 |
+
"auto_mapping": null,
|
| 6 |
+
"base_model_name_or_path": "Qwen/Qwen3-VL-8B-Instruct",
|
| 7 |
+
"bias": "none",
|
| 8 |
+
"corda_config": null,
|
| 9 |
+
"ensure_weight_tying": false,
|
| 10 |
+
"eva_config": null,
|
| 11 |
+
"exclude_modules": null,
|
| 12 |
+
"fan_in_fan_out": false,
|
| 13 |
+
"inference_mode": true,
|
| 14 |
+
"init_lora_weights": true,
|
| 15 |
+
"layer_replication": null,
|
| 16 |
+
"layers_pattern": null,
|
| 17 |
+
"layers_to_transform": null,
|
| 18 |
+
"loftq_config": {},
|
| 19 |
+
"lora_alpha": 128,
|
| 20 |
+
"lora_bias": false,
|
| 21 |
+
"lora_dropout": 0.0,
|
| 22 |
+
"megatron_config": null,
|
| 23 |
+
"megatron_core": "megatron.core",
|
| 24 |
+
"modules_to_save": null,
|
| 25 |
+
"peft_type": "LORA",
|
| 26 |
+
"peft_version": "0.18.0",
|
| 27 |
+
"qalora_group_size": 16,
|
| 28 |
+
"r": 64,
|
| 29 |
+
"rank_pattern": {},
|
| 30 |
+
"revision": null,
|
| 31 |
+
"target_modules": "^(?!.*visual\\.).*(q_proj|k_proj|v_proj|o_proj|gate_proj|up_proj|down_proj)$",
|
| 32 |
+
"target_parameters": null,
|
| 33 |
+
"task_type": "FEATURE_EXTRACTION",
|
| 34 |
+
"trainable_token_indices": null,
|
| 35 |
+
"use_dora": false,
|
| 36 |
+
"use_qalora": false,
|
| 37 |
+
"use_rslora": false
|
| 38 |
+
}
|
reasoning/adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:be8334c679a81741b20e1328dd40b8e79cb923180bcef2914d9fdeddb29d76de
|
| 3 |
+
size 698427288
|