CoolFace
Modelpublic

Labradorlabs/bsca-bge-micro-v2-contrastive-v14-fresh-clean-v3-eb256-t005-e1-384

sourceHugging Facemitupdated 3mo agoView on Hugging Face
0likes99downloads
Model Card

bsca-bge-micro-v2-contrastive-v14-fresh-clean-v3-eb256-t005-e1-384

BSCA 바이너리↔소스 함수 정렬용 contrastive 임베딩 모델. TaylorAI/bge-micro-v2를 디컴파일 함수와 소스 함수를 같은 공간에 정렬하도록 contrastive 파인튜닝한 v14 챔피언(epoch-1) 체크포인트입니다.

  • —Base: TaylorAI/bge-micro-v2
  • —Dataset: Labradorlabs/bsca-binary-source-aligned-v3-clean-v3 (fingerprint 220d988ac0980dca)
  • —Embedding dim: 384 (max_length 384)
  • —ES vector field: bge_v14_fresh_e1_384_vector

Full-index 성능 (15M source-function, 120 queries, querysetid 943346736accac8b)

metricvalue
source-function MRR0.16672
Recall@1 / @10 / @100 / @10000.133 / 0.250 / 0.342 / 0.392
component MRR0.17792
component Recall@1 / @10 / @1000.142 / 0.258 / 0.375

epoch-1 → 챔피언 승격 시 source-function MRR +47.7% (relative).

Training

  • —contrastive batch 256 (physical 256, grad-accum 1), lr 2e-5, warmup 0.05
  • —temperature 0.05, bf16, preprocess v5:both:light
  • —in-batch hardest-negative margin 0.2 (weight 0.3), explicit safe-HN 미사용
  • —planned 2 epochs, epoch-1 승격 (epoch-2는 fixed-pool 퇴행으로 기각)

training_state.pt(옵티마이저·스케줄러·RNG 상태)가 포함되어 epoch-2 strict resume가 가능합니다.

Usage

python
import torch, torch.nn.functional as F
from transformers import AutoModel, AutoTokenizer

name = "Labradorlabs/bsca-bge-micro-v2-contrastive-v14-fresh-clean-v3-eb256-t005-e1-384"
tok = AutoTokenizer.from_pretrained(name)
model = AutoModel.from_pretrained(name).eval()

def embed(texts):
    enc = tok(texts, padding=True, truncation=True, max_length=384, return_tensors="pt")
    with torch.no_grad():
        out = model(**enc)
    emb = out.last_hidden_state[:, 0]  # CLS
    return F.normalize(emb, p=2, dim=1)