Repository navigation
Studio: train structured recipe columns as JSON, not as Python dicts - #13635
Conversation
|
@codex review |
1 similar comment
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7df2f61368
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0b29bc85b2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
NilayYadav
left a comment
There was a problem hiding this comment.
Review + reproduction evidence
Pinned review: 0b29bc85b2d20aecdd2e8d7206faef6faa58c282. 1 finding, fixed in 0b29bc85b2 (NaN and infinity inside a structured cell were written as NaN / Infinity, which strict JSON parsers reject; they now train as null, with a test).
I reproduced the user flow on fresh upstream main (NVIDIA L4, Linux, Chromium 1440x900): Train page, unsloth/Qwen3-0.6B, QLoRA, upload a JSONL whose agent_reply column is an object (the shape an LLM Structured recipe column produces), keep the detected mapping (question to User, agent_reply to Assistant), 60 steps at 2e-4, then load the fine-tuned LoRA in Chat and send a training ticket.
- main
03022a4/ fix reverted (Linux, macOS, Windows): the dataset preview shows JSON, but the model answers{'response': 'Lower the batch size to 1 and enable gradient checkpointing.', 'next_action': 'retry_with_smaller_batch', 'escalate': False, 'notes': None}.json.loadson that reply fails withExpecting property name enclosed in double quotes: line 1 column 2 (char 1). The second ticket gives the same Python syntax. In CI, the PR's tests fail with the sameJSONDecodeError(4 failed). - PR head (Linux, macOS, Windows): the same run answers
{"response": "Lower the batch size to 1 and enable gradient checkpointing.", "next_action": "retry_with_smaller_batch", "escalate": true, "notes": null}, which parses. The second ticket also parses. In CI: 7 passed, and 191 adjacent dataset-formatting tests passed on every OS.
- Same results elsewhere: the structured run ends at loss 0.0177 on main and 0.0184 on the PR, both 60/60 steps. A plain-text question/answer dataset trains the same on both, at 60/60 steps and final loss 0.0006.
- Unchanged paths: plain text, numbers, blank and NaN cells, SQuAD answer dicts, message-list columns and tool-call turns produce the same output as before. Only dict and list cells change. Every mapping path is covered (auto, manual, custom, Alpaca, Alpaca to ChatML), and the template mapping path already wrote JSON. No cached formatted dataset carries the old text over after an update.
- Speed: formatting a 50k-row dataset whose answer is a struct takes 0.19 s (0.12 s before). Formatting text-only data is unchanged (0.07 s). This is one-time preprocessing, not per step.
Conclusion: the bug is real and the PR fixes it. A model fine-tuned on a structured column now answers in JSON instead of Python syntax. Two small follow-ups, both already on main and outside this PR: image datasets with a structured text column, and _extract_column_value, which joins a list of dicts with , and has no default=str.
…ell_text The template mapping path kept its own json.dumps for dicts, which wrote NaN as a bare NaN token and raised on dates, and joined a list of objects element by element into text no JSON parser accepts. It now serialises dicts and any list holding a dict or list through cell_text, so every mapping path trains the same JSON. Lists of scalar labels keep their comma join.
|
Pushed a464713 on top of the PR: the template mapping path (
|
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Codex converged on What changed in this round
CI (staging copy, same head and base, since upstream jobs were queued): Lyxot/unsloth#158, 34 passed, 7 failed, 2 skipped. All 7 failures come from this branch's base (6a70df3, 43 commits behind main) and pass or are gone on current main; none touch dataset formatting:
The backend tests, including |

Training on a Data Recipe run whose answer column is LLM Structured (the GitHub Crawler and Structured Outputs recipes, for example) trained each answer as a Python dict, with single quotes, None and True, even though the recipe produced JSON and the dataset preview shows JSON. The fine-tuned model then learns to reply in Python syntax that no JSON parser accepts. The same happened to any dataset with a nested object or list column mapped to a chat role.
Dict and list cells are now written into the conversation as JSON, the same way the template mapping path already writes them. Plain text, numbers, blank cells and SQuAD-style answer columns train exactly as before.