Loading…
Loading…
Tabman EmbeddingGemma 2 (270m) is a state-of-the-art sentence and document embedding model fine-tuned specifically for browser tab organization, semantic search, hierarchical URL clustering, and web history discovery in Tabman (Brave Tab Manager).
Trained on 18,000 stratified contrastive triplets across 18 distinct web verticals using Matryoshka Representation Learning (MRL) with loss penalties computed simultaneously at 768d, 512d, 256d, and 128d.
| Parameter | Specification |
|---|---|
| Model ID | Anshulgada/tabman-embeddinggemma-2-270m |
| Base Architecture | google/embeddinggemma-2 (~270M parameters) |
| Modality Scope | Text & Code specialized transformer backbone (~270M parameters) |
| Native Dimension | 768 dimensions |
| Matryoshka Dimensions | 768d, 512d, 256d, 128d (Recommended) |
| Max Context Window | 8,192 tokens (512 tokens tested for tab titles & URLs) |
| Training Precision | Pure bfloat16 (bf16) on NVIDIA RTX A6000 (48GB VRAM) |
| Loss Function | MultipleNegativesRankingLoss wrapped in MatryoshkaLoss |
| Base Checkpoint | Anshulgada/embeddinggemma-2-270m |
| License | Apache 2.0 |
Traditional embedding models require storing 768 or 1024 floating-point values per tab or document. With Matryoshka Representation Learning (MRL), front-truncated slices of the embedding vector preserve near-identical semantic clustering geometry:
| Output Dimension | Accuracy (%) | Mean Cosine Margin | Vector Size Ratio | Vector RAM / 10,000 Tabs |
|---|---|---|---|---|
| 768d (Native) | 98.50% | +0.6074 | 1.00x (Baseline) | ~30.7 MB |
| 512d | 98.50% | +0.6077 | 0.67x | ~20.5 MB |
| 256d | 98.44% | +0.6051 | 0.33x | ~10.2 MB |
| 128d (Target Runtime) | 98.50% | +0.6074 | 0.17x (6x smaller!) | ~5.1 MB |
[!NOTE] Truncating embeddings from 768d to 128d (
embedding[:128]) results in 0.00% accuracy loss across the entire 1,800 test triplet suite while cutting browser memory, index storage, and vector distance computation time by 83.3%.
Evaluated across 1,800 held-out test triplets stratified across 18 real-world web domains:
localhost:3000, Swagger, Grafana)| Runtime Environment | Format / Engine | Memory / VRAM | Latency / Tab | Throughput | Best For |
|---|---|---|---|---|---|
| Browser Extension | WebGPU INT8 ONNX (Transformers.js) |
~270 MB | 8 - 15 ms | ~80 tabs/sec | Real-time tab grouping in browser |
| Local CPU Fallback | INT8 ONNX (onnxruntime) |
~280 MB | 30 - 45 ms | ~25 tabs/sec | Systems without WebGPU / discrete GPU |
| Remote / LAN Server | PyTorch CUDA BF16 (serve_embeddings.py) |
~600 MB | < 2 ms | >1,500 tabs/sec | Centralized indexing across multi-browser setups |
sentence-transformers) with 128d Slicingfrom sentence_transformers import SentenceTransformer
# Load model (automatically uses CUDA if available)
model = SentenceTransformer("Anshulgada/tabman-embeddinggemma-2-270m")
queries = [
"GitHub PR #24502: Fix memory leak in reconciliation queue",
"Stack Overflow: Concurrency race condition in async runtime",
"Stripe API: Handling Webhook idempotency keys in Python",
]
# Generate normalized 128-dimensional Matryoshka embeddings
embeddings = model.encode(queries, normalize_embeddings=True)
embeddings_128d = embeddings[:, :128]
similarity = model.similarity(embeddings_128d[0], embeddings_128d[1])
print(f"Cosine Similarity (PR vs StackOverflow): {similarity.item():.4f}")
This repository includes pre-converted, quantized INT8 ONNX weights in the onnx/ folder, ready for direct execution inside Chrome / Brave extensions:
import { pipeline } from "@huggingface/transformers";
// Initialize in-browser feature extraction with WebGPU acceleration
const extractor = await pipeline(
"feature-extraction",
"Anshulgada/tabman-embeddinggemma-2-270m",
{ dtype: "q8", device: "webgpu" }
);
// Extract embedding for a browser tab
const output = await extractor(
"GitHub - Anshulgada/brave-tab-manager: AI tab discovery and manager",
{ pooling: "mean", normalize: true }
);
// Slice to 128 dimensions for ultra-fast vector clustering
const embedding128 = Array.from(output.data).slice(0, 128);
console.log("128d WebGPU Vector:", embedding128);
Serve this model with the included zero-dependency server:
python scripts/ai/serve_embeddings.py --port 11434 --variant 270m
Consume using standard OpenAI SDK:
from openai import OpenAI
client = OpenAI(base_url="http://localhost:11434/v1", api_key="not-needed")
response = client.embeddings.create(
input=["GitHub PR #42: Brave Tab Manager", "Kubernetes cluster configuration"],
model="Anshulgada/tabman-embeddinggemma-2-270m",
)
print("Embedding dimension:", len(response.data[0].embedding)) # 128
curl http://localhost:11434/api/embeddings \
-H "Content-Type: application/json" \
-d '{"model": "Anshulgada/tabman-embeddinggemma-2-270m", "prompt": "MDN Web Docs: WebGPU API fundamentals"}'
import numpy as np
import onnxruntime as ort
from transformers import AutoTokenizer
session = ort.InferenceSession("onnx/model_quantized.onnx")
tokenizer = AutoTokenizer.from_pretrained("Anshulgada/tabman-embeddinggemma-2-270m")
inputs = tokenizer(["Brave Browser: Tab Groups API"], return_tensors="np")
ort_inputs = {
"input_ids": inputs["input_ids"],
"attention_mask": inputs["attention_mask"],
}
outputs = session.run(None, ort_inputs)
raw_vec = outputs[0][0]
vec_128 = raw_vec[:128] / np.linalg.norm(raw_vec[:128])
google/embeddinggemma-2MultipleNegativesRankingLoss wrapped in MatryoshkaLoss([768, 512, 256, 128])weight_decay=0.01)bfloat16 on NVIDIA RTX A6000 48GB VRAM (Ubuntu 24.04 LTS)All 6 models (3 raw base models + 3 domain-specialized fine-tuned models) are published under Apache 2.0:
| Model Variant | Base Model (Raw Foundation) | Fine-Tuned Model (Tabman + WebGPU) | Parameters | Focus Area |
|---|---|---|---|---|
| 270M | Anshulgada/embeddinggemma-2-270m |
Anshulgada/tabman-embeddinggemma-2-270m |
~270M | Text & Code / In-Browser Extension |
| 440M | Anshulgada/embeddinggemma-2-440m |
Anshulgada/tabman-embeddinggemma-2-440m |
~440M | Text + Vision Multimodal |
| 740M | Anshulgada/embeddinggemma-2-740m |
Anshulgada/tabman-embeddinggemma-2-740m |
~740M | Full Multimodal (Text + Vision + Audio) |
@software{gada2026tabman,
author = {Anshul Gada},
title = {Tabman: AI-Powered Tab Manager and Semantic Discovery},
year = {2026},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/Anshulgada/brave-tab-manager}}
}
Developed with ❤️ for Brave Tab Manager (Tabman).
google/embeddinggemma-2