Downloads · 30 days
0
Aygun/llama-query-expansion-finetuned
llama-query-expansion-finetuned is a machine learning model from Aygun. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers.
This model is a fine-tuned version of meta-llama/Llama-3.2-1B-Instruct that has been optimized for query expansion and optimization tasks. It is designed to improve search query performance in multimedia applications…
Downloads · 30 days
0
Access
Public
Updated Apr 3, 2025
Repo size
30.9 MB
Likes
0
Public
Click a slice to open those files.
.json17.3 MB · 56%
From the Hugging Face model README
This model is a fine-tuned version of meta-llama/Llama-3.2-1B-Instruct that has been optimized for query expansion and optimization tasks. It is designed to improve search query performance in multimedia applications by generating expanded or reformulated queries from a given input.
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
This model can be used to optimize and expand user queries to improve search performance. It is particularly useful in systems where query understanding and expansion can enhance retrieval accuracy.
The fine-tuned model can be integrated into larger systems, for example:
Bias:
The model may reflect biases present in the training data. Users should be cautious of potential overgeneralizations or biased query expansions.
Risks:
Generated query expansions may sometimes include irrelevant or redundant information. It is recommended to review outputs before deploying them in high-stakes applications.
Limitations:
Users (both direct and downstream) should be made aware of the risks, biases, and limitations of the model. It is recommended to implement post-processing steps to filter or verify the generated queries before using them in production.
To use the model, install the transformers library and load the model using the code below:
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("Aygun/llama-query-expansion-finetuned")
tokenizer = AutoTokenizer.from_pretrained("Aygun/llama-query-expansion-finetuned")
prompt = "Generate an optimized version of this query: healthy breakfast ideas"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=50)
optimized_query = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(optimized_query)
The model was fine-tuned on the s-emanuilov/query-expansion dataset available on Hugging Face. This dataset consists of query-expansion pairs where each sample includes:
This dataset was curated to reflect realistic search queries and their corresponding expansions, making it well-suited for training models aimed at query optimization.
The model was fine-tuned using the LoRA (Low-Rank Adaptation) technique.
Preprocessing
Data was preprocessed to create prompt–completion pairs where:
Prompt: "Generate expanded versions of this query: <query>\n\nExpanded queries:"
Completion: A formatted list of expanded queries.
- Base Model: meta-llama/Llama-3.2-1B-Instruct
- LoRA Rank: 16
- lora_alpha: 32
- Target Modules: ["q_proj", "k_proj", "v_proj", "o_proj"]
- LoRA Dropout: 0.05
- Number of Epochs: 3
- Per Device Batch Size: 2
- Gradient Accumulation Steps: 4
- Learning Rate: 2e-4
- Warmup Steps: 100
- Mixed Precision: Enabled (fp16)
Bibtex:
@misc{llama_query_expansion_finetuned,
title={Llama Query Expansion Fine-Tuned},
author={Aygün Varol},
note={Fine-tuned version of meta-llama/Llama-3.2-1B-Instruct using LoRA for query expansion.},
year={2025}}
APA:
Aygün Varol (2025). Llama Query Expansion Fine-Tuned (Fine-tuned version of meta-llama/Llama-3.2-1B-Instruct using LoRA for query expansion). Retrieved from Hugging Face Hub.