alt.freeweights.qwen / LaSER-Qwen3-4B
From: Alibaba-NLP <huggingface.co/Alibaba-NLP>Newsgroups: alt.freeweights.qwenSubject:

LaSER-Qwen3-4B

Date: 2026-11-15Commit: d22e8d3Signed: 2DC28CC7B26A283B ✓

Feature extraction model with 4B parameters. Safetensors weights, 8.06 GB in all. Published by Alibaba-NLP under MIT.

4B params8.06GBLaSER-Qwen3-4Bsafetensorspermissive
FactsParams4BSize8.06 GBFormatssafetensorsTaskfeature extractionLicenseMITFrom sourcepermissive
$ fw get Alibaba-NLP/LaSER-Qwen3-4B
# manifest sha256 ceecc9105ba1… · 8.06 GB · 13 files
$ fw verify ./LaSER-Qwen3-4B Alibaba-NLP/LaSER-Qwen3-4B
From sourceHosted (signed)Alibaba-NLP/LaSER-Qwen3-4BLast check: 2026-11-15 04:16 UTC

Get help: custom fine-tune or private deploy. We review your setup before we quote.

Fine-tune of Qwen3-4B.

Works with

Evaluate with

Overview

Size
8.06 GB
Weights
8.04 GB (safetensors)
Parameters
4B
Formats
safetensors
Task
feature extraction
License
MIT (permissive)
Files
13, each with a sha256
Publisher
Alibaba-NLP
Added
2026-11-15
Section
alt.freeweights.qwen
Lineage

Original release from the publisher.

Base model: Qwen/Qwen3-4B

Where these bytes come from
Publisher at the pinned commit→You

Sources are tried in order. A file counts only when its size and sha256 match the manifest. Sources are checked when you ask for them, not on a timer.

Sources
BadgeHostLast checkResult
From sourcehuggingface.co2026-11-15 04:16 UTCpassed

Model card

From the publisher at commit d22e8d3. Shown as plain text with links; images open at the publisher.

LaSER-Qwen3-4B#

LaSER (Latent Space Explicit Reasoning) is a self-distillation framework that internalizes explicit Chain-of-Thought reasoning into the latent space of dense retrievers, enabling the model to "think silently" through continuous latent tokens.

LaSER-Qwen3-4B is a 4B-parameter dense retriever built on Qwen/Qwen3-4B.

📄 Paper: LaSER: Internalizing Explicit Reasoning into Latent Space for Dense Retrieval

💻 Code: https://github.com/ignorejjj/LaSER

Model Summary#

AttributeDetail
Model TypeDense Retriever with Latent Thinking
Base ModelQwen/Qwen3-4B
Parameters4B
Embedding Dimension2560
Max Sequence Length8192 (training: 512)
Similarity FunctionCosine Similarity
Latent Thinking Steps (K)3 (default)
Training Data81K examples from ReasonEmb
LicenseMIT

How It Works#

Unlike standard dense retrievers that encode queries in a single forward pass, LaSER generates K continuous latent thinking tokens autoregressively in the embedding space:

  1. Encode the input text into embeddings
  2. At each thinking step, project the last hidden state through the LM head → softmax → compute a probability-weighted soft token from the embedding table
  3. Append the soft token and repeat for K steps (using KV caching for efficiency)
  4. Mean-pool the hidden states from all K thinking steps → L2 normalize

This enables complex reasoning while maintaining the inference efficiency of standard dense retrievers (~1.7× latency overhead, only ~0.3% of rewrite-then-retrieve pipelines).

Usage#

Direct Usage with Transformers#
import torch
import torch.nn.functional as F
from transformers import AutoModelForCausalLM, AutoTokenizer


