Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

feat: Add xbench-DeepSearch benchmark dataset integration

LearningCircuit9126521ebae5
diff --git a/src/local_deep_research/benchmarks/__init__.py b/src/local_deep_research/benchmarks/__init__.py
index 76156d9a5d..572e027c8c 100644
--- a/src/local_deep_research/benchmarks/__init__.py
+++ b/src/local_deep_research/benchmarks/__init__.py
@@ -29,6 +29,7 @@ from .runners import (
run_benchmark,
run_browsecomp_benchmark,
run_simpleqa_benchmark,
+ run_xbench_deepsearch_benchmark,
)
__all__ = [
@@ -36,6 +37,7 @@ __all__ = [
"run_benchmark",
"run_simpleqa_benchmark",
"run_browsecomp_benchmark",
+ "run_xbench_deepsearch_benchmark",
"load_dataset",
"get_available_datasets",
"calculate_metrics",
diff --git a/src/local_deep_research/benchmarks/benchmark_functions.py b/src/local_deep_research/benchmarks/benchmark_functions.py
index a055c7565d..ba8d59a4af 100644
--- a/src/local_deep_research/benchmarks/benchmark_functions.py
+++ b/src/local_deep_research/benchmarks/benchmark_functions.py
@@ -196,6 +196,99 @@ def evaluate_browsecomp(
return results
+def evaluate_xbench_deepsearch(
+ num_examples: int = 100,
+ search_iterations: int = 4,
+ questions_per_iteration: int = 3,
+ search_tool: str = "searxng",
+ human_evaluation: bool = False,
+ evaluation_model: Optional[str] = None,
+ evaluation_provider: Optional[str] = None,
+ output_dir: str = "benchmark_results",
+ search_model: Optional[str] = None,
+ search_provider: Optional[str] = None,
+ endpoint_url: Optional[str] = None,
+ search_strategy: str = "source_based",
+) -> Dict[str, Any]:
+ """
+ Run xbench-DeepSearch benchmark evaluation.
+
+ Args:
+ num_examples: Number of examples to evaluate (default 100 - full dataset)
+ search_iterations: Number of search iterations per query
+ questions_per_iteration: Number of questions per iteration
+ search_tool: Search engine to use
+ human_evaluation: Whether to use human evaluation
+ evaluation_model: Optional custom model for evaluation
+ evaluation_provider: Optional custom provider for evaluation
+ output_dir: Directory to save results
+ search_model: Optional model to use for the search system
+ search_provider: Optional provider to use for the search system
+ endpoint_url: Optional endpoint URL for API services
+ search_strategy: Search strategy to use
+
+ Returns:
+ Dictionary with benchmark results
+ """
+ logger.info(
+ f"Starting xbench-DeepSearch benchmark with {num_examples} examples"
+ )
+
+ # Import the runner
+ from ..benchmarks import run_xbench_deepsearch_benchmark
+
+ # Set up search configuration
+ search_config = {
+ "iterations": search_iterations,
+ "questions_per_iteration": questions_per_iteration,
+ "search_tool": search_tool,
+ "search_strategy": search_strategy,
+ }
+
+ # Add model configurations if provided
+ if search_model:
+ search_config["model_name"] = search_model
+ if search_provider:
+ search_config["provider"] = search_provider
+ if endpoint_url:
+ search_config["openai_endpoint_url"] = endpoint_url
+
+ # Check settings for additional configuration
+ if env_model := get_setting_from_snapshot("llm.model"):
+ search_config["model_name"] = env_model
+ if env_provider := get_setting_from_snapshot("llm.provider"):
+ search_config["provider"] = env_provider
+ if env_url := get_setting_from_snapshot("llm.openai_endpoint.url"):
+ search_config["openai_endpoint_url"] = env_url
+
+ # Set up evaluation configuration if needed
+ evaluation_config = None
+ if evaluation_model or evaluation_provider:
+ evaluation_config = {
+ "temperature": 0 # Always use zero temperature for evaluation
+ }
+ if evaluation_model:
+ evaluation_config["model_name"] = evaluation_model
+ if evaluation_provider:
+ evaluation_config["provider"] = evaluation_provider
+ # Add OpenRouter URL if using openai_endpoint
+ if evaluation_provider == "openai_endpoint":
+ evaluation_config["openai_endpoint_url"] = (
+ "https://openrouter.ai/api/v1"
+ )
+
+ # Run the benchmark
+ results = run_xbench_deepsearch_benchmark(
+ num_examples=num_examples,
+ output_dir=output_dir,
+ search_config=search_config,
+ evaluation_config=evaluation_config,
+ human_evaluation=human_evaluation,
+ )
+
+ return results
+
+
def get_available_benchmarks() -> List[Dict[str, str]]:
"""
Get information about available benchmarks.
@@ -216,6 +309,12 @@ def get_available_benchmarks() -> List[Dict[str, str]]:
"description": "Benchmark for web browsing comprehension",
"recommended_examples": 100,
},
+ {
+ "id": "xbench_deepsearch",
+ "name": "xbench-DeepSearch",
+ "description": "Deep research and search capability evaluation",
+ "recommended_examples": 100,
+ },
]
diff --git a/src/local_deep_research/benchmarks/datasets/__init__.py b/src/local_deep_research/benchmarks/datasets/__init__.py
index 1915a36d2b..6f23eec131 100644
--- a/src/local_deep_research/benchmarks/datasets/__init__.py
+++ b/src/local_deep_research/benchmarks/datasets/__init__.py
@@ -8,15 +8,18 @@ benchmark datasets in a maintainable, extensible way.
from .base import DatasetRegistry
from .browsecomp import BrowseCompDataset
from .simpleqa import SimpleQADataset
+from .xbench_deepsearch import XBenchDeepSearchDataset
# Register datasets
DatasetRegistry.register(SimpleQADataset)
DatasetRegistry.register(BrowseCompDataset)
+DatasetRegistry.register(XBenchDeepSearchDataset)
# Add convenience functions mirroring the old interface
DEFAULT_DATASET_URLS = {
"simpleqa": SimpleQADataset.get_default_dataset_path(),
"browsecomp": BrowseCompDataset.get_default_dataset_path(),
+ "xbench_deepsearch": XBenchDeepSearchDataset.get_default_dataset_path(),
}
diff --git a/src/local_deep_research/benchmarks/datasets/xbench_deepsearch.py b/src/local_deep_research/benchmarks/datasets/xbench_deepsearch.py
new file mode 100644
index 0000000000..3228656dd4
--- /dev/null
+++ b/src/local_deep_research/benchmarks/datasets/xbench_deepsearch.py
@@ -0,0 +1,235 @@
+"""
+xbench-DeepSearch dataset implementation.
+
+This module provides a class for the xbench-DeepSearch benchmark dataset,
+which evaluates deep research and search capabilities.
+"""
+
+import base64
+from typing import Any, Dict, List, Optional
+from loguru import logger
+from .base import BenchmarkDataset
+
+
+class XBenchDeepSearchDataset(BenchmarkDataset):
+ """xbench-DeepSearch benchmark dataset for deep research evaluation."""
+
+ @staticmethod
+ def xor_decrypt(data: bytes, key: str) -> bytes:
+ """XOR decrypt data with a key."""
+ key_bytes = key.encode("utf-8")
+ key_length = len(key_bytes)
+ return bytes(
+ [data[i] ^ key_bytes[i % key_length] for i in range(len(data))]
+ )
+
+ @classmethod
+ def get_dataset_info(cls) -> Dict[str, str]:
+ """Get basic information about the dataset."""
+ return {
+ "id": "xbench_deepsearch",
+ "name": "xbench-DeepSearch",
+ "description": "Deep research and search capability evaluation (100 questions)",
+ "url": "https://huggingface.co/datasets/xbench/DeepSearch",
+ }
+
+ @classmethod
+ def get_default_dataset_path(cls) -> str:
+ """Get the default path for the dataset."""
+ return "xbench/DeepSearch" # Hugging Face dataset identifier
+
+ def load(
+ self,
+ dataset_path: str = None,
+ num_examples: Optional[int] = None,
+ seed: int = 42,
+ ) -> List[Dict[str, Any]]:
+ """Override load to handle HuggingFace datasets directly.
+
+ Args:
+ dataset_path: Path to dataset (defaults to HuggingFace)
+ num_examples: Optional number of examples to limit
+ seed: Random seed for sampling
+
+ Returns:
+ List of processed dataset examples
+ """
+ import random
+
+ # Load the data
+ data = self.load_data(dataset_path)
+
+ # Sample if requested
+ if num_examples and len(data) > num_examples:
+ random.seed(seed)
+ data = random.sample(data, num_examples)
+
+ # Process each example
+ return [self.process_example(item) for item in data]
+
+ def load_data(self, dataset_path: str = None) -> List[Dict[str, Any]]:
+ """Load the xbench-DeepSearch dataset from Hugging Face.
+
+ Args:
+ dataset_path: Path to dataset (defaults to Hugging Face)
+
+ Returns:
+ List of questions from xbench-DeepSearch
+ """
+ try:
+ from datasets import load_dataset
+ except ImportError:
+ logger.exception(
+ "datasets library not installed. Run: pip install datasets"
+ )
+ # Fallback to direct download
+ return self._load_from_url()
+
+ dataset_path = dataset_path or self.get_default_dataset_path()
+
+ try:
+ logger.info(
+ f"Loading xbench-DeepSearch dataset from {dataset_path}"
+ )
+
+ # Load the dataset from Hugging Face (no authentication needed)
+ dataset = load_dataset(dataset_path, split="train")
+
+ # Format for our benchmark system and decrypt
+ formatted_questions = []
+ for item in dataset:
+ # Get the canary key for decryption
+ canary = item.get("canary", "")
+
+ # Decrypt prompt and answer if they're encrypted
+ prompt = item.get("prompt", "")
+ answer = item.get("answer", "")
+
+ try:
+ # Try to decrypt if it looks like base64
+ if prompt and all(
+ c
+ in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
+ for c in prompt[:100]
+ ):
+ decrypted_prompt = self.xor_decrypt(
+ base64.b64decode(prompt), canary
+ ).decode("utf-8")
+ prompt = decrypted_prompt
+
+ if answer and all(
+ c
+ in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
+ for c in answer[:100]
+ ):
+ decrypted_answer = self.xor_decrypt(
+ base64.b64decode(answer), canary
+ ).decode("utf-8")
+ answer = decrypted_answer
+ except Exception as e:
+ logger.warning(f"Failed to decrypt item: {e}")
+
+ formatted_item = {
+ "id": item.get("id", f"xbench_{len(formatted_questions)}"),
+ "problem": prompt,
+ "answer": answer,
+ "reference_steps": item.get("reference_steps", ""),
+ "canary": canary,
+ }
+ formatted_questions.append(formatted_item)
+
+ logger.info(
+ f"Loaded {len(formatted_questions)} questions from xbench-DeepSearch"
+ )
+ return formatted_questions
+
+ except Exception as e:
+ logger.warning(f"Failed to load via datasets library: {e}")
+ logger.info("Falling back to direct download")
+ return self._load_from_url()
+
+ def _load_from_url(self) -> List[Dict[str, Any]]:
+ """Load dataset directly from URL without datasets library."""
+ import pandas as pd
+
+ try:
+ # Direct URL to the CSV file on Hugging Face
+ url = "https://huggingface.co/datasets/xbench/DeepSearch/resolve/main/data/train-00000-of-00001.parquet"
+
+ logger.info(f"Downloading xbench-DeepSearch from {url}")
+ df = pd.read_parquet(url)
+
+ # Convert to list of dicts and decrypt
+ questions = []
+ for _, row in df.iterrows():
+ # Get the canary key for decryption
+ canary = row.get("canary", "")
+
+ # Decrypt prompt and answer
+ prompt = row.get("prompt", "")
+ answer = row.get("answer", "")
+
+ try:
+ if prompt and all(
+ c
+ in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
+ for c in prompt[:100]
+ ):
+ decrypted_prompt = self.xor_decrypt(
+ base64.b64decode(prompt), canary
+ ).decode("utf-8")
+ prompt = decrypted_prompt
+
+ if answer and all(
+ c
+ in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
+ for c in answer[:100]
+ ):
+ decrypted_answer = self.xor_decrypt(
+ base64.b64decode(answer), canary
+ ).decode("utf-8")
+ answer = decrypted_answer
+ except Exception as e:
+ logger.warning(f"Failed to decrypt item: {e}")
+
+ questions.append(
+ {
+ "id": row.get("id", f"xbench_{len(questions)}"),
+ "problem": prompt,
+ "answer": answer,
+ "reference_steps": row.get("reference_steps", ""),
+ "canary": canary,
+ }
+ )
+
+ logger.info(
+ f"Loaded {len(questions)} questions via direct download"
+ )
+ return questions
+
+ except Exception:
+ logger.exception("Failed to load dataset")
+ return []
+
+ def process_example(self, example: Dict[str, Any]) -> Dict[str, Any]:
+ """Process a single example from the dataset.
+
+ xbench-DeepSearch questions are designed for deep research evaluation.
+ """
+ processed = dict(example)
+
+ # Add evaluation metadata
+ processed["requires_deep_search"] = True
+ processed["expected_iterations"] = (
+ 4 # Deep search questions need multiple iterations
+ )
+
+ # Evaluation criteria for research questions
+ processed["evaluation_criteria"] = {
+ "accuracy": 0.4,
+ "completeness": 0.3,
+ "reasoning": 0.2,
+ "sources": 0.1, # Credit for citing sources
+ }
+
+ return processed
diff --git a/src/local_deep_research/benchmarks/runners.py b/src/local_deep_research/benchmarks/runners.py
index 572f35590d..a2ecaf6919 100644
--- a/src/local_deep_research/benchmarks/runners.py
+++ b/src/local_deep_research/benchmarks/runners.py
@@ -465,3 +465,21 @@ def run_browsecomp_benchmark(
return run_benchmark(
dataset_type="browsecomp", num_examples=num_examples, **kwargs
)
+
+
+def run_xbench_deepsearch_benchmark(
+ num_examples: int = 100, **kwargs
+) -> Dict[str, Any]:
+ """
+ Run xbench-DeepSearch benchmark with default settings.
+
+ Args:
+ num_examples: Number of examples to process
+ **kwargs: Additional arguments to pass to run_benchmark
+
+ Returns:
+ Dictionary with benchmark results
+ """
+ return run_benchmark(
+ dataset_type="xbench_deepsearch", num_examples=num_examples, **kwargs
+ )
diff --git a/src/local_deep_research/web/routes/benchmark_routes.py b/src/local_deep_research/web/routes/benchmark_routes.py
index 17c2554485..679c7a8617 100644
--- a/src/local_deep_research/web/routes/benchmark_routes.py
+++ b/src/local_deep_research/web/routes/benchmark_routes.py
@@ -14,6 +14,7 @@ from ...api.benchmark_functions import (
compare_configurations,
evaluate_browsecomp,
evaluate_simpleqa,
+ evaluate_xbench_deepsearch,
get_available_benchmarks,
)
@@ -43,6 +44,8 @@ def run_benchmark_task(job_id, benchmark_type, params, callback=None):
result = evaluate_simpleqa(**params)
elif benchmark_type == "browsecomp":
result = evaluate_browsecomp(**params)
+ elif benchmark_type == "xbench_deepsearch":
+ result = evaluate_xbench_deepsearch(**params)
elif benchmark_type == "compare":
result = compare_configurations(**params)
else:
@@ -66,7 +69,7 @@ def run_benchmark_task(job_id, benchmark_type, params, callback=None):
def benchmark_dashboard():
"""Render benchmark dashboard."""
return render_template(
- "benchmark/dashboard.html", benchmarks=get_available_benchmarks()
+ "pages/benchmark.html", benchmarks=get_available_benchmarks()
)
@@ -102,12 +105,14 @@ def run_benchmark_endpoint():
params["evaluation_provider"] = data["evaluation_provider"]
# Store job info
+ import time
+
running_jobs[job_id] = {
"id": job_id,
"benchmark_type": benchmark_type,
"params": params,
"status": "pending",
- "start_time": import_time().time(),
+ "start_time": time.time(),
}
# Start job in background thread
@@ -136,7 +141,9 @@ def benchmark_status(job_id):
# Calculate runtime if job is running
if job["status"] == "running":
- job["runtime"] = import_time().time() - job["start_time"]
+ import time
+
+ job["runtime"] = time.time() - job["start_time"]
return jsonify(job)
@@ -213,14 +220,6 @@ def get_benchmark_config():
)
-# Utility function for importing time dynamically to avoid circular imports
-def import_time():
- """Import time module dynamically."""
- import time
-
- return time
-
-
# Function to register routes with the main app
def register_blueprint(app):
"""Register benchmark routes with the Flask app."""
diff --git a/src/local_deep_research/web/templates/pages/benchmark.html b/src/local_deep_research/web/templates/pages/benchmark.html
index c92f98a365..61d23def01 100644
--- a/src/local_deep_research/web/templates/pages/benchmark.html
+++ b/src/local_deep_research/web/templates/pages/benchmark.html
@@ -663,6 +663,31 @@
</div>
</div>
+ <!-- xbench-DeepSearch Dataset -->
+ <div class="dataset-config" style="border: 1px solid #4caf50;">
+ <div class="dataset-header">
+ <div>
+ <h3 style="color: #4caf50;">xbench-DeepSearch</h3>
+ <p>100 deep research questions requiring multi-step information seeking</p>
+ <div style="background: rgba(76, 175, 80, 0.1); border: 1px solid rgba(76, 175, 80, 0.3); color: #4caf50; padding: 8px 10px; border-radius: 4px; margin-top: 8px; font-size: 0.85rem;">
+ <i class="fas fa-info-circle"></i> <strong>New:</strong> Advanced benchmark for testing deep research capabilities
+ </div>
+ </div>
+ <div class="dataset-toggle">
+ <input type="checkbox" id="xbench_deepsearch_enabled">
+ <label for="xbench_deepsearch_enabled">Enable</label>
+ </div>
+ </div>
+ <div class="form-group">
+ <label for="xbench_deepsearch_count">Number of Examples</label>
+ <input type="number" id="xbench_deepsearch_count"
+ name="xbench_deepsearch_count" value="10"
+ min="1" max="100"
+ class="ldr-form-control" disabled>
+ <span class="input-help">100 challenging research questions available</span>
+ </div>
+ </div>
+
<!-- BrowseComp Dataset -->
<div class="dataset-config" style="border: 2px solid #f44336; background: #2a1e1e;">
<div class="dataset-header">
@@ -1061,6 +1086,18 @@ function initializeBenchmarkForm() {
updateConfigSummary();
});
+ // xbench-DeepSearch toggle
+ document.getElementById('xbench_deepsearch_enabled').addEventListener('change', function() {
+ const countInput = document.getElementById('xbench_deepsearch_count');
+ countInput.disabled = !this.checked;
+ if (!this.checked) {
+ countInput.value = 0; // Reset to 0 when disabled
+ } else {
+ countInput.value = 10; // Set default when enabled
+ }
+ updateConfigSummary();
+ });
+
// BrowseComp toggle - enable/disable count input when checkbox is toggled
document.getElementById('browsecomp_enabled').addEventListener('change', function() {
const countInput = document.getElementById('browsecomp_count');
@@ -1077,11 +1114,13 @@ function initializeBenchmarkForm() {
function updateConfigSummary() {
const simpleqaEnabled = document.getElementById('simpleqa_enabled').checked;
+ const xbenchEnabled = document.getElementById('xbench_deepsearch_enabled').checked;
const browsecompEnabled = document.getElementById('browsecomp_enabled').checked;
const simpleqaCount = simpleqaEnabled ? parseInt(document.getElementById('simpleqa_count').value) || 0 : 0;
+ const xbenchCount = xbenchEnabled ? parseInt(document.getElementById('xbench_deepsearch_count').value) || 0 : 0;
const browsecompCount = browsecompEnabled ? parseInt(document.getElementById('browsecomp_count').value) || 0 : 0;
- const totalExamples = simpleqaCount + browsecompCount;
+ const totalExamples = simpleqaCount + xbenchCount + browsecompCount;
document.getElementById('total-examples').textContent = totalExamples;
// Estimate time (roughly 1-2 minutes per example)
@@ -1119,6 +1158,7 @@ function validateConfiguration() {
function getConfigurationData() {
const simpleqaEnabled = document.getElementById('simpleqa_enabled').checked;
+ const xbenchEnabled = document.getElementById('xbench_deepsearch_enabled').checked;
const browsecompEnabled = document.getElementById('browsecomp_enabled').checked;
const datasets_config = {};
@@ -1127,6 +1167,11 @@ function getConfigurationData() {
count: parseInt(document.getElementById('simpleqa_count').value) || 0
};
}
+ if (xbenchEnabled) {
+ datasets_config.xbench_deepsearch = {
+ count: parseInt(document.getElementById('xbench_deepsearch_count').value) || 0
+ };
+ }
if (browsecompEnabled) {
datasets_config.browsecomp = {
count: parseInt(document.getElementById('browsecomp_count').value) || 0