HyperDIME-Qwen: query-aware dimension selectors
Research checkpoints from HyperDIME-Qwen, a study of query-aware dimension selection on the
frozen embeddings of Qwen/Qwen3-Embedding-0.6B
(D = 1024, revision 97b0c614be4d77ee51c0cef4e5f07c00f9eb65b3).
A selector reads a query embedding q and scores the 1024 dimensions. Retrieval keeps the top-k
dimensions of the query and scores the documents with the masked query, so document embeddings
are never changed. Every selector here is evaluated by exact, full-corpus scoring at the budgets
k = 102, 204, …, 921 (10%–90% of D).
Benchmarks, per-query results, reports and decision records are in the companion dataset
wilkertyl/hyperdime-qwen3-benchmarks.
Status: research artifacts, not a product. Most results are exploratory, several decisions are still marked proposed, and the P3-bench held-out comparison was still running when these files were uploaded. Read the linked reports before reusing a number.
Selector families
All selectors share one form: a 1024×1024 linear map followed by a log-softmax over
dimensions. Some add a fixed geometric prior log(q_d² · Var(x_d) + ε), where Var is the
per-dimension variance of the environment's document embeddings.
| Folder | Experiment | What it is | Tensors |
|---|---|---|---|
selectors/official/ |
E0, gate G1 | Learning-to-Select (L2S) recipe, one per environment | projection.* |
selectors/global/ |
E0 | One L2S selector trained on all environments (ADR-0003 anchor) | projection.* |
selectors/candidates/ |
E0 | Regularized candidates selected on validation queries | projection.* |
selectors/seeded/ |
E1, gate G2 | L2S selectors, 3 seeds × 3 environments, used for the transfer matrix | projection.* |
selectors/retrieval-{grid,seeded}/ |
S1 | Same linear selector trained directly on masked retrieval | projection.* |
selectors/geometric-{grid,seeded}/ |
S2 | S1 selector started from the geometric prior | projection.*, variance |
selectors/weighted-{grid,seeded}/, weighted-aligned-* |
S3 | One learned weight a on the prior |
+ prior_weight |
selectors/budget-{grid,seeded}/ |
S4 | One prior weight per budget | + prior_weights, budgets |
p3-bench-selectors/l2s-official/ |
P3-bench | The authors' L2S code retrained on the query-disjoint split p3-query-split-v1 |
see manifest |
p3-bench-selectors/p3-s1/ |
P3-bench | S1-style retrieval arms on the same split | see manifest |
p3-bench-selectors/p3-teacher-arms/ |
P3-bench | Selectors distilled from positive, contrastive and rank-guided mask teachers | see manifest |
p3-bench-selectors/p3-target/ |
P3-target | Target-encoding study arms E0–E4 (SciFact, NFCorpus) | see manifest |
f0-spike/ |
F0 spike | Early BEIR spike selectors (.pt state dicts), validation only |
projection.* |
*-grid folders hold every hyperparameter cell of the search; *-seeded folders hold the
selected cell retrained with seeds 0–2, and are the ones the reports compare.
Each run directory contains:
selector.safetensors: the weightsselector.json: kind, environment and payload SHA-256manifest.json: commit, config, dataset and model hashes, seed, device and library versionsselection.json: the chosen cell and its validation nDCG@10 per budgethistory.json: the training curve
Usage
import torch
from safetensors.torch import load_file
from huggingface_hub import hf_hub_download
path = hf_hub_download(
"wilkertyl/hyperdime-qwen3-selectors",
"selectors/retrieval-seeded/scifact/seed-0/20261015T123158Z-1cd4da34/selector.safetensors",
)
w = load_file(path)
def dimension_scores(q: torch.Tensor) -> torch.Tensor:
"""q: (n, 1024) L2-normalized Qwen3-Embedding-0.6B query embeddings."""
logits = q.float() @ w["projection.weight"].T + w["projection.bias"]
if "variance" in w: # S2-S4: add the geometric prior
prior = torch.log(q.float() ** 2 * w["variance"] + 1e-12)
if "prior_weight" in w:
prior = w["prior_weight"] * prior
# S4 checkpoints use prior_weights[i] for budgets[i] instead
logits = prior + logits
return torch.log_softmax(logits, dim=-1)
def mask_query(q: torch.Tensor, k: int) -> torch.Tensor:
keep = dimension_scores(q).topk(k, dim=-1).indices
return torch.zeros_like(q).scatter(-1, keep, q.gather(-1, keep))
# scores = mask_query(q, k=307) @ documents.T # documents: full 1024-d embeddings
Use the query instruction recorded in each manifest
("Given a question, retrieve relevant documents that best answer the question") when you
embed queries. Use hyperdime.training.selection.load_selector from the project code to get
the exact module.
Training data and protocol
- Environments: BEIR SciFact, BEIR NFCorpus and MS MARCO passage. Selectors are chosen on validation queries only, and test judgments are read only by evaluation.
- The P3 family uses the query-disjoint split
p3-query-split-v1(fit / tune / evaluation), published in the dataset repo. - Hard negatives and the training recipe follow Learning to Select (ADR-0002 in the dataset repo).
Limitations
- These are research checkpoints for one encoder. They are not tuned for deployment.
- Query-only masking keeps the full 1024-d document index. It saves no storage.
- Selectors trained on one environment degrade on others (gate G2). Use the selector that matches your corpus, or treat it as a baseline.
- The MS MARCO selectors are trained on MS MARCO judgments. Check the MS MARCO terms before any non-research use.
- No licence has been chosen for these weights yet.