---
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:10
- loss:CosineSimilarityLoss
base_model: sentence-transformers/all-MiniLM-L6-v2
widget:
- source_sentence: Find the most popular payment method used in 2024.
sentences:
- SELECT * FROM orders WHERE customer_id = 42;
- SELECT customer_id, COUNT(order_id) AS order_count FROM orders WHERE order_date
BETWEEN '2024-01-01' AND '2024-12-31' GROUP BY customer_id HAVING order_count
>= 3;
- SELECT payment_method, COUNT(*) AS usage_count FROM payments WHERE payment_date
BETWEEN '2024-01-01' AND '2024-12-31' GROUP BY payment_method ORDER BY usage_count
DESC LIMIT 1;
- source_sentence: Which products sold the most in 2024?
sentences:
- SELECT COUNT(*) AS total_orders FROM orders WHERE order_date >= DATE('now', '-6
months');
- SELECT p.category, SUM(oi.subtotal) AS total_revenue FROM order_items oi JOIN
products p ON oi.product_id = p.product_id GROUP BY p.category ORDER BY total_revenue
DESC LIMIT 3;
- SELECT product_id, SUM(quantity) AS total_sold FROM order_items JOIN orders ON
order_items.order_id = orders.order_id WHERE order_date BETWEEN '2024-01-01' AND
'2024-12-31' GROUP BY product_id ORDER BY total_sold DESC LIMIT 10;
pipeline_tag: sentence-similarity
library_name: sentence-transformers
---
# SentenceTransformer based on sentence-transformers/all-MiniLM-L6-v2
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2). It maps sentences & paragraphs to a 384-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
## Model Details
### Model Description
- **Model Type:** Sentence Transformer
- **Base model:** [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2)
- **Maximum Sequence Length:** 256 tokens
- **Output Dimensionality:** 384 dimensions
- **Similarity Function:** Cosine Similarity
### Model Sources
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
### Full Model Architecture
```
SentenceTransformer(
(0): Transformer({'max_seq_length': 256, 'do_lower_case': False}) with Transformer model: BertModel
(1): Pooling({'word_embedding_dimension': 384, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
(2): Normalize()
)
```
## Usage
### Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
```bash
pip install -U sentence-transformers
```
Then you can load this model and run inference.
```python
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("krishanusinha20/multi-agentic-sql-generator-model")
# Run inference
sentences = [
'Which products sold the most in 2024?',
"SELECT product_id, SUM(quantity) AS total_sold FROM order_items JOIN orders ON order_items.order_id = orders.order_id WHERE order_date BETWEEN '2024-01-01' AND '2024-12-31' GROUP BY product_id ORDER BY total_sold DESC LIMIT 10;",
"SELECT COUNT(*) AS total_orders FROM orders WHERE order_date >= DATE('now', '-6 months');",
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
```
## Training Details
### Training Dataset
#### Unnamed Dataset
* Size: 10 training samples
* Columns: sentence_0
, sentence_1
, and label
* Approximate statistics based on the first 10 samples:
| | sentence_0 | sentence_1 | label |
|:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:--------------------------------------------------------------|
| type | string | string | float |
| details |
Find the total revenue generated in 2024.
| SELECT SUM(total_amount) AS total_revenue FROM orders WHERE order_date BETWEEN '2024-01-01' AND '2024-12-31';
| 1.0
|
| Find the top 3 product categories with the highest sales revenue.
| SELECT p.category, SUM(oi.subtotal) AS total_revenue FROM order_items oi JOIN products p ON oi.product_id = p.product_id GROUP BY p.category ORDER BY total_revenue DESC LIMIT 3;
| 1.0
|
| How many orders were placed in the last 6 months?
| SELECT COUNT(*) AS total_orders FROM orders WHERE order_date >= DATE('now', '-6 months');
| 1.0
|
* Loss: [CosineSimilarityLoss
](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cosinesimilarityloss) with these parameters:
```json
{
"loss_fct": "torch.nn.modules.loss.MSELoss"
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `per_device_train_batch_size`: 4
- `per_device_eval_batch_size`: 4
- `num_train_epochs`: 5
- `multi_dataset_batch_sampler`: round_robin
#### All Hyperparameters