From 78489e41c472f2f4ef906f05e408783bf304caf6 Mon Sep 17 00:00:00 2001 From: Roland Tannous Date: Tue, 10 Mar 2026 16:07:30 +0000 Subject: [PATCH] =?UTF-8?q?refactor:=203-pass=20advisor=20=E2=80=94=20dedi?= =?UTF-8?q?cated=20system=20prompt=20generation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pass 1: Classify dataset type (unchanged) Pass 2: Generate user/assistant templates + label mapping + column roles (system_prompt removed from this pass to keep it focused) Pass 3: Generate system prompt (only for non-conversational datasets) - Dedicated pass with focused prompt that sees the templates from Pass 2 - Skipped entirely for conversational datasets - Produces specific, task-relevant system prompts --- studio/backend/utils/datasets/llm_assist.py | 76 +++++++++++++++------ 1 file changed, 57 insertions(+), 19 deletions(-) diff --git a/studio/backend/utils/datasets/llm_assist.py b/studio/backend/utils/datasets/llm_assist.py index ded4c49a00..b5f8ba6b35 100644 --- a/studio/backend/utils/datasets/llm_assist.py +++ b/studio/backend/utils/datasets/llm_assist.py @@ -538,15 +538,15 @@ def _run_multi_pass_advisor( ), } - # ── Pass 2: Conversion strategy ── - print("🤖 Pass 2: Generating conversion strategy...", flush=True) + # ── Pass 2: Conversion templates ── + print("🤖 Pass 2: Generating conversion templates...", flush=True) t2 = time.monotonic() messages2 = [ { "role": "system", "content": ( "You are a dataset conversion specialist for LLM fine-tuning. " - "You design strategies to convert non-conversational datasets into " + "You design templates to convert non-conversational datasets into " "user/assistant conversation format. Respond with ONLY valid JSON." ), }, @@ -561,9 +561,7 @@ def _run_multi_pass_advisor( SAMPLE DATA: {samples_text} - Design a conversion strategy to turn this into conversation format for fine-tuning. - The strategy should create a user message template and an assistant message template. - Optionally include a system prompt ONLY if the task is ambiguous from the data alone. + Design user and assistant message templates for this dataset. RULES: - Use {{column_name}} placeholders in templates to reference column values. @@ -575,13 +573,9 @@ def _run_multi_pass_advisor( - The assistant template should produce the expected model output. - column_roles: mark columns used in the user template as "user", columns used in the assistant template as "assistant". - - system_prompt: set to null if the user/assistant templates alone - make the task clear. Only provide one when extra context is needed - (e.g. persona, domain expertise, output format constraints). Respond with a JSON object: {{ - "system_prompt": "", "user_template": "