1from sentence_transformers import SentenceTransformer
23# Download from the 🤗 Hub4model = SentenceTransformer("ronit01/rag_tuned_minilm_mnr_10")5# Run inference6sentences =[7"What is the difference between distributive and algebraic metrics in RapidFire AI's online aggregation for evals?",8'Types of Metrics\n-----------------------\n\nWe support 2 types of metrics based on their aggregation semantics: \n\n* **Distributive Metrics:** These are purely additive over a given set of data points. \n \n Examples: *count* of number of correct predictions; *sum* of output token lengths across queries.\n\n* **Algebraic Metrics:** These are averages or proportions over a given set of data points. They can be decomposed into components that are individually distributive. \n \n Examples: *precision*, which counts number of correct predictions and total number of data points separately and then divides them; *mean rouge-1*, which averages per-example rouge-1 values that assesses overlap of tokens between generated text and ground truth text.\n\nWhen you define an eval metric via :func:`evals.compute_metrics_fn()` and :func:`evals.accumulate_metrics_fn()`, \nyou must specify their type (algebraic or distributive) and value range as illustrated below. \nFor metrics without a type defined, they will be displayed *as is*, i.e., without projected \nestimates or confidence intervals.',9'RapidFire AI offers a browser-based dashboard to automatically visualize all ML metrics and lets \nyou control runs on the fly from there. \nOur current default dashboard is a fork of the popular OSS tool `MLflow <https://mlflow.org/>`__, \nand it inherits much of MLflow\'s native features.\nThe dashboard URI is printed when the rapidfireai server is started; open it in a browser. \n\nAs of this writing, apart from MLflow, RapidFire AI also supports \n`TensorBoard <https://www.tensorflow.org/tensorboard>`__\nand `Trackio <https://huggingface.co/docs/trackio/en/index>`__\nfor logging metrics plots. \nSpecify any one, two, or all three dashboards to use with the following server start argument. \n\n.. code-block:: bash\n\n rapidfireai start --tracking-backends [mlflow | tensorboard | trackio]\n\nAlternatively, set the dashboard using its environment variable as below in your python code/notebook:\n\n.. code-block:: python\n\n os.environ["RF_MLFLOW_ENABLED"] = "true"\n os.environ["RF_TENSORBOARD_ENABLED"] = "true"\n os.environ["RF_TRACKIO_ENABLED"] = "true"\n\nSupport for other popular dashboards such as Weights & Biases and CometML is coming soon. \nThe rest of this section explains the new features of our MLflow-fork dashboard.\nNote that these new features are not yet available on the other dashboards.',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.6788, 0.1914],19# [0.6788, 1.0000, 0.2678],20# [0.1914, 0.2678, 1.0000]])
Training Details
Training Dataset
Unnamed Dataset
Size: 52 training samples
Columns: sentence_0 and sentence_1
Approximate statistics based on the first 52 samples:
sentence_0
sentence_1
type
string
string
details
min: 11 tokens
mean: 24.87 tokens
max: 34 tokens
min: 31 tokens
mean: 216.15 tokens
max: 256 tokens
Samples:
sentence_0
sentence_1
Why does RapidFire AI argue that simply downsampling the evaluation data is insufficient compared to its online aggregation approach?
Why Not Just Downsample?[object Object]------------------------[object Object][object Object]One might wonder why downsampling the eval set does not suffice here. [object Object]:doc:[object Object], downsampling alone has [object Object]significant disadvantages compared to the approach offered by RapidFire AI. [object Object][object Object]First, you have to decide a downsample size upfront, which is not trivial if your[object Object]eval metrics have high variance across examples. Point estimates without confidence [object Object]intervals can give false confidence in a sample. You can resample manually [object Object]over and over, but that adds manual grunt work of juggling separate samples/files. [object Object]Finally, downsampling alone does not offer you the power of IC Ops and automated [object Object]parallelization to try new configs on the fly--you'd have reimplement those manually.[object Object][object Object]RapidFire AI's online aggregation approach with IC Ops avoids all the above issues,[object Object]while also being [object Object] to downsampling, i.e., you can use both in [object Object]conjunction for even lower runtimes/costs.
What is online aggregation in the context of RapidFire AI evals, and what three confidence interval strategies does it support?
RapidFire AI transforms the status quo by adapting the powerful idea of [object Object]
from database systems research to LLM evals.
Our adaptive execution engine, :doc:as described on this page</difference>, automatically
shards the data and processes multiple configs in parallel, one shard at a time, with
efficient swapping techniques.
This means you get running metric estimates with confidence intervals in real time.
So, you can confidently stop poor configs earlier, clone better configs on the fly, and
perform more informed exploration to reach much better eval metrics in much less time.
Example: Traditional Batch Evals vs. RapidFire AI
For instance, suppose you have an evals set with 400 queries. You decide to compare, say,
4 RAG configs in one go with RapidFire AI with number of shards set to 8. The illustration
below contrasts traditional batch evals vs. RapidFire AI's approach for a simple eval metric.
.. list-table::
:widths: 50 50
:class... |
| What arguments does the RFModelConfig class accept for defining a model configuration in RapidFire AI? | RFModelConfig
:param model_name: Model identifier for use with Hugging Face's :code:[object Object]. Can be a Hugging Face model hub name (e.g., ``"Qwen/Qwen2.5-7B-Instruct... |
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}