{"id":29709047,"url":"https://github.com/codelion/ellora","last_synced_at":"2025-07-23T19:31:49.241Z","repository":{"id":303322105,"uuid":"861806338","full_name":"codelion/ellora","owner":"codelion","description":"Enhancing LLMs with LoRA","archived":false,"fork":false,"pushed_at":"2025-07-18T16:45:40.000Z","size":1663,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-18T18:54:59.970Z","etag":null,"topics":["accuracy-analysis","chain-of-thought","chain-of-thought-reasoning","data-generation","distillation","fine-tune","fine-tuning","fine-tuning-llm","finetuning","finetuning-llms","lora","qlora","quantization","quantization-aware-training","reasoning","reinforcement-learning","self-correction","self-distillation","supervised-finetuning","training"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codelion.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-23T14:42:52.000Z","updated_at":"2025-07-18T16:45:43.000Z","dependencies_parsed_at":"2025-07-18T16:10:54.375Z","dependency_job_id":"17a3aef7-be26-452b-a435-78432a248e47","html_url":"https://github.com/codelion/ellora","commit_stats":null,"previous_names":["codelion/ellora"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codelion/ellora","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelion%2Fellora","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelion%2Fellora/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelion%2Fellora/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelion%2Fellora/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codelion","download_url":"https://codeload.github.com/codelion/ellora/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelion%2Fellora/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266738302,"owners_count":23976414,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["accuracy-analysis","chain-of-thought","chain-of-thought-reasoning","data-generation","distillation","fine-tune","fine-tuning","fine-tuning-llm","finetuning","finetuning-llms","lora","qlora","quantization","quantization-aware-training","reasoning","reinforcement-learning","self-correction","self-distillation","supervised-finetuning","training"],"created_at":"2025-07-23T19:30:41.616Z","updated_at":"2025-07-23T19:31:49.220Z","avatar_url":"https://github.com/codelion.png","language":"Jupyter Notebook","readme":"# 🎯 Ellora: Enhancing LLMs with LoRA\n\n[![GitHub](https://img.shields.io/github/license/codelion/ellora)](https://github.com/codelion/ellora/blob/main/LICENSE)\n[![Models](https://img.shields.io/badge/🤗-Models-yellow)](https://huggingface.co/models?other=ellora)\n\n\u003e **Ellora** (Enhancing LLMs with LoRA) is a collection of standardized, high-quality LoRA recipes for enhancing Large Language Model capabilities. Instead of building new frameworks, we focus on creating reproducible training methodologies that work with existing infrastructure.\n\n## 🌟 Philosophy\n\nThe LLM ecosystem has amazing infrastructure (LoRAX, PEFT, vLLM), but lacks **standardized, high-quality capability adapters**. Ellora bridges this gap by providing:\n\n- 📋 **Recipes, not frameworks** - Reproducible training methodologies\n- 🎯 **Quality-first approach** - Rigorous evaluation and benchmarking  \n- 🔄 **Self-supervised data generation** - No dependency on external datasets\n- 🏗️ **Infrastructure agnostic** - Works with existing tools (PEFT, LoRAX, etc.)\n- 🌍 **Community-driven** - Open recipes for the ecosystem\n\n## 📚 Recipe Collection\n\n| Recipe | Purpose | Key Achievement | Jump to |\n|--------|---------|-----------------|----------|\n| **#1: Accuracy Recovery** | Restore quantized model performance | \u003c5% degradation from FP16 | [Details](#recipe-1-accuracy-recovery-lora) |\n| **#2: Reasoning Enhancement** | Add structured thinking with `\u003cthink\u003e` tags | 60% thinking usage, 75% quality boost | [Details](#recipe-2-reasoning-lora-with-grpo) |\n| **#3: Tool Calling** | Enable effective development tool usage | 80% success rate on complex tasks | [Details](#recipe-3-tool-calling-lora) |\n| **#4: Context Extension** | Expand from 32K to 2M tokens | 61x context increase for full repos | [Details](#recipe-4-progressive-context-extension-lora) |\n\n## 🍳 Available Recipes\n\n### Recipe #1: Accuracy Recovery LoRA\n**Problem**: Quantized models (INT4/INT8) lose accuracy compared to FP16 versions  \n**Solution**: Self-distillation LoRA adapter using Magpie-generated data\n\n- 🎯 **Goal**: \u003c5% performance degradation from FP16 baseline\n- 💾 **Memory**: ~75% reduction in model size  \n- ⚡ **Speed**: 2-3x faster inference than FP16\n- 📊 **Method**: Teacher (FP16) → Student (INT4+LoRA) distillation\n\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/codelion/ellora/blob/main/Ellora_Recipe_1_Self_Distillation_For_Quantization_Recovery.ipynb)\n\n**Key Innovation**: Uses [Magpie](https://arxiv.org/abs/2406.08464) self-data generation for perfect domain alignment - no external datasets needed!\n\n#### Quick Start\n```python\nfrom transformers import AutoModelForCausalLM, BitsAndBytesConfig\nfrom peft import PeftModel\n\n# Load quantized model\nmodel = AutoModelForCausalLM.from_pretrained(\n    \"Qwen/Qwen3-0.6B\",\n    quantization_config=BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_quant_type=\"nf4\")\n)\n\n# Load accuracy recovery adapter\nmodel = PeftModel.from_pretrained(model, \"codelion/Qwen3-0.6B-accuracy-recovery-lora\")\n\n# Use normally - now with recovered accuracy!\n```\n\n#### Results\n| Model | Perplexity | Memory | Speed | Status |\n|-------|------------|--------|-------|---------|\n| FP16 Baseline | 1.97 | 1.0GB | 1.0x | ✅ |\n| INT4 Raw | 2.40 (+21.8%) | 0.25GB | 3.2x | ⚠️ |\n| INT4 + Ellora | 2.09 (+5.7%) | 0.28GB | 3.0x | ✅ |\n\n### Recipe #2: Reasoning LoRA with GRPO\n**Problem**: LLMs often lack structured thinking patterns for complex reasoning  \n**Solution**: GRPO-trained adapter that teaches chain-of-thought with `\u003cthink\u003e\u003c/think\u003e` tags\n\n- 🧠 **Goal**: Enhance reasoning capabilities through preference learning\n- 📝 **Method**: GRPO (Group Relative Policy Optimization) with self-rewarding\n- 🎯 **Feature**: Teaches structured thinking with clear reasoning steps\n- 💡 **Output**: Models that show their reasoning process transparently\n\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/codelion/ellora/blob/main/Ellora_Recipe_2_Reasoning_LoRA_with_Self-Rewarding_GRPO.ipynb)\n\n**Key Innovation**: Self-generated preference data with automated quality scoring - no need for human annotations or external preference datasets!\n\n#### Quick Start\n```python\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\nfrom peft import PeftModel\n\n# Load base model\nmodel = AutoModelForCausalLM.from_pretrained(\"google/gemma-3-1b-it\")\ntokenizer = AutoTokenizer.from_pretrained(\"google/gemma-3-1b-it\")\n\n# Load reasoning adapter\nmodel = PeftModel.from_pretrained(model, \"codelion/gemma-3-1b-it-reasoning-grpo-lora\")\n\n# Use with thinking prompt\nprompt = '''Think step by step and use \u003cthink\u003e\u003c/think\u003e tags to show your reasoning process.\n\nProblem: If a train travels 120 miles in 2 hours, then increases its speed by 30 mph for the next hour, how many total miles does it travel?\n\nResponse:'''\n\ninputs = tokenizer(prompt, return_tensors=\"pt\")\noutputs = model.generate(**inputs, max_new_tokens=512, temperature=0.2)\nresponse = tokenizer.decode(outputs[0], skip_special_tokens=True)\n```\n\n#### Results\n| Model | Thinking Usage | Quality Score | Training Method | Status |\n|-------|----------------|---------------|-----------------|---------|\n| Gemma-3-1B Base | 0% | 3.2 | - | ⚠️ |\n| Gemma-3-1B + Ellora | 60% | 5.6 | GRPO | ✅ |\n\n### Recipe #3: Tool Calling LoRA\n**Problem**: LLMs struggle with effective tool usage for code exploration  \n**Solution**: Hybrid training with Magpie scenarios + real tool execution results\n\n- 🛠️ **Goal**: Teach models to use development tools effectively\n- 🔄 **Method**: Generate scenarios with Magpie, execute on real codebases\n- 🎯 **Feature**: OpenAI-compatible function calling format\n- 💻 **Tools**: File operations, search, code navigation, and more\n\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/codelion/ellora/blob/main/Ellora_Recipe_3_Enhanced_Tool_Calling_and_Code_Understanding.ipynb)\n\n**Key Innovation**: Combines synthetic scenario diversity with real execution feedback - ensuring models learn authentic tool usage patterns!\n\n### Recipe #4: Progressive Context Extension LoRA\n**Problem**: Base models limited to 32K context, need 2M tokens for large repositories  \n**Solution**: Progressive curriculum learning with vLLM + Unsloth hybrid approach\n\n- 📈 **Goal**: Extend context from 32K to 2M tokens (61x increase)\n- 🎓 **Method**: Curriculum learning across 4 stages (32K → 128K → 512K → 2M)\n- ⚡ **Innovation**: vLLM for fast data generation, Unsloth for memory-efficient training\n- 🔍 **Feature**: Single LoRA adapter progressively learns longer contexts\n\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/codelion/ellora/blob/main/Ellora_Recipe_4_Repository_Context_LoRA.ipynb)\n\n**Key Innovation**: Hybrid optimization combining vLLM's inference speed with Unsloth's training efficiency - achieving 61x context extension with minimal compute!\n\n#### Quick Start\n```python\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\nfrom peft import PeftModel\n\n# Load base model\nmodel = AutoModelForCausalLM.from_pretrained(\"Qwen/Qwen2.5-Coder-0.5B-Instruct\")\ntokenizer = AutoTokenizer.from_pretrained(\"Qwen/Qwen2.5-Coder-0.5B-Instruct\")\n\n# Load progressive context adapter\nmodel = PeftModel.from_pretrained(model, \"codelion/qwen2-5-coder-0-5b-instruct-progressive-2000k-lora\")\n\n# Use with 2M token context - perfect for large repositories!\nlong_context_prompt = \"Analyze this entire repository...\" # Up to 2M tokens\ninputs = tokenizer(long_context_prompt, return_tensors=\"pt\")\noutputs = model.generate(**inputs, max_new_tokens=1024)\n```\n\n#### Results\n| Model | Context Limit | Max Files | Use Case | Status |\n|-------|---------------|-----------|----------|---------|\n| Qwen2.5-Coder Base | 32K tokens | ~10-20 files | Small projects | ⚠️ |\n| + Stage 0 LoRA | 32K tokens | ~10-20 files | Single module analysis | ✅ |\n| + Stage 1 LoRA | 128K tokens | ~50-100 files | Medium repositories | ✅ |\n| + Stage 2 LoRA | 512K tokens | ~200-500 files | Large codebases | ✅ |\n| + Stage 3 LoRA | 2M tokens | ~1000+ files | Entire repositories | ✅ |\n\n## 🏆 Model Zoo\n\nAll models trained using Ellora recipes are available on HuggingFace:\n\n[![Models](https://img.shields.io/badge/🤗_Explore_Models-yellow?style=for-the-badge)](https://huggingface.co/models?other=ellora)\n\n### Featured Models\n- [`codelion/Qwen3-0.6B-accuracy-recovery-lora`](https://huggingface.co/codelion/Qwen3-0.6B-accuracy-recovery-lora) - Accuracy recovery for Qwen3-0.6B\n- [`codelion/gemma-3-1b-it-reasoning-grpo-lora`](https://huggingface.co/codelion/gemma-3-1b-it-reasoning-grpo-lora) - Reasoning enhancement for Gemma-3-1B\n- [`codelion/Llama-3.2-1B-Instruct-tool-calling-lora`](https://huggingface.co/codelion/Llama-3.2-1B-Instruct-tool-calling-lora) - Tool calling for Llama-3.2-1B\n- [`codelion/qwen2-5-coder-0-5b-instruct-progressive-2000k-lora`](https://huggingface.co/codelion/qwen2-5-coder-0-5b-instruct-progressive-2000k-lora) - 2M context extension for Qwen2.5-Coder-0.5B\n- More models coming as we test recipes across different model families!\n\n## 🔬 Research \u0026 Citations\n\nIf you use Ellora recipes in your research, please cite:\n\n```bibtex\n@misc{ellora2024,\n  title={Ellora: Enhancing LLMs with LoRA - Standardized Recipes for Capability Enhancement},\n  author={Asankhaya Sharma},\n  year={2024},\n  url={https://github.com/codelion/ellora}\n}\n```\n\n### Key Papers \u0026 Inspirations\n- **LoRA**: [Low-Rank Adaptation of Large Language Models](https://arxiv.org/abs/2106.09685)\n- **Magpie**: [Alignment Data Synthesis from Scratch by Prompting Aligned LLMs with Nothing](https://arxiv.org/abs/2406.08464)\n- **QLoRA**: [Efficient Finetuning of Quantized LLMs](https://arxiv.org/abs/2305.14314)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodelion%2Fellora","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodelion%2Fellora","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodelion%2Fellora/lists"}