No description
  • Python 98.2%
  • Shell 1.8%
Find a file
2026-08-25 21:31:24 +01:00
configs Initial commit: skill2lora project setup 2026-08-25 21:31:24 +01:00
data Initial commit: skill2lora project setup 2026-08-25 21:31:24 +01:00
evaluation Initial commit: skill2lora project setup 2026-08-25 21:31:24 +01:00
examples Initial commit: skill2lora project setup 2026-08-25 21:31:24 +01:00
runtime Initial commit: skill2lora project setup 2026-08-25 21:31:24 +01:00
training Initial commit: skill2lora project setup 2026-08-25 21:31:24 +01:00
utils Initial commit: skill2lora project setup 2026-08-25 21:31:24 +01:00
.env.example Initial commit: skill2lora project setup 2026-08-25 21:31:24 +01:00
.gitignore Initial commit: skill2lora project setup 2026-08-25 21:31:24 +01:00
AGENTS.md Initial commit: skill2lora project setup 2026-08-25 21:31:24 +01:00
deploy.py Initial commit: skill2lora project setup 2026-08-25 21:31:24 +01:00
IMPLEMENTATION.md Initial commit: skill2lora project setup 2026-08-25 21:31:24 +01:00
main.py Initial commit: skill2lora project setup 2026-08-25 21:31:24 +01:00
PROJECT_SUMMARY.md Initial commit: skill2lora project setup 2026-08-25 21:31:24 +01:00
README.md Initial commit: skill2lora project setup 2026-08-25 21:31:24 +01:00
README_COMPLETE.md Initial commit: skill2lora project setup 2026-08-25 21:31:24 +01:00
REMOTE_MIGRATION.md Initial commit: skill2lora project setup 2026-08-25 21:31:24 +01:00
remote_requirements.txt Initial commit: skill2lora project setup 2026-08-25 21:31:24 +01:00
requirements.txt Initial commit: skill2lora project setup 2026-08-25 21:31:24 +01:00
setup.sh Initial commit: skill2lora project setup 2026-08-25 21:31:24 +01:00
synthetic_data_generator.py Initial commit: skill2lora project setup 2026-08-25 21:31:24 +01:00

Skill-to-LoRA (S2L) Implementation

This project implements the Skill-to-LoRA (S2L) method from the paper Skill2LoRA: Skill-Driven LoRA Training via Function Calls.

Overview

The S2L approach converts procedural skills (defined in SKILL.md files) into trainable LoRA adapters using a two-stage process:

  1. Skill-to-LoRA (S2L): Extract commands from skill definitions
  2. LoRA-to-Skill (L2S): Use LoRA adapters to encode skill behavior without repeated token-heavy injection

Project Structure

skill2lora/
├── configs/          # Configuration files
├── data/            # Training data
├── synthetic_data/  # Generated training data
├── training/        # Training scripts
├── evaluation/      # Benchmarking scripts
├── utils/           # Utility functions
├── runtime/         # Runtime adapter management
├── main.py          # Pipeline orchestration
└── deploy.py        # Remote deployment

Quick Start

1. Installation

# Clone the repository
git clone https://github.com/yourusername/skill2lora.git
cd skill2lora

# Create virtual environment
python -m venv venv
source venv/bin/activate

# Install dependencies
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121
pip install peft trl transformers bitsandbytes accelerate huggingface_hub

2. Define Skills

Create SKILL.md files in your skills directory:

---
name: file_operations
description: File manipulation commands
version: 1.0
author: assistant
tags: [filesystem, utility]
---

## Command: read_file
**Description:** Read contents from a file
**Usage:** read_file(path)
**Arguments:**
- path: File path to read

**Example:** Read the file at /tmp/test.txt

## Command: write_file
**Description:** Write content to a file
**Usage:** write_file(path, content)
**Arguments:**
- path: File path to write to
- content: Content to write

**Example:** Write "hello" to /tmp/hello.txt

3. Run the Pipeline

# Configure the pipeline in configs/lora_config.yaml
# Then run:
python main.py --config configs/lora_config.yaml

# Or run specific stages:
python main.py --stage parse
python main.py --stage generate
python main.py --stage train
python main.py --stage evaluate

4. Remote Deployment

Deploy to a remote host (e.g., for GPU access):

# Set REMOTE_HOST environment variable or use default (127.0.0.1)
export REMOTE_HOST=10.224.31.33
python deploy.py --host username@10.224.31.33 --project-dir . --config lora_config.yaml

Configuration

LoRA Configuration (configs/lora_config.yaml)

base_model: "meta-llama/Llama-3-8B"
lora_rank: 8
lora_alpha: 16
lora_dropout: 0.05
num_epochs: 3
batch_size: 4

Remote Host Setup

Set the REMOTE_HOST environment variable before deployment:

export REMOTE_HOST=10.224.31.33

If not set, the default is 127.0.0.1.

  1. Ensure SSH access is configured
  2. The deployment script will:
    • Create the project directory
    • Install PyTorch with CUDA support
    • Install ML dependencies (PEFT, TRL, Transformers, etc.)
    • Run the S2L pipeline

Outputs

The pipeline generates:

  • Parsed skills (outputs/parsed_skills.json)
  • Synthetic training data (outputs/synthetic_data/)
  • LoRA adapters (outputs/adapters/)
  • Evaluation results (outputs/evaluation_results/)

Usage

Once trained, load and use adapters:

from runtime.adapter_loader import AdapterManager

manager = AdapterManager(
    base_model_name="meta-llama/Llama-3-8B",
    adapters_dir="outputs/adapters"
)
manager.load_base_model()
manager.load_adapter("skill_name", "outputs/adapters/skill_name")
manager.activate_adapter("skill_name")

response = manager.generate("Your prompt here")
print(response)

Citation

@article{skill2lora2026,
  title={Skill2LoRA: Skill-Driven LoRA Training via Function Calls},
  author={Author Name},
  journal={arXiv preprint arXiv:2606.16769},
  year={2026}
}

License

MIT License