lemoelink/lemoe-query-distiller-dataset
Viewer • Updated • 1.04k • 6
This model is a fine-tuned version of microsoft/mdeberta-v3-base adapted for the Query Distillation task in Spanish. It operates via Token Classification, analyzing natural language queries and labeling each word to decide whether it should be kept as a key search term or discarded as syntactic noise.
It is specifically designed as an ultra-lightweight and fast filter to be integrated into RAG pipelines and document search systems (like Paperless-ngx) orchestrated through LEMoE.
es)microsoft/mdeberta-v3-baseSince it is an Encoder model, it does not generate new text (it is not autoregressive). Instead, it assigns a binary weight to each input token:
LABEL_1 (Keep): Entities, keywords, subjects, and services.LABEL_0 (Drop): Prepositions, generic action verbs, polite phrases, and connectors.Below is the Python code to instantiate the model and use it as a filter.
from transformers import pipeline
# Load the token classification pipeline
# Use aggregation_strategy="simple" to merge subwords
distiller = pipeline(
"token-classification",
model="your-username/mdeberta-v3-base-lemoe-query-distiller",
aggregation_strategy="simple"
)
def clean_search_query(user_input: str) -> str:
# Get model predictions
predictions = distiller(user_input)
# Filter and concatenate tokens labeled as LABEL_1
search_terms = [
entity['word'] for entity in predictions
if entity['entity_group'] == 'LABEL_1'
]
# Return the cleaned query
return " ".join(search_terms).strip()
# Usage example
query = "busca la factura de iberdrola de la luz de este mes"
result = clean_search_query(query)
print(f"Original query: {query}")
print(f"Distilled search: {result}")
Base model
microsoft/mdeberta-v3-base