1from sentence_transformers import SentenceTransformer
23# Download from the 🤗 Hub4model = SentenceTransformer("ronit01/rag_tuned_minilm_mnr_100epoch")5# Run inference6sentences =[7'What RAG components and configuration knobs does the SciFact tutorial use for scientific claim verification?',8'This use case notebook features an all-closed model API workflow, with Open AI calls used for both embedding for generation. So, you do not need a GPU to run this notebook.\n\n\nTask, Dataset, and Prompt\n-------\n\nThis tutorial shows Retrieval-Augmented Generation (RAG) for verifying scientific claims against evidence.\n\nIt uses the "SciFact" dataset from the BEIR benchmark; \n`see its details here <https://github.com/allenai/scifact>`__. \nThe dataset contains scientific claims that must be labeled as SUPPORT, CONTRADICT, or NOINFO based on retrieved evidence.\n\nThe prompt format includes system instructions defining the verification task with an example, \nretrieved evidence documents with titles, and the scientific claim to verify.\n\n\nModel, RAG Components, and Configuration Knobs\n-------\n\nWe compare 2 generator models via OpenAI API: gpt-5-mini and gpt-4o.\n\nThere are 2 different retrieval/search strategies: similarity search and maximum marginal relevance (MMR).\n\nThe RAG pipeline uses:\n\n- **Embeddings**: OpenAI text-embedding-3-small.\n- **Vector Store**: FAISS with CPU-based exact search, i.e., no ANN approximation.\n- **Chunking**: 512-token chunks with 32-token overlap using recursive character splitting with tiktoken encoding.\n- **Retrieval**: Top-15 initial retrieval.\n- **Reranking**: cross-encoder/ms-marco-MiniLM-L6-v2 with top-5 final documents.\n- **Document Template**: Custom template including document titles with content.\n\nAll other knobs are fixed across all configs. Thus, there are a total of 4 combinations launched \nwith a simple grid search: 2 generator models x 2 search strategies.',9'Port conflicts (services already running)\n----------------------------------------\n\nIf you encounter port conflicts, you can kill existing processes.\n\n.. code-block:: bash\n\n lsof -t -i:8852 | xargs kill -9 # mlflow\n lsof -t -i:8851 | xargs kill -9 # dispatcher\n lsof -t -i:8853 | xargs kill -9 # frontend server\n\nSelect specific GPU(s) to use\n-----------------------------\n\nSet the ``CUDA_VISIBLE_DEVICES`` environment variable BEFORE running ``rapidfireai start`` to control which GPU(s) RapidFire can see and use.\n\n.. code-block:: bash\n\n export CUDA_VISIBLE_DEVICES=2 # use GPU index 2 only\n rapidfireai start\n\nMultiple GPUs (example: GPUs 0 and 2):\n\n.. code-block:: bash\n\n export CUDA_VISIBLE_DEVICES=0,2\n rapidfireai start\n\nFrom a Python script (set before importing/starting RapidFire):\n\n.. code-block:: python\n\n import os\n os.environ["CUDA_VISIBLE_DEVICES"] = "2"\n # then start your RapidFire workflow\n',10]11embeddings = model.encode(sentences)12print(embeddings.shape)13# [3, 384]1415# Get the similarity scores for the embeddings16similarities = model.similarity(embeddings, embeddings)17print(similarities)18# tensor([[ 1.0000, 0.5354, -0.1518],19# [ 0.5354, 1.0000, 0.0280],20# [-0.1518, 0.0280, 1.0000]])
Training Details
Training Dataset
Unnamed Dataset
Size: 46 training samples
Columns: sentence_0 and sentence_1
Approximate statistics based on the first 46 samples:
sentence_0
sentence_1
type
string
string
details
min: 11 tokens
mean: 30.57 tokens
max: 48 tokens
min: 64 tokens
mean: 225.52 tokens
max: 256 tokens
Samples:
sentence_0
sentence_1
What are the four tabs on the main Experiments page of RapidFire AI's MLflow-fork dashboard?
The main "Experiments" page on the dashboard has 4 main tabs:
Table
Chart
Experiment Log
Interactive Control (IC) Log
The screenshot below shows the "Table" view of an experiment with all its runs.
Each run represents one model with one set of config knob values, which is standard dashboard semantics.
The screenshot below shows the "Chart" view of an experiment with all its runs.
Each plot corresponds to a metric, spanning :code:loss on the training set and evaluation set,
as well all named metrics returned in your :func:compute_metrics() function in the trainer config.
We call attention to 3 key aspects of the visualizations here:
The x-axis "Step" for the mini batch-level plots represents absolute number of minibatches seen by that run. So, if the :code:bat...</code> | | <code>What is the difference between RFGridSearch and RFRandomSearch in terms of how they handle knob values?</code> | <code>We currently support two common config group generators: :func:RFGridSearch() for grid search and :func:RFRandomSearch()` for random search.
More support for AutoML heuristics such as SHA, HyperOpt, as well as an integration with
the popular AutoML library Optuna are coming soon.
Likewise for RAG/context engineering, we also plan to support the AutoML heuristic syftr.
:param configs: A config dictionary with :func:List() for at least one knob; can be a list of such config dictionaries too.
:type configs: Dict[str, Any] | List[Dict[str, Any]]
:param trainer_type: The fine-tuning/post-training control flow to use: "SFT", "DPO", or "GRPO". Skip this argument for :func:run_evals().
:type trainer_type: str, optional
.. py:function:: RFRandomSearch(configs: Dict[str, Any], trainer_type: str = "SFT" | "DPO" | "GRPO" | None, num_runs: int, seed... |
| How does the compute_metrics function differ between the run_fit() (training) pipeline and the run_evals() pipeline in terms of its signature, invocation timing, and what it receives as input? | Eval Accumulate Metrics Function
[object Object]
[object Object]
[object Object]
:param aggregated_metrics: Dictionary with a metric's name as key and a list of per-batch metric dictionaries as values from across all data batches. Inside each value dictionary, at least the reserved key :code:[object Object] will exist t... |
1@inproceedings{reimers-2019-sentence-bert,
2 title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
3 author = "Reimers, Nils and Gurevych, Iryna",
4 booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
5 month = "11",
6 year = "2019",
7 publisher = "Association for Computational Linguistics",
8 url = "https://arxiv.org/abs/1908.10084",
9}
MultipleNegativesRankingLoss
bibtex
1@misc{oord2019representationlearningcontrastivepredictive,
2 title={Representation Learning with Contrastive Predictive Coding},
3 author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
4 year={2019},
5 eprint={1807.03748},
6 archivePrefix={arXiv},
7 primaryClass={cs.LG},
8 url={https://arxiv.org/abs/1807.03748},
9}