Instructions to use Anshulgada/tabman-embeddinggemma-2-270m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Anshulgada/tabman-embeddinggemma-2-270m with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Anshulgada/tabman-embeddinggemma-2-270m") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Transformers.js
How to use Anshulgada/tabman-embeddinggemma-2-270m with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('feature-extraction', 'Anshulgada/tabman-embeddinggemma-2-270m'); - Notebooks
- Google Colab
- Kaggle
- Tabman EmbeddingGemma 2 (270M)
Tabman EmbeddingGemma 2 (270M)
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.
Model Specifications
| 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 |
The Matryoshka Miracle: 6x Smaller with Zero Quality Loss
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 |
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%.
Empirical Benchmark Findings across 18 Domains
Evaluated across 1,800 held-out test triplets stratified across 18 real-world web domains:
- 100.0% Accuracy on 17 out of 18 Domains:
- API Documentation (MDN, Stripe, PyTorch)
- Cloud & DevOps (AWS, GCP, Kubernetes, Terraform)
- Frontend Development (React, Vue, Tailwind, Next.js)
- Backend & Databases (PostgreSQL, Redis, Kafka, FastAPI)
- Machine Learning & AI (Hugging Face, PyTorch, LangChain, CUDA)
- Productivity & Workspace (Notion, Google Docs, Slack, Jira)
- Localhost & Internal Dev (
localhost:3000, Swagger, Grafana) - Community & Forums (StackOverflow, Reddit, GitHub Discussions)
- Career & Job Search (LinkedIn, Greenhouse, Indeed)
- Design & UI/UX (Figma, Dribbble, Unsplash)
- Finance & Banking (Stripe, Robinhood, Bloomberg)
- Video Streaming (YouTube, Twitch, Netflix)
- Audio & Podcasts (Spotify, SoundCloud, Apple Podcasts)
- E-Commerce & Shopping (Amazon, eBay, Shopify)
- News & Journalism (NYTimes, BBC, TechCrunch)
- Travel & Booking (Airbnb, Google Flights, Booking.com)
- Gaming & Esports (Steam, Discord, IGN)
- 72.7% - 75.8% Accuracy on Dense Academic Research:
- ArXiv CS/Math dense papers with overlapping terminology.
Sizing & Deployment Matrix
| 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 |
Quickstart & Code Examples
1. Python (sentence-transformers) with 128d Slicing
from 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}")
2. In-Browser WebGPU via Transformers.js (JavaScript / TypeScript)
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);
3. OpenAI-Compatible Remote REST API
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
4. Ollama-Compatible REST API
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"}'
5. Direct ONNX Runtime (Python / C++ / Rust)
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])
Training Hyperparameters
- Base Architecture:
google/embeddinggemma-2 - Training Epochs: 3
- Batch Size: 64 (with hard in-batch negatives)
- Loss Formulation:
MultipleNegativesRankingLosswrapped inMatryoshkaLoss([768, 512, 256, 128]) - Learning Rate: 2e-5 with 10% linear warmup
- Optimizer: AdamW (
weight_decay=0.01) - Hardware Acceleration: Pure
bfloat16on NVIDIA RTX A6000 48GB VRAM (Ubuntu 24.04 LTS)
The Complete Tabman AI Model Matrix
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) |
Citation & Project Reference
@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).
- Downloads last month
- 35
Model tree for Anshulgada/tabman-embeddinggemma-2-270m
Base model
google/embeddinggemma-2