The 360Zhinao Search Model, developed by Qihoo 360, is a powerful tool that leverages a self-developed BERT model optimized for multi-task fine-tuning. This guide walks you through how to utilize this model for retrieval tasks effectively, using its remarkable performance on the C-MTEB-Retrieval benchmark as a foundation.
Why Use 360Zhinao Search Model?
This model is not just another tool in the vast ocean of artificial intelligence; it’s like a finely-tuned instrument in the hands of a skilled musician. With an average retrieval score of 75.05, it currently ranks first on the C-MTEB-Retrieval leaderboard. Imagine it as a super detective that sifts through vast amounts of information, understanding nuances and providing the best answers to queries.
Setting Up the Model
To get started, follow these steps for setup and usage:
- Ensure you have Python installed along with the necessary libraries, including
transformersandtorch. - Use the following snippet to load the model:
from transformers import AutoModel, AutoTokenizer
import torch
import numpy as np
tokenizer = AutoTokenizer.from_pretrained("qihoo360/360Zhinao-search")
model = AutoModel.from_pretrained("qihoo360/360Zhinao-search")
Using the Model for Retrieval
Once the model is loaded, you’ll want to run queries against it. Here’s an analogy: think of the model as a library—every time you ask a question (a query), the library (the model) fetches the best books (results) that match your inquiry. Here’s how you can implement this:
sentences = ["Your query string here", "Another query string here"]
inputs = tokenizer(sentences, padding=True, truncation=True, return_tensors="pt", max_length=512)
if __name__ == "__main__":
with torch.no_grad():
last_hidden_state = model(**inputs, return_dict=True).last_hidden_state
embeddings = last_hidden_state[:, 0]
embeddings = torch.nn.functional.normalize(embeddings, dim=-1)
embeddings = embeddings.cpu().numpy()
print(embeddings)
cos_sim = np.dot(embeddings[0], embeddings[1])
print(cos_sim)
This code takes your input queries, processes them, and returns a cosine similarity score indicating how closely related the two sentences are.
Evaluating the Model’s Performance
The model is evaluated based on multiple metrics such as MAP (Mean Average Precision) and MRR (Mean Reciprocal Rank). Think of these metrics as report cards that show how well your library is performing—higher scores indicate more accurate and relevant retrievals.
Troubleshooting Common Issues
As with any complex system, you may encounter some issues. Here are some common problems and how to resolve them:
- Model Loading Errors: If you face issues loading the model, ensure that you have an active internet connection and the model name is correctly specified.
- Input Size Issues: If your input exceeds the maximum token length (512), consider truncating or splitting your input appropriately.
- CUDA Errors: If you’re using a GPU and encounter CUDA-related errors, make sure that CUDA is properly installed and configured.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Conclusion
Incorporating the 360Zhinao Search Model into your retrieval tasks can significantly enhance the accuracy and efficiency of your data-driven projects. Make sure to keep experimenting with different queries to uncover the model’s full potential.
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

