File size: 1,568 Bytes
3df247d
 
 
ea04aae
 
 
 
3df247d
 
ea04aae
3df247d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27c1242
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
library_name: pytorch
tags:
- table-retrieval
- embedding-adapter
- centroid-adapter
license: mit
---

# Centroid Adapter  — mpnet

Lightweight **BottleneckResidualAdapter** trained on top of
[mpnet](https://huggingface.co/mpnet) embeddings to produce
representation-invariant table embeddings.

## Architecture

```
z = e + α · Up( Dropout( GELU( Down( LN(e) ) ) ) )
```

| Hyperparameter | Value |
|---|---|
| Embedding dim `d` | 768 |
| Bottleneck rank `r` | 512 |
| Residual scale `α` | 0.01 |
| Use bias | True |

Trained on: WTQ, WIKISQL

## Usage

```python
import torch
from huggingface_hub import hf_hub_download
import json

# --- option A: use the from_pretrained helper in this repo ---
# (copy BottleneckResidualAdapter + from_pretrained from push_to_hub.py)
adapter = BottleneckResidualAdapter.from_pretrained("KBhandari11/centroid-adapter-subset-mpnet")
e = torch.randn(1, 768)   # your backbone embedding
z = adapter(e)                    # representation-invariant embedding

# --- option B: hf_hub_download one-liner ---
from safetensors.torch import load_file
weights_path = hf_hub_download("KBhandari11/centroid-adapter-subset-mpnet", "model.safetensors")
cfg_path     = hf_hub_download("KBhandari11/centroid-adapter-subset-mpnet", "config.json")
with open(cfg_path) as f:
    cfg = json.load(f)
adapter = BottleneckResidualAdapter(**cfg)
adapter.load_state_dict(load_file(weights_path))
adapter.eval()
```


# Research Paper

[Improving Robustness of Tabular Retrieval via Representational Stability](https://arxiv.org/abs/2604.24040v2)