Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: keep answer columns out of the system prompt (#12306)
Nilay55c007a3b68d
diff --git a/studio/backend/hub/utils/dataset_format.py b/studio/backend/hub/utils/dataset_format.pyindex 9a48437c564..792617b72f3 100644--- a/studio/backend/hub/utils/dataset_format.py+++ b/studio/backend/hub/utils/dataset_format.py@@ -243,7 +243,7 @@ def detect_custom_format_heuristic(dataset):mapping[remaining_col] = "system"elif user_col is None:mapping[remaining_col] = "user"- else:+ elif not has_keyword(remaining_col, assistant_words):mapping[remaining_col] = "system"has_user = any(role == "user" for role in mapping.values())diff --git a/studio/backend/tests/test_dataset_heuristic_role_keywords.py b/studio/backend/tests/test_dataset_heuristic_role_keywords.pyindex 0cabed2c0e2..5604ebab39e 100644--- a/studio/backend/tests/test_dataset_heuristic_role_keywords.py+++ b/studio/backend/tests/test_dataset_heuristic_role_keywords.py@@ -94,15 +94,15 @@ _CASES = [_ASSISTANT_LEFTOVER_CASES = [({"context": _LONG, "answer": _MID, "explanation": _MID},- {"answer": "assistant", "context": "user", "explanation": "system"},+ {"answer": "assistant", "context": "user"},),({"context": _LONG, "answer": _MID, "output": _MID},- {"answer": "assistant", "context": "user", "output": "system"},+ {"answer": "assistant", "context": "user"},),({"context": _LONG, "response": _MID, "target": _MID},- {"response": "assistant", "context": "user", "target": "system"},+ {"response": "assistant", "context": "user"},),]@@ -132,3 +132,29 @@ def test_assistant_column_is_not_promoted_to_the_user_turn(heuristic, row, expec@pytest.mark.parametrize("row", _NO_USER_COLUMN_ROWS)def test_system_only_column_is_not_promoted_to_the_user_turn(heuristic, row):assert heuristic([row]) is None+++_ANSWER_LEFTOVER_CASES = [+ (+ {"problem": _MID, "generated_solution": _LONG, "expected_answer": "14"},+ {"problem": "user", "generated_solution": "assistant"},+ ),+ (+ {"question": _MID, "solution": _LONG, "final_answer": "42"},+ {"question": "user", "solution": "assistant"},+ ),+ (+ {"instruction": _MID, "response_base": _LONG, "response": _MID},+ {"instruction": "user", "response_base": "assistant"},+ ),+ (+ {"input": _MID, "output": _LONG, "target": "42"},+ {"input": "user", "output": "assistant"},+ ),+]++[email protected]("heuristic", _HEURISTICS)[email protected]("row, expected", _ANSWER_LEFTOVER_CASES)+def test_answer_column_is_not_mapped_to_the_system_prompt(heuristic, row, expected):+ assert heuristic([row]) == expecteddiff --git a/studio/backend/utils/datasets/format_detection.py b/studio/backend/utils/datasets/format_detection.pyindex 60a66d01c52..4feb6768ff1 100644--- a/studio/backend/utils/datasets/format_detection.py+++ b/studio/backend/utils/datasets/format_detection.py@@ -426,7 +426,7 @@ def detect_custom_format_heuristic(dataset):mapping[remaining_col] = "system"elif user_col is None:mapping[remaining_col] = "user"- else:+ elif not has_keyword(remaining_col, assistant_words):mapping[remaining_col] = "system"has_user = any(role == "user" for role in mapping.values())