You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Docs] Update DPO example to use DPOConfig instead of TrainingArguments #4155
The current DPO example code in the documentation causes an AttributeError because it uses TrainingArguments from transformers instead of DPOConfig from trl. Recent versions of trl require DPOConfig for the DPOTrainer to properly handle DPO-specific arguments like padding_value.
Traceback (most recent call last):
File "/workspace/work/main.py", line 74, in <module>
dpo_trainer = DPOTrainer(
^^^^^^^^^^^
File "/opt/conda/lib/python3.11/site-packages/unsloth/trainer.py", line 314, in new_init
original_init(self, *args, **kwargs)
...
File "/workspace/work/unsloth_compiled_cache/UnslothDPOTrainer.py", line 903, in __init__
if args.padding_value is not None:
^^^^^^^^^^^^^^^^^^
AttributeError: 'TrainingArguments' object has no attribute 'padding_value'
Environment
unsloth: 2026.3.3
trl: 0.23.1
transformers: 4.57.1
Suggested Fix
Replacing TrainingArguments with DPOConfig resolves the issue.
fromtrlimportDPOConfig# Changed from TrainingArguments
...
dpo_trainer=DPOTrainer(
model=model,
args=DPOConfig( # Use DPOConfigper_device_train_batch_size=4,
...
),
)
How can I contribute?
I would like to submit a Pull Request to update the documentation if this is acceptable. However, I couldn't find the source files for the documentation (GitBook) in this repository.
Could you please guide me on where the documentation source is located or how I should proceed with a PR?
@Datta0 would appreciate if you could guide me aswell on how do I contribute on the documentations part aswell. I am a previous contributor and felt there were some docs which could be improved. Thank You!
First of all, thank you for the amazing docs. They help the community a lot and are genuinely one of the easiest resources to follow when getting started with Unsloth.
I wanted to start by pointing out a few small typos. They are minor, but since the docs are frequently visited, fixing them would slightly improve the overall reading experience.
Fine-tuning can replicate all of RAG's capabilities, but not vice versa
This feels slightly oversimplified and could be misleading for beginners. It might help to clarify that the two approaches serve different purposes. Fine-tuning is typically used for behavior, style, or task adaptation, while RAG is better suited for dynamic or frequently changing knowledge.
Hyperparameter Tuning
Page: Hyperparameters Guide
The current section is already quite good for beginners. One small suggestion would be to expand slightly on learning rate intuition and guide users through a few key questions before choosing hyperparameters.
For example, it might help to prompt users to think about things like:
What is your model size?
What is your effective batch size?
How much training data do you have?
How complex is the task you are fine-tuning for?
These factors heavily influence good hyperparameter choices, especially the learning rate. In many setups, the learning rate can also scale with the effective batch size, so mentioning that relationship could help users reason about adjustments rather than relying only on fixed defaults.
Adding a short explanation around this decision process could help beginners better understand why certain hyperparameters work, not just which ones to use.
Overall, the docs are already very strong. These are just a few small suggestions that might make them even clearer and more polished. Will try to get back with more!
Thank You!
This gives the team a tested reference to update the docs from.
Option 3: Engage on Discord/Slack 💬
If Unsloth has a community Discord or Slack, you could share this there for faster visibility.
My recommendation: This issue is perfect as-is. The maintainers have everything they need to update the GitBook docs. If you want to go further, Option 2 (PR with working example) would be valuable!
Activity
adityaghai07 commentedon Mar 5, 2026
@Datta0 would appreciate if you could guide me aswell on how do I contribute on the documentations part aswell. I am a previous contributor and felt there were some docs which could be improved. Thank You!
shimmyshimmer commentedon Mar 5, 2026
Hello @pesuchin I have updated the docs to include it thank you for your help: https://unsloth.ai/docs/get-started/reinforcement-learning-rl-guide/preference-dpo-orpo-and-kto
Currently we do not have a public Github for our docs. Maybe in the future.
@adityaghai07 if you have any suggestions let me know an overview where improvements are needed thank you so much!
adityaghai07 commentedon Mar 6, 2026
@shimmyshimmer
First of all, thank you for the amazing docs. They help the community a lot and are genuinely one of the easiest resources to follow when getting started with Unsloth.
I wanted to start by pointing out a few small typos. They are minor, but since the docs are frequently visited, fixing them would slightly improve the overall reading experience.
Typos
https://docs.unsloth.ai/get-started/fine-tuning-guide
https://docs.unsloth.ai/basics/gpt-oss-how-to-run-and-fine-tune
Appears in multiple places:
Technical Details
RAG vs Fine-tuning claim (Fine-tuning Guide)
Current statement:
This feels slightly oversimplified and could be misleading for beginners. It might help to clarify that the two approaches serve different purposes. Fine-tuning is typically used for behavior, style, or task adaptation, while RAG is better suited for dynamic or frequently changing knowledge.
Hyperparameter Tuning
Page: Hyperparameters Guide
The current section is already quite good for beginners. One small suggestion would be to expand slightly on learning rate intuition and guide users through a few key questions before choosing hyperparameters.
For example, it might help to prompt users to think about things like:
These factors heavily influence good hyperparameter choices, especially the learning rate. In many setups, the learning rate can also scale with the effective batch size, so mentioning that relationship could help users reason about adjustments rather than relying only on fixed defaults.
Adding a short explanation around this decision process could help beginners better understand why certain hyperparameters work, not just which ones to use.
Overall, the docs are already very strong. These are just a few small suggestions that might make them even clearer and more polished. Will try to get back with more!
Thank You!
fix(dpo): build DPOConfig from TrainingArguments (fixes unslothai#4155)
hnshah commentedon Mar 23, 2026
Documentation Location
The Unsloth documentation at https://unsloth.ai/docs is hosted on GitBook and the source files are not in this repository. The documentation is managed externally by the Unsloth team.
How to Contribute This Fix
Since the docs aren't in the repo, here are your options:
Option 1: Let the maintainers handle it ✅ (Easiest)
The Unsloth team monitors issues labeled
good first issue. Since you've clearly documented:They can update the GitBook docs directly. This issue is well-written and actionable as-is!
Option 2: Create a PR with an example ⚡
Since the docs source isn't accessible, you could:
examples/dpo_correct_usage.py)Example:
This gives the team a tested reference to update the docs from.
Option 3: Engage on Discord/Slack 💬
If Unsloth has a community Discord or Slack, you could share this there for faster visibility.
My recommendation: This issue is perfect as-is. The maintainers have everything they need to update the GitBook docs. If you want to go further, Option 2 (PR with working example) would be valuable!