def laser_encode(model, tokenizer, texts, max_length=512, num_thinking_steps=3):
    """Encode texts using LaSER's latent thinking mechanism."""
    device = next(model.parameters()).device
    batch = tokenizer(texts, padding=True, truncation=True, max_length=max_length, return_tensors="pt").to(device)
    input_ids, attention_mask = batch["input_ids"], batch["attention_mask"]

    batch_size = input_ids.size(0)
    thinking_slots = num_thinking_steps - 1
    eos_id = tokenizer.eos_token_id

    if thinking_slots > 0:
        eos_padding = torch.full((batch_size, thinking_slots), eos_id, dtype=input_ids.dtype, device=device)
        mask_padding = torch.ones((batch_size, thinking_slots), dtype=attention_mask.dtype, device=device)
        input_ids = torch.cat([input_ids, eos_padding], dim=1)
        attention_mask = torch.cat([attention_mask, mask_padding], dim=1)

    input_embeds = model.get_input_embeddings()(input_ids)
    embedding_table = model.get_input_embeddings().weight
    base_seq_len = input_embeds.size(1) - thinking_slots

    past_key_values = None
    hidden_steps = []

    for step_idx in range(thinking_slots):
        pos = base_seq_len + step_idx
        step_embeds = input_embeds[:, :pos, :] if past_key_values is None else input_embeds[:, pos-1:pos, :]
        step_mask = attention_mask[:, :pos]

        outputs = model(inputs_embeds=step_embeds, attention_mask=step_mask,
                       output_hidden_states=True, past_key_values=past_key_values,
                       use_cache=True, return_dict=True)
        hidden_steps.append(outputs.hidden_states[-1][:, -1, :])
        token_probs = torch.softmax(outputs.logits[:, -1, :], dim=-1)
        new_embed = token_probs @ embedding_table
        past_key_values = outputs.past_key_values
        pre = input_embeds[:, :pos, :]
        post = input_embeds[:, pos+1:, :]
        input_embeds = torch.cat([pre, new_embed.unsqueeze(1), post], dim=1)

    final_embeds = input_embeds[:, -1:, :] if past_key_values else input_embeds
    outputs = model(inputs_embeds=final_embeds, attention_mask=attention_mask,
                   output_hidden_states=True, past_key_values=past_key_values,
                   use_cache=True, return_dict=True)
    hidden_steps.append(outputs.hidden_states[-1][:, -1, :])

    embeddings = torch.stack(hidden_steps, dim=1).mean(dim=1)
    return F.normalize(embeddings, p=2, dim=-1)


# Load model
model_name = "Alibaba-NLP/LaSER-Qwen3-4B"
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
tokenizer.padding_side = "left"
if tokenizer.pad_token_id is None:
    tokenizer.pad_token = tokenizer.eos_token

model = AutoModelForCausalLM.from_pretrained(
    model_name, torch_dtype=torch.float16, trust_remote_code=True
).cuda().eval()

# Encode queries and documents
with torch.inference_mode():
    query_emb = laser_encode(model, tokenizer, ["why is the sky blue"], num_thinking_steps=3)
    doc_emb = laser_encode(model, tokenizer, ["Rayleigh scattering makes short wavelengths scatter more strongly"], num_thinking_steps=3)

# Compute similarity
similarity = (query_emb @ doc_emb.T).item()
print(f"Cosine similarity: {similarity:.4f}")
Batch Encoding#
queries = [
    "What causes tides in the ocean?",
    "How does photosynthesis convert light to energy?",
    "Why do metals conduct electricity?",
]

with torch.inference_mode():
    query_embeddings = laser_encode(model, tokenizer, queries, num_thinking_steps=3)
    print(f"Batch embeddings shape: {query_embeddings.shape}")  # (3, 2560)

Evaluation Results#

BRIGHT Benchmark (nDCG@10) — In-Domain#
ModelSizeAvg.
Qwen3-Embedding-4B4B17.9
Fair Baseline (Qwen3-4B)4B—
GIRCSE (Qwen3-4B)4B—
LaSER-Qwen3-4B (Ours)4B28.0
Cross-Scale Comparison on BRIGHT#
ModelSizeAvg. (nDCG@10)
LaSER-Qwen3-0.6B0.6B23.1
LaSER-Qwen3-4B4B28.0
LaSER-Qwen3-8B8B29.3

