{"id":47851732,"url":"https://github.com/pisa-engine/ConstBERT","last_synced_at":"2026-05-05T08:00:52.574Z","repository":{"id":297497554,"uuid":"918137258","full_name":"pisa-engine/ConstBERT","owner":"pisa-engine","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-05T19:12:28.000Z","size":420,"stargazers_count":12,"open_issues_count":1,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2026-02-15T22:57:53.716Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pisa-engine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-17T10:19:35.000Z","updated_at":"2026-01-26T07:08:15.000Z","dependencies_parsed_at":"2025-06-05T20:35:25.486Z","dependency_job_id":null,"html_url":"https://github.com/pisa-engine/ConstBERT","commit_stats":null,"previous_names":["pisa-engine/constbert"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pisa-engine/ConstBERT","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pisa-engine%2FConstBERT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pisa-engine%2FConstBERT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pisa-engine%2FConstBERT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pisa-engine%2FConstBERT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pisa-engine","download_url":"https://codeload.github.com/pisa-engine/ConstBERT/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pisa-engine%2FConstBERT/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32640538,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"online","status_checked_at":"2026-05-05T02:00:06.033Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-03T22:00:28.539Z","updated_at":"2026-05-05T08:00:52.561Z","avatar_url":"https://github.com/pisa-engine.png","language":null,"funding_links":[],"categories":["Research Papers \u0026 Surveys"],"sub_categories":[],"readme":"# ConstBERT  \n## Efficient Constant-Space Multi-Vector Retrieval\n\n**Code coming soon!**\n\nThis repository contains the source code for the paper:  \n**Efficient Constant-Space Multi-Vector Retrieval**  \nby [Sean MacAvaney](https://macavaney.us/), [Antonio Mallia](https://antoniomallia.it), and [Nicola Tonellotto](https://tonellotto.github.io/), published at **ECIR 2025**.  \n📄 [Read the paper (PDF)](./ConstBERT.pdf)\n\n🏆 ConstBERT received the **Best Short Paper Honourable Mention** at **ECIR 2025**.\n\n---\n\n## 🔍 Overview\n\n**ConstBERT** (Constant-Space BERT) is a multi-vector retrieval model designed for efficient and effective passage retrieval. It modifies the ColBERT architecture by encoding documents into a *fixed number of learned embeddings*, significantly reducing index size and improving storage and OS paging efficiency — all while retaining high retrieval effectiveness.\n\n### Key Features:\n- Fixed-size document representation (e.g., 32 vectors per document)\n- Late interaction (MaxSim) for scoring\n- End-to-end training of a pooling mechanism\n- Comparable performance to ColBERT on MSMARCO and BEIR\n- Efficient indexing and storage\n\n---\n\n## 🔗 Model Access\n\nThe pretrained model is available on Hugging Face:  \n👉 [https://huggingface.co/pinecone/ConstBERT](https://huggingface.co/pinecone/ConstBERT)\n\n```python\nfrom transformers import AutoModel\nimport numpy as np\n\ndef max_sim(q: np.ndarray, d: np.ndarray) -\u003e float:\n    assert q.ndim == 2 and d.ndim == 2\n    scores = np.dot(d, q.T)\n    return float(np.sum(np.max(scores, axis=0)))\n\nmodel = AutoModel.from_pretrained(\"pinecone/ConstBERT\", trust_remote_code=True)\n\nqueries = [\"What is the capital of France?\", \"latest advancements in AI\"]\ndocuments = [\n    \"Paris is the capital and most populous city of France.\",\n    \"Artificial intelligence is rapidly evolving with new breakthroughs.\",\n    \"The Eiffel Tower is a famous landmark in Paris.\"\n]\n\nquery_embeddings = model.encode_queries(queries).numpy()\ndocument_embeddings = model.encode_documents(documents).numpy()\n\nprint(max_sim(query_embeddings[0], document_embeddings[0]) \u003e max_sim(query_embeddings[0], document_embeddings[1]))\n# Output: True\n```\n\n## 📦 Model Details\n\n- **Architecture**: BERT-based encoder with a learned pooling layer  \n- **Embedding size**: 128  \n- **Document vectors per passage**: 32  \n- **Interaction**: MaxSim between document and query embeddings\n\n### How it works\n\nConstBERT compresses token-level BERT embeddings into a *fixed number (C)* of document-level vectors using a learned linear projection. These vectors capture diverse semantic aspects of the document. Relevance is computed via a MaxSim operation between the query token embeddings and the fixed document vectors.\n\nThis design offers a trade-off between **storage/computation efficiency** and **retrieval effectiveness**, configurable by choosing the number of vectors `C`.\n\n---\n\nPlease cite the following paper if you use this code, or a modified version of it:\n```bibtex\n@article{constbert,\n  title={Efficient Constant-Space Multi-Vector Retrieval},\n  author={MacAvaney, Sean and Mallia, Antonio and Tonellotto, Nicola},\n  booktitle = {The 47th European Conference on Information Retrieval ({ECIR})},\n  year={2025}\n}\n```\n\n## 📎 Related Resources\n\n- 🔬 [ColBERT: Original Multi-vector Retrieval Framework](https://github.com/stanford-futuredata/ColBERT)  \n- 📝 [Pinecone Blog](https://www.pinecone.io/blog/cascading-retrieval-with-multi-vector-representations/)  \n- 🔗 [The Turing Post](https://www.turingpost.com/p/bert)\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpisa-engine%2FConstBERT","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpisa-engine%2FConstBERT","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpisa-engine%2FConstBERT/lists"}