Skip to content

Studio: keep AI Assist label names and system prompt when the dataset format is Alpaca - #11597

Merged
Lyxot merged 4 commits into
unslothai:mainfrom
NilayYadav:studio-alpaca-ai-assist-mapping
Sep 23, 2026
Merged

Lyxot merged 4 commits into
unslothai:mainfrom
NilayYadav:studio-alpaca-ai-assist-mapping

Conversation

@NilayYadav

Copy link
Copy Markdown
Collaborator

With the Alpaca format, the label names (0 to negative, 1 to positive) and the system prompt that AI Assist suggests are lost. With label names the mapping fails and training stops with "Chat template failed on all rows". With only a system prompt, training goes ahead without it and nothing tells you.

Alpaca mapping now handles these like the default format does. Label numbers become their names and the system prompt is added at the start of the instruction. Columns that share a role are joined instead of dropped, and a label of 0 no longer shows up blank.

@danielhanchen

Copy link
Copy Markdown
Member

Confirmed that main's Alpaca mapping in dataset_utils.py drops the AI Assist system prompt and label names, and blanks a 0 label, so Alpaca training data comes out wrong. Will get this reviewed.

@Lyxot Lyxot self-assigned this Sep 23, 2026
_extract_column_value returned a raw int for single-element list cells, so the ChatML AI Assist mapping crashed on columns like [[0], [1, 2]]. Each scalar and list element now goes through cell_text before label lookup, which also blanks None cells and lets the Alpaca mapping drop its extra cell_text wrapper.
@Lyxot

Lyxot commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

Pushed 12bb473 on top of this PR:

  • _extract_column_value now always returns text: each scalar and list element goes through cell_text before the label lookup. It used to return a raw int for one-element list cells like [0], which still crashed the ChatML AI Assist mapping (expected str instance, int found) when there was a system prompt but no label mapping. The Alpaca path no longer needs its extra cell_text wrapper or the list-only label branch.
  • Missing cells now become "" instead of "None".
  • Tests: exact assertions instead of substring checks, plus cases for a blank instruction with a system prompt, {"text": [...]} cells, a missing cell, and ChatML list cells.

@Lyxot

Lyxot commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

Staging run for head 12bb473a6f (Lyxot#73):

  • Codex review: Didn't find any major issues
  • CI: 41 passed, 2 skipped (runs). The first run's (Python 3.13, l-r) job failed on test_llama_cpp_wait_for_health.py::test_unreadable_counters_keep_the_fixed_deadline (a wall-clock timing assert, 2.18 < 1.5, unrelated to this PR), and it passed on rerun.

@Lyxot Lyxot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Alpaca mapping now keeps AI Assist label names and the system prompt; Codex and staging CI are clean on 12bb473.

@Lyxot
Lyxot merged commit 43e0921 into unslothai:main Sep 23, 2026
44 checks passed
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
… format is Alpaca (unslothai#11597)

* Studio: keep AI Assist label names and system prompt when the dataset format is Alpaca

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Map each label in a list cell to its AI Assist name

* fix(studio): render every mapped cell as text before label lookup

_extract_column_value returned a raw int for single-element list cells, so the ChatML AI Assist mapping crashed on columns like [[0], [1, 2]]. Each scalar and list element now goes through cell_text before label lookup, which also blanks None cells and lets the Alpaca mapping drop its extra cell_text wrapper.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Lyxot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants