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.

fix(benchmark): quote + escape free-form string fields in YAML export (#4583)

LearningCircuit27c0e143878f
diff --git a/changelog.d/+benchmark-yaml-escape.bugfix.md b/changelog.d/+benchmark-yaml-escape.bugfix.md
new file mode 100644
index 0000000000..55ecb657a1
--- /dev/null
+++ b/changelog.d/+benchmark-yaml-escape.bugfix.md
@@ -0,0 +1 @@
+**Benchmark YAML exports now quote and escape free-form string fields** (`model`, `model_provider`, `search_engine`, `dataset`, and the evaluator's `model`/`provider`/`endpoint_url`). They were previously interpolated raw, so a value containing a YAML-special character — a colon-space, `#`, quote, or newline — could produce malformed YAML (or inject an unintended key). These fields now go through the existing `yamlEscape()` helper, matching how the settings-snapshot block already serializes strings. Numeric fields and the controlled-format `date_tested`/`ldr_version` are left as-is.
diff --git a/src/local_deep_research/web/templates/pages/benchmark_results.html b/src/local_deep_research/web/templates/pages/benchmark_results.html
index ceee22481f..8ae5888034 100644
--- a/src/local_deep_research/web/templates/pages/benchmark_results.html
+++ b/src/local_deep_research/web/templates/pages/benchmark_results.html
@@ -704,16 +704,19 @@ async function downloadBenchmarkYAML(runId, includeExamples = false, includeSett
const provider = (run.search_config?.provider || '').toLowerCase();
const isLocalProvider = ['ollama', 'llamacpp', 'lmstudio'].includes(provider);
- // Build evaluator section from evaluation_config (only safe keys, never API keys)
+ // Build evaluator section from evaluation_config (only safe keys, never API keys).
+ // Free-form string values are double-quoted + yamlEscape()d so a model
+ // name / provider / URL containing YAML-special chars (':', '#', quotes…)
+ // can't produce malformed YAML.
const evalConfig = run.evaluation_config || {};
let evaluatorYaml = 'evaluator:\n';
- if (evalConfig.model_name) evaluatorYaml += ` model: ${evalConfig.model_name}\n`;
- if (evalConfig.provider) evaluatorYaml += ` provider: ${evalConfig.provider}\n`;
+ if (evalConfig.model_name) evaluatorYaml += ` model: "${yamlEscape(evalConfig.model_name)}"\n`;
+ if (evalConfig.provider) evaluatorYaml += ` provider: "${yamlEscape(evalConfig.provider)}"\n`;
// The eval endpoint URL can be a private/internal host, so gate it
// behind the settings opt-in (same as the settings snapshot below).
// The default summary download stays shareable without leaking an
// internal URL; opting in includes it for full reproducibility.
- if (includeSettings && evalConfig.openai_endpoint_url) evaluatorYaml += ` endpoint_url: ${evalConfig.openai_endpoint_url}\n`;
+ if (includeSettings && evalConfig.openai_endpoint_url) evaluatorYaml += ` endpoint_url: "${yamlEscape(evalConfig.openai_endpoint_url)}"\n`;
if (evalConfig.temperature !== undefined && evalConfig.temperature !== null) {
evaluatorYaml += ` temperature: ${evalConfig.temperature}\n`;
}
@@ -733,11 +736,11 @@ async function downloadBenchmarkYAML(runId, includeExamples = false, includeSett
const correctCount = run.overall_accuracy ? Math.round(run.overall_accuracy * evaluated / 100) : 0;
// Generate compact YAML — data only, no empty placeholders
- let yamlContent = `model: ${modelName}
-model_provider: ${run.search_config?.provider || 'unknown'}
-search_engine: ${run.search_config?.search_tool || 'unknown'}
+ let yamlContent = `model: "${yamlEscape(modelName)}"
+model_provider: "${yamlEscape(run.search_config?.provider || 'unknown')}"
+search_engine: "${yamlEscape(run.search_config?.search_tool || 'unknown')}"
${avgSearchResults !== 'N/A' ? `average_results_per_query: ${avgSearchResults}\n` : ''}results:
- dataset: ${datasetName}
+ dataset: "${yamlEscape(datasetName)}"
total_questions: ${evaluated}
${strategy}:
accuracy: "${run.overall_accuracy ? run.overall_accuracy.toFixed(1) : 0}% (${correctCount}/${evaluated})"