Sentence Similarity
sentence-transformers
Safetensors
bert
feature-extraction
Generated from Trainer
dataset_size:444
loss:ContrastiveLoss
text-embeddings-inference
Instructions to use ronit01/golden_rag_tuned_minilm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use ronit01/golden_rag_tuned_minilm with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("ronit01/golden_rag_tuned_minilm") sentences = [ "What is the default batch_size for vector store inserts in the vector_store_cfg of RFLangChainRagSpec?", "Postprocess Function\n--------------------\n\nOptional user-provided function to postprocess a batch of examples and their respective generated outputs, \nwhich is injected into this function by the system. \nThis is useful for, say, extracting structured information from generations, adding ground truth data, \nor performing any transformations needed before computing metrics.\n\nIt is invoked for each batch during the evaluation process after generation and before metric computation.\nPass it directly to the :code:`postprocess_fn` key in your eval config dictionary.\n", "End\n-------\n\nEnd the current experiment to clear out relevant system state and allow you to move on to a new experiment. \nPlease do *not* run this when a :func:`run_fit()` is still running. \n\n.. py:function:: end(self) -> None\n\n\t:return: None\n\t:rtype: None\n", "FiQA: RAG for Financial Opinion Q&A Chatbot\n=======================\n\nPlease check out the tutorial notebook on the link below. Right click on the GitHub link to save that file locally.\n\nRAG for financial opinion Q&A chatbot: `View on GitHub <https://github.com/RapidFireAI/rapidfireai/blob/main/tutorial_notebooks/rag-contexteng/rf-tutorial-rag-fiqa.ipynb>`__. \n\nThis use case notebook features an all-self-hosted open model workflow, with models from Hugging Face for both embedding and generation.\n\nOr run this pre-configured Google Colab notebook on your browser; no installation required on your machine: \n`RapidFire AI RAG on Google Colab <https://tinyurl.com/rapidfireai-rag-colab>`_\n\n\nTask, Dataset, and Prompt\n-------\n\nThis tutorial shows Retrieval-Augmented Generation (RAG) for creating a financial opinion Q&A chatbot.\n\nIt uses the \"FiQA\" dataset from the BEIR benchmark; \n`see its details here <https://sites.google.com/view/fiqa/>`__. \nThe dataset contains financial questions and a corpus of documents for retrieval.\n\nThe prompt format includes system instructions defining the assistant as a financial advisor \nand incorporates retrieved context along with user queries.\n\n\nModel, RAG Components, and Configuration Knobs\n-------\n\nWe compare 2 generator model sizes: Qwen2.5-0.5B-Instruct and Qwen2.5-3B-Instruct.\n\nThere are 2 different chunking strategies: 256-token chunks and 128-token chunks, both with \n32-token overlap using recursive character splitting with tiktoken encoding.\n\nThe RAG pipeline uses:\n\n- **Embeddings**: sentence-transformers/all-MiniLM-L6-v2 with GPU acceleration.\n- **Vector Store**: FAISS with GPU-based exact search, i.e., no ANN approximation.\n- **Retrieval**: Top-15 similarity search.\n- **Reranking**: cross-encoder/ms-marco-MiniLM-L6-v2 with 2 different top-n values: 2 and 5.\n\nAll other knobs are fixed across all configs. Thus, there are a total of 8 combinations launched \nwith a simple grid search: 2 generator models x 2 chunk sizes x 2 reranking top-n values.\n\n\nExternal Vector Stores: Pinecone and PGVector\n-------\n\nRapidFire AI also supports external persistent vector stores beyond the default in-memory FAISS.\nThis allows you to scale to larger corpora, persist indexes across runs and experiments, and leverage managed vector DBMS services.\nAs of this writing, **Pinecone** (hosted serverless or pod-based) and **PostgreSQL PGVector** (self-hosted or managed) are supported.\n\nEach external store supports three modes of operation:\n\n- **Create mode:** Build a new index from base documents from within RapidFire AI itself and use it for RAG.\n- **Read mode:** Retrieve from a pre-existing index and use it for RAG. \n- **Update mode:** Add new content to an existing index from additional base documents from within RapidFire AI itself and use it for RAG. \n\nSee the :doc:`API: LangChain RAG Spec page</ragspecs>` for more details on how to specify these external vector stores.\n\nThe FiQA RAG tutorial notebooks have also been extended to showcase the external stores as below:\n\n- **Pinecone**: `View on GitHub <https://github.com/RapidFireAI/rapidfireai/blob/main/tutorial_notebooks/rag-contexteng/rf-tutorial-rag-fiqa-pinecone.ipynb>`__\n- **PGVector**: `View on GitHub <https://github.com/RapidFireAI/rapidfireai/blob/main/tutorial_notebooks/rag-contexteng/rf-tutorial-rag-fiqa-pgvector.ipynb>`__" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
Ctrl+K