Agent skill

unsloth-orpo

Stars 0
Forks 0

Install this agent skill to your Project

npx add-skill https://github.com/cuba6112/skillfactory/tree/main/skills/unsloth-orpo

SKILL.md

Overview

Unsloth-orpo facilitates one-step preference alignment using Odds Ratio Preference Optimization (ORPO). Unlike DPO, which requires a separate reference model, ORPO incorporates a penalty for disfavored generations directly into the training process, making it more efficient and faster.

When to Use

  • When aligning models with human preferences (Chosen vs. Rejected) in a single step.
  • When seeking an efficient alternative to DPO or RLHF.
  • When training on preference datasets like ultrafeedback_binarized.

Decision Tree

  1. Do you have a reference model?
    • No: Use ORPO for one-step alignment.
  2. Is the model diverging from language patterns?
    • Yes: Monitor nll_loss (the SFT component) and adjust learning rate.
  3. Is the preference gap widening?
    • Monitor rewards/margins and log_odds_ratio in logs.

Workflows

  1. One-Step Preference Alignment: Load a model in 4-bit, apply LoRA, and initialize ORPOTrainer with a low learning rate (approx. 8e-6).
  2. Monitoring ORPO Metrics: Connect to Weights & Biases to track the log_odds_ratio (preference for chosen) and nll_loss (language modeling stability).
  3. Exporting ORPO Models: Merge trained LoRA weights into the 16-bit base and export as GGUF (e.g., q4_k_m) for deployment.

Non-Obvious Insights

  • ORPO eliminates the need for a separate Reward Model and Reference Model by penalizing the log-odds ratio of rejected responses directly.
  • While SFT can accidentally increase the probability of bad responses by simply learning language patterns, ORPO widens the gap between "good" and "bad" from the first step.
  • Optimal learning rates for ORPO are typically much lower than SFT (e.g., 8e-6 vs 2e-4).

Evidence

  • "Traditional approaches like DPO require two steps... With ORPO, we can do it all in one step, which is great and more efficient." Source
  • "ORPOConfig(learning_rate = 8e-6, beta = 0.1, lr_scheduler_type = 'cosine_with_restarts')." Source

Scripts

  • scripts/unsloth-orpo_tool.py: Setup for ORPOTrainer and preference datasets.
  • scripts/unsloth-orpo_tool.js: Metric tracker for odds ratio changes.

Dependencies

  • unsloth
  • trl (ORPOTrainer)
  • wandb (recommended for monitoring)

References

  • references/README.md

Expand your agent's capabilities with these related and highly-rated skills.

cuba6112/skillfactory

prompt-engineering

Comprehensive prompt engineering techniques for Claude models. Use this skill when crafting, optimizing, or debugging prompts for Claude API, Claude Code, or any Claude-powered application. Covers system prompts, role prompting, multishot examples, chain of thought, XML structuring, long context handling, extended thinking, prompt chaining, Claude 4.x-specific best practices, and agentic orchestration including subagents, agent loops, skills, MCP integration, and multi-agent workflows.

0 0
Explore
cuba6112/skillfactory

adk-rag-agent

Build RAG (Retrieval-Augmented Generation) agents with Google ADK and Vertex AI RAG Engine. Use when implementing document Q&A, knowledge base search, or citation-backed responses. Covers VertexAiRagRetrieval tool, corpus setup, and citation formatting.

0 0
Explore
cuba6112/skillfactory

headless-cli-agents

Build agentic systems using Claude CLI in headless mode or the Claude Agent SDK. Use when building automation pipelines, CI/CD integrations, multi-agent orchestration, or programmatic Claude interactions. Covers CLI flags (-p, --output-format), session management (--resume, --continue), Python SDK (claude-agent-sdk), custom tools, and agent loop patterns.

0 0
Explore
cuba6112/skillfactory

notion-knowledge-capture

Capture conversations and decisions into structured Notion pages; use when turning chats/notes into wiki entries, how-tos, decisions, or FAQs with proper linking.

0 0
Explore
cuba6112/skillfactory

mcp-builder

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

0 0
Explore
cuba6112/skillfactory

gh-fix-ci

Inspect GitHub PR checks with gh, pull failing GitHub Actions logs, summarize failure context, then create a fix plan and implement after user approval. Use when a user asks to debug or fix failing PR CI/CD checks on GitHub Actions and wants a plan + code changes; for external checks (e.g., Buildkite), only report the details URL and mark them out of scope.

0 0
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results