LaSER-Qwen3-4B achieves a strong balance between performance and computational cost, outperforming 8B-scale standard dense retrievers while requiring significantly less compute.

Training Details#

  • Training Data: 81K query-document pairs from ReasonEmb, each with a CoT reasoning path generated by GPT-4o-mini
  • Method: LoRA fine-tuning (r=64, α=32) for 1 epoch on 4×A100 GPUs
  • Loss: Contrastive learning + Output-level KL distillation (λ₂=10) + Process-level trajectory alignment (λ₃=0.1)
  • Temperature: τ=0.02
  • Thinking Steps: K=3

Model Family#

ModelParametersBRIGHT Avg.Link
LaSER-Qwen3-0.6B0.6B23.1🤗 Link
LaSER-Qwen3-4B4B28.0🤗 This model
LaSER-Qwen3-8B8B29.3🤗 Link

Citation#

@article{jin2026laser,
  title={LaSER: Internalizing Explicit Reasoning into Latent Space for Dense Retrieval},
  author={Jin, Jiajie and Zhang, Yanzhao and Li, Mingxin and Long, Dingkun and Xie, Pengjun and Zhu, Yutao and Dou, Zhicheng},
  year={2026},
  journal={arXiv preprint},
  url={https://arxiv.org/abs/2603.01425},
}

Files

13 files · 8.06 GBWeights 8.04 GB (safetensors). Sizes and sha256 from the signed manifest.
Hide all 13 files with their sha256
FileSizesha256
.gitattributes1.57 KB34448b82c17d60fec9b65b1f093c115ddbaadc04beb1b0140b6bfed2e012a930
README.md7.72 KB446548167e797417bb3d76fe3a8e7bb7638d68efae13eabfe6d7fa115ee7f9b1
added_tokens.json707 Bc0284b582e14987fbd3d5a2cb2bd139084371ed9acbae488829a1c900833c680
config.json726 B4ad69e02f2a61df2df27e84a4fb53532f0cbd2ab158d7608915764a67709f783
generation_config.json214 B81051cd3f6e77013827148d0b8a6ead93f8ac390d5ab805f849199f0af6a08db
merges.txt1.67 MB8831e4f1a044471340f7c0a83d7bd71306a5b867e95fd870f74d0c5308a904d5
model-00001-of-00002.safetensors4.97 GB81374eca0b4fabddfa7df2c2e3dc5e0782d8bce6f6992d2dd20f55b7570f52a4
model-00002-of-00002.safetensors3.08 GBf69ac0e978cbf30e43a64fd7f37bbd0f289871d2aee5ad977ce09240e6ad6fda
model.safetensors.index.json32.8 KBe36bba5af4706cfd22ecf7eedb5fd8f4d2559b92f2414b932651b9ed6495921a
special_tokens_map.json613 B76862e765266b85aa9459767e33cbaf13970f327a0e88d1c65846c2ddd3a1ecd
tokenizer.json11.4 MBaeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4
tokenizer_config.json9.76 KB3c0884a30471f4f542dc89630f62a380bb70a341fafda826136a7be921fec7ea
vocab.json2.78 MBca10d7e9fb3ed18575dd1e277a2579c16d108e32f27439684afa0e10b1440910
VersionsEach time the pinned upstream commit or file list changed in this repo. Newest first.
Upstream commitDateContents
d22e8d383f pinned now2026-11-15 04:16 UTC13 files · 8.06 GB

Use it

$ fw get Alibaba-NLP/LaSER-Qwen3-4B
# manifest sha256 ceecc9105ba1… · 8.06 GB · 13 files
$ fw verify ./LaSER-Qwen3-4B Alibaba-NLP/LaSER-Qwen3-4B
fw.pyChecks the signature and every sha256, tries each source in order, resumes.
$ python3 fw.py get https://freeweights.allternit.com/manifests/Alibaba-NLP/LaSER-Qwen3-4B.json --dir ./LaSER-Qwen3-4B $ python3 fw.py verify ./LaSER-Qwen3-4B ./Alibaba-NLP__LaSER-Qwen3-4B.json
hfThe Hugging Face CLI with one setting. Same repo id.
$ HF_ENDPOINT=https://freeweights.allternit.com hf download Alibaba-NLP/LaSER-Qwen3-4B --revision d22e8d383fcd7b2112d49a4cbba4cebb70d361f2 --local-dir ./LaSER-Qwen3-4B
transformersLoad the weights in Python.
import os os.environ["HF_ENDPOINT"] = "https://freeweights.allternit.com" from transformers import AutoModel, AutoTokenizer tok = AutoTokenizer.from_pretrained("Alibaba-NLP/LaSER-Qwen3-4B", revision="d22e8d383fcd7b2112d49a4cbba4cebb70d361f2") model = AutoModel.from_pretrained("Alibaba-NLP/LaSER-Qwen3-4B", revision="d22e8d383fcd7b2112d49a4cbba4cebb70d361f2", device_map="auto")

License

Name
MIT License
Id
MIT
Class
Permissive
Redistribution
yes
Listing
Hosted (signed)
Decided
License as declared by the publisher. No person read it. 2026-11-15
Text in
README.md
Text sha256
446548167e797417bb3d76fe3a8e7bb7638d68efae13eabfe6d7fa115ee7f9b1
Terms gate
No extra terms beyond the license.

Read the license text

Licenses are checked against the license table. A custom license passes only after a person reads it.

Provenance

From: Alibaba-NLP <huggingface.co/Alibaba-NLP>Newsgroups: alt.freeweights.qwenSubject: LaSER-Qwen3-4BDate: 2026-11-15Commit: d22e8d3Signed: 2DC28CC7B26A283B ✓
Upstream
Alibaba-NLP/LaSER-Qwen3-4B
Pinned commit
d22e8d383fcd7b2112d49a4cbba4cebb70d361f2
Manifest
LaSER-Qwen3-4B.json · .minisig
Manifest sha256
ceecc9105ba1ab857299179f15bc51f8f1dce49e6e4dab4e432d24f21453fc63
Signature
minisign, Ed25519, key 2DC28CC7B26A283B
Created
2026-11-15 04:16 UTC
Generator
freeweights-manifest/0.1.0
Takedowns
None.

How to verify

$ curl -O https://freeweights.allternit.com/manifests/Alibaba-NLP/LaSER-Qwen3-4B.json $ curl -O https://freeweights.allternit.com/manifests/Alibaba-NLP/LaSER-Qwen3-4B.json.minisig $ minisign -Vm LaSER-Qwen3-4B.json -P RWQ7KGqyx4zCLXtUFOqvfv8L3g+8fpKJ1FsuxPyOYMF+4KufbUxKq1Oq $ shasum -a 256 <file> # compare with the Files tab

A manifest whose signature fails must be rejected. A file whose size or sha256 does not match must be discarded. Verify a download

Model tree

Parent

Qwen/Qwen3-4B · this model is a finetune of it

No model in the catalog names this one as its parent.

Get it
Download
$ HF_ENDPOINT=https://freeweights.allternit.com hf download Alibaba-NLP/LaSER-Qwen3-4B
Open in Freeweights Studio

Pull, verify and run it in the Allternit app on Desktop, web or phone.

Signed manifest
minisign, key 2DC28CC7B26A283B. LaSER-Qwen3-4B.json. Provenance. Takedown history: none.
From: BAAI <huggingface.co/BAAI>Subject: Aquila-VL-2B-llava-qwen
From: Perciqa <huggingface.co/Perciqa>Subject: Aurora-Code-1
From: BAAI <huggingface.co/BAAI>Subject: bge-reasoner-embed-qwen3-8b-0923
From: amazon <huggingface.co/amazon>Subject: BMOJOF-primed-HQwen3-8B-Instruct
From: nbeerbower <huggingface.co/nbeerbower>Subject: Bubba-Qwen3.6-27B-LoRA
From: bartowski <huggingface.co/bartowski>Subject: bytkim_Qwen3.8-27B-pi-GGUF