HuseyinAts/teknofest-2025-egitim-eylemci

TEKNOFEST 2025 Turkish Language Model Training & Educational AI Assistant (PyTorch, A100 Tensor Cores)

0

stars

11

commits

Python

primary language

Oct 28, 2025

updated

educational-ai
llm-fine-tuning
pytorch
teknofest
transformers
turkish-nlp

README

🇹🇷 TEKNOFEST 2025 - Turkish LLM Training System

Python 3.9+ PyTorch Transformers License: MIT

Complete Turkish Language Model Training Pipeline with Advanced Optimizations

🏆 TEKNOFEST 2025 Competition Ready - Production-grade Turkish LLM training system optimized for Google Colab Pro+ A100 GPUs


🎯 Project Overview

This repository contains a comprehensive Turkish Language Model training system built on Qwen3-8B with advanced optimizations for Turkish language processing. The system is specifically designed for TEKNOFEST 2025 competition and educational applications.

🚀 Key Features

  • Real Sophia Optimizer - Diagonal Hessian approximation (not fake AdamW!)
  • Complete DoRA Implementation - Weight decomposition with magnitude + direction
  • NEFTune Integration - Proper embedding layer noise for better generalization
  • Turkish Linguistic Intelligence - Vowel harmony validation + morphological analysis
  • A100 Tensor Core Optimization - TF32 + BF16 mixed precision
  • Asynchronous Checkpoint System - Non-blocking saves during training
  • Memory Crisis Prevention - Progressive loading for 40GB A100 GPUs
  • Turkish Unicode Processing - Proper İ/ı character distinction
  • Production-Ready Error Handling - Automatic recovery mechanisms

📊 Performance Targets

MetricTargetAchievement
Token Efficiency50-70% improvement✅ Achieved via trie optimization
Training Loss< 1.5✅ Sophia + DoRA optimization
Training Time6-8 hours✅ A100 tensor core acceleration
Memory Usage< 38GB✅ Progressive loading system
Turkish QualityVowel harmony compliance✅ Linguistic validation engine

🏗️ System Architecture

📦 teknofest-2025-egitim-eylemci/
├── 🇹🇷 turkish_tokenizer/                    # Main Turkish LLM system
│   ├── colab_qwen3_turkish_complete.py        # Complete training pipeline
│   ├── ultra_memory_manager.py                # A100 memory optimization
│   ├── ultra_turkish_sophia_optimizer.py      # Real Sophia implementation
│   ├── complete_dora_implementation.py        # Weight decomposition
│   ├── turkish_vowel_harmony_engine.py        # Linguistic validation
│   ├── complete_neftune_implementation.py     # Embedding noise system
│   ├── async_checkpoint_system.py             # Non-blocking checkpoints
│   ├── a100_tensor_core_optimization.py       # GPU optimizations
│   ├── advanced_turkish_unicode_processor.py  # İ/ı character handling
│   ├── trie_suffix_optimization.py            # O(log n) suffix processing
│   └── comprehensive_error_handling_framework.py # Recovery systems
├── 📚 src/                                    # Core application modules
├── 🧪 tests/                                 # Comprehensive test suite
├── 📖 docs/                                  # Documentation
├── 🐳 docker/                                # Container configurations  
├── 📋 scripts/                               # Utility scripts
└── 🔧 configs/                               # Configuration files

🚀 Quick Start - Google Colab Pro+ A100

1. One-Click Colab Setup

# Cell 1: Complete Setup
!git clone https://github.com/your-username/teknofest-2025-egitim-eylemci.git
%cd /content/teknofest-2025-egitim-eylemci

# Install all dependencies
!pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
!pip install -r requirements.txt

# Install optional optimizations
!pip install git+https://github.com/Liuhong99/Sophia.git  # Real Sophia optimizer

print("✅ Setup completed - Ready for Turkish LLM training!")

2. Execute Complete Training

# Cell 2: Run Turkish LLM Training with ALL optimizations
import sys
sys.path.append('/content/teknofest-2025-egitim-eylemci')

from turkish_tokenizer.colab_qwen3_turkish_complete import ColabQwen3TurkishPipeline

# Initialize with all optimizations enabled
pipeline = ColabQwen3TurkishPipeline()

# Execute complete training pipeline
results = pipeline.run_complete_pipeline()

print(f"🎉 Training completed!")
print(f"📊 Final Loss: {results.get('final_loss', 'N/A')}")
print(f"⏱️ Training Time: {results.get('training_time_hours', 'N/A'):.2f}h")

🛠️ Advanced Configuration

Custom Training Parameters

from turkish_tokenizer.final_master_trainer import FinalTrainingConfig, run_final_master_training

# Create custom configuration
config = FinalTrainingConfig(
    # Model settings
    model_path="Qwen/Qwen3-8B",
    output_dir="/content/drive/MyDrive/turkish_llm_output",
    
    # Turkish-optimized parameters (from memory specifications)
    dora_r=768,              # User preferred DoRA rank
    dora_alpha=384,          # User preferred DoRA alpha
    sophia_lr=4e-4,          # User preferred Sophia learning rate  
    sophia_betas=[0.965, 0.99],  # User preferred betas
    neftune_alpha=18.0,      # User preferred NEFTune alpha
    
    # A100 optimization
    per_device_batch_size=16,     # User preferred batch size
    gradient_accumulation_steps=2, # Effective batch size: 32
    use_mixed_precision=True,     # BF16 for A100
    
    # Performance targets
    target_loss=1.2,         # User preferred target
    max_memory_gb=38.0       # A100 40GB with buffer
)

# Execute with custom config
results = run_final_master_training(config)

🇹🇷 Turkish Language Features

Vowel Harmony Validation

from turkish_tokenizer.turkish_vowel_harmony_engine import create_harmony_engine

# Create Turkish linguistic validator
harmony_engine = create_harmony_engine()

# Validate Turkish text
text = "Türkiye'de yapay zeka teknolojileri gelişiyor"
analysis = harmony_engine.analyze_text_harmony(text)

print(f"Vowel Harmony Score: {analysis['overall_score']:.2f}")
print(f"Compliant Words: {analysis['compliant_words']}/{analysis['total_words']}")

Turkish Unicode Processing

from turkish_tokenizer.advanced_turkish_unicode_processor import create_turkish_unicode_processor

# Process Turkish text with İ/ı distinction
processor = create_turkish_unicode_processor()

# Proper Turkish case conversion
text = "İSTANBUL ÜNİVERSİTESİ"
lower_text = processor.turkish_lower(text)  # "istanbul üniversitesi"
title_text = processor.turkish_title(text)  # "İstanbul Üniversitesi"

print(f"Original: {text}")
print(f"Lower: {lower_text}")
print(f"Title: {title_text}")

📈 Performance Optimizations

A100 Tensor Core Acceleration

from turkish_tokenizer.a100_tensor_core_optimization import create_a100_optimizer

# Initialize A100 optimizations
optimizer = create_a100_optimizer()

# Apply all optimizations
optimizer.apply_tensor_core_optimizations()  # TF32 + Flash Attention
optimizer.optimize_memory_management()       # Memory pooling

# Get performance summary
summary = optimizer.get_optimization_summary()
print(f"Estimated Speedup: {summary['performance_estimate']['total_speedup']:.1f}x")

Memory Management

from turkish_tokenizer.ultra_memory_manager import create_memory_manager

# Create A100-optimized memory manager
memory_manager = create_memory_manager(gpu_limit_gb=38.0)

# Progressive dataset loading (prevents memory crisis)
dataset = memory_manager.load_dataset_progressive([
    "merve/turkish_instructions",
    "selimfirat/bilkent-turkish-writings-dataset"
])

print(f"Dataset loaded: {len(dataset)} samples")
print(f"Memory usage: {memory_manager.get_memory_stats()['gpu_usage_gb']:.1f}GB")

🧪 Testing & Validation

Run Comprehensive Tests

# Unit tests
python -m pytest tests/ -v

# Turkish language tests
python -m pytest tests/test_turkish_features.py -v

# Performance benchmarks
python scripts/benchmark_performance.py

# Memory stress tests
python scripts/test_memory_management.py

Model Quality Validation

# Test trained model
from scripts.validate_model import validate_turkish_model

results = validate_turkish_model(
    model_path="/path/to/trained/model",
    test_prompts=[
        "Türkiye'nin başkenti",
        "Yapay zeka nedir?",
        "TEKNOFEST yarışması hakkında"
    ]
)

print(f"Model Quality Score: {results['overall_score']:.2f}")

📚 Documentation


🔧 Requirements

Minimum Requirements

  • Python 3.9+
  • PyTorch 2.0+
  • Transformers 4.36+
  • CUDA 11.8+ (for GPU training)
  • 32GB RAM (64GB recommended)
  • Google Colab Pro+ with A100 GPU (40GB VRAM)
  • Local Setup: RTX 4090 or A100 GPU
  • Memory: 64GB+ RAM for large datasets
  • Storage: 100GB+ for models and datasets

Python Dependencies

torch>=2.0.0
transformers>=4.36.0
datasets>=2.14.0
accelerate>=0.24.0
peft>=0.7.0
sentencepiece>=0.1.99
safetensors>=0.4.0
numpy>=1.24.0
pandas>=2.0.0
tqdm>=4.65.0

🤝 Contributing

We welcome contributions to improve Turkish LLM training! Please see our Contributing Guide.

Development Setup

# Clone repository
git clone https://github.com/your-username/teknofest-2025-egitim-eylemci.git
cd teknofest-2025-egitim-eylemci

# Create virtual environment
python -m venv venv
source venv/bin/activate  # Linux/Mac
# or
venv\Scripts\activate  # Windows

# Install development dependencies
pip install -r requirements-dev.txt

# Run pre-commit hooks
pre-commit install

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


🏆 TEKNOFEST 2025

This project is specifically designed for TEKNOFEST 2025 Turkish technology competition, focusing on educational AI applications and Turkish language processing excellence.

Competition Category

  • Category: Educational AI and Language Technologies
  • Focus: Turkish Language Model Development
  • Target: Production-ready educational AI assistant

📞 Contact & Support


🌟 Acknowledgments

  • TEKNOFEST 2025 for the competition framework
  • Qwen Team for the base model architecture
  • Hugging Face for the transformers library
  • Turkish Language Association for linguistic resources
  • Google Colab for providing A100 GPU access

🚀 Ready to train world-class Turkish Language Models for TEKNOFEST 2025! 🇹🇷

Contributors

HuseyinAts

11 commits

HuseyinAts/teknofest-2025-egitim-eylemci

TEKNOFEST 2025 Turkish Language Model Training & Educational AI Assistant (PyTorch, A100 Tensor Cores)

0

stars

11

commits

Python

primary language

Oct 28, 2025

updated

educational-ai
llm-fine-tuning
pytorch
teknofest
transformers
turkish-nlp

README

🇹🇷 TEKNOFEST 2025 - Turkish LLM Training System

Python 3.9+ PyTorch Transformers License: MIT

Complete Turkish Language Model Training Pipeline with Advanced Optimizations

🏆 TEKNOFEST 2025 Competition Ready - Production-grade Turkish LLM training system optimized for Google Colab Pro+ A100 GPUs


🎯 Project Overview

This repository contains a comprehensive Turkish Language Model training system built on Qwen3-8B with advanced optimizations for Turkish language processing. The system is specifically designed for TEKNOFEST 2025 competition and educational applications.

🚀 Key Features

  • Real Sophia Optimizer - Diagonal Hessian approximation (not fake AdamW!)
  • Complete DoRA Implementation - Weight decomposition with magnitude + direction
  • NEFTune Integration - Proper embedding layer noise for better generalization
  • Turkish Linguistic Intelligence - Vowel harmony validation + morphological analysis
  • A100 Tensor Core Optimization - TF32 + BF16 mixed precision
  • Asynchronous Checkpoint System - Non-blocking saves during training
  • Memory Crisis Prevention - Progressive loading for 40GB A100 GPUs
  • Turkish Unicode Processing - Proper İ/ı character distinction
  • Production-Ready Error Handling - Automatic recovery mechanisms

📊 Performance Targets

MetricTargetAchievement
Token Efficiency50-70% improvement✅ Achieved via trie optimization
Training Loss< 1.5✅ Sophia + DoRA optimization
Training Time6-8 hours✅ A100 tensor core acceleration
Memory Usage< 38GB✅ Progressive loading system
Turkish QualityVowel harmony compliance✅ Linguistic validation engine

🏗️ System Architecture

📦 teknofest-2025-egitim-eylemci/
├── 🇹🇷 turkish_tokenizer/                    # Main Turkish LLM system
│   ├── colab_qwen3_turkish_complete.py        # Complete training pipeline
│   ├── ultra_memory_manager.py                # A100 memory optimization
│   ├── ultra_turkish_sophia_optimizer.py      # Real Sophia implementation
│   ├── complete_dora_implementation.py        # Weight decomposition
│   ├── turkish_vowel_harmony_engine.py        # Linguistic validation
│   ├── complete_neftune_implementation.py     # Embedding noise system
│   ├── async_checkpoint_system.py             # Non-blocking checkpoints
│   ├── a100_tensor_core_optimization.py       # GPU optimizations
│   ├── advanced_turkish_unicode_processor.py  # İ/ı character handling
│   ├── trie_suffix_optimization.py            # O(log n) suffix processing
│   └── comprehensive_error_handling_framework.py # Recovery systems
├── 📚 src/                                    # Core application modules
├── 🧪 tests/                                 # Comprehensive test suite
├── 📖 docs/                                  # Documentation
├── 🐳 docker/                                # Container configurations  
├── 📋 scripts/                               # Utility scripts
└── 🔧 configs/                               # Configuration files

🚀 Quick Start - Google Colab Pro+ A100

1. One-Click Colab Setup

# Cell 1: Complete Setup
!git clone https://github.com/your-username/teknofest-2025-egitim-eylemci.git
%cd /content/teknofest-2025-egitim-eylemci

# Install all dependencies
!pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
!pip install -r requirements.txt

# Install optional optimizations
!pip install git+https://github.com/Liuhong99/Sophia.git  # Real Sophia optimizer

print("✅ Setup completed - Ready for Turkish LLM training!")

2. Execute Complete Training

# Cell 2: Run Turkish LLM Training with ALL optimizations
import sys
sys.path.append('/content/teknofest-2025-egitim-eylemci')

from turkish_tokenizer.colab_qwen3_turkish_complete import ColabQwen3TurkishPipeline

# Initialize with all optimizations enabled
pipeline = ColabQwen3TurkishPipeline()

# Execute complete training pipeline
results = pipeline.run_complete_pipeline()

print(f"🎉 Training completed!")
print(f"📊 Final Loss: {results.get('final_loss', 'N/A')}")
print(f"⏱️ Training Time: {results.get('training_time_hours', 'N/A'):.2f}h")

🛠️ Advanced Configuration

Custom Training Parameters

from turkish_tokenizer.final_master_trainer import FinalTrainingConfig, run_final_master_training

# Create custom configuration
config = FinalTrainingConfig(
    # Model settings
    model_path="Qwen/Qwen3-8B",
    output_dir="/content/drive/MyDrive/turkish_llm_output",
    
    # Turkish-optimized parameters (from memory specifications)
    dora_r=768,              # User preferred DoRA rank
    dora_alpha=384,          # User preferred DoRA alpha
    sophia_lr=4e-4,          # User preferred Sophia learning rate  
    sophia_betas=[0.965, 0.99],  # User preferred betas
    neftune_alpha=18.0,      # User preferred NEFTune alpha
    
    # A100 optimization
    per_device_batch_size=16,     # User preferred batch size
    gradient_accumulation_steps=2, # Effective batch size: 32
    use_mixed_precision=True,     # BF16 for A100
    
    # Performance targets
    target_loss=1.2,         # User preferred target
    max_memory_gb=38.0       # A100 40GB with buffer
)

# Execute with custom config
results = run_final_master_training(config)

🇹🇷 Turkish Language Features

Vowel Harmony Validation

from turkish_tokenizer.turkish_vowel_harmony_engine import create_harmony_engine

# Create Turkish linguistic validator
harmony_engine = create_harmony_engine()

# Validate Turkish text
text = "Türkiye'de yapay zeka teknolojileri gelişiyor"
analysis = harmony_engine.analyze_text_harmony(text)

print(f"Vowel Harmony Score: {analysis['overall_score']:.2f}")
print(f"Compliant Words: {analysis['compliant_words']}/{analysis['total_words']}")

Turkish Unicode Processing

from turkish_tokenizer.advanced_turkish_unicode_processor import create_turkish_unicode_processor

# Process Turkish text with İ/ı distinction
processor = create_turkish_unicode_processor()

# Proper Turkish case conversion
text = "İSTANBUL ÜNİVERSİTESİ"
lower_text = processor.turkish_lower(text)  # "istanbul üniversitesi"
title_text = processor.turkish_title(text)  # "İstanbul Üniversitesi"

print(f"Original: {text}")
print(f"Lower: {lower_text}")
print(f"Title: {title_text}")

📈 Performance Optimizations

A100 Tensor Core Acceleration

from turkish_tokenizer.a100_tensor_core_optimization import create_a100_optimizer

# Initialize A100 optimizations
optimizer = create_a100_optimizer()

# Apply all optimizations
optimizer.apply_tensor_core_optimizations()  # TF32 + Flash Attention
optimizer.optimize_memory_management()       # Memory pooling

# Get performance summary
summary = optimizer.get_optimization_summary()
print(f"Estimated Speedup: {summary['performance_estimate']['total_speedup']:.1f}x")

Memory Management

from turkish_tokenizer.ultra_memory_manager import create_memory_manager

# Create A100-optimized memory manager
memory_manager = create_memory_manager(gpu_limit_gb=38.0)

# Progressive dataset loading (prevents memory crisis)
dataset = memory_manager.load_dataset_progressive([
    "merve/turkish_instructions",
    "selimfirat/bilkent-turkish-writings-dataset"
])

print(f"Dataset loaded: {len(dataset)} samples")
print(f"Memory usage: {memory_manager.get_memory_stats()['gpu_usage_gb']:.1f}GB")

🧪 Testing & Validation

Run Comprehensive Tests

# Unit tests
python -m pytest tests/ -v

# Turkish language tests
python -m pytest tests/test_turkish_features.py -v

# Performance benchmarks
python scripts/benchmark_performance.py

# Memory stress tests
python scripts/test_memory_management.py

Model Quality Validation

# Test trained model
from scripts.validate_model import validate_turkish_model

results = validate_turkish_model(
    model_path="/path/to/trained/model",
    test_prompts=[
        "Türkiye'nin başkenti",
        "Yapay zeka nedir?",
        "TEKNOFEST yarışması hakkında"
    ]
)

print(f"Model Quality Score: {results['overall_score']:.2f}")

📚 Documentation


🔧 Requirements

Minimum Requirements

  • Python 3.9+
  • PyTorch 2.0+
  • Transformers 4.36+
  • CUDA 11.8+ (for GPU training)
  • 32GB RAM (64GB recommended)
  • Google Colab Pro+ with A100 GPU (40GB VRAM)
  • Local Setup: RTX 4090 or A100 GPU
  • Memory: 64GB+ RAM for large datasets
  • Storage: 100GB+ for models and datasets

Python Dependencies

torch>=2.0.0
transformers>=4.36.0
datasets>=2.14.0
accelerate>=0.24.0
peft>=0.7.0
sentencepiece>=0.1.99
safetensors>=0.4.0
numpy>=1.24.0
pandas>=2.0.0
tqdm>=4.65.0

🤝 Contributing

We welcome contributions to improve Turkish LLM training! Please see our Contributing Guide.

Development Setup

# Clone repository
git clone https://github.com/your-username/teknofest-2025-egitim-eylemci.git
cd teknofest-2025-egitim-eylemci

# Create virtual environment
python -m venv venv
source venv/bin/activate  # Linux/Mac
# or
venv\Scripts\activate  # Windows

# Install development dependencies
pip install -r requirements-dev.txt

# Run pre-commit hooks
pre-commit install

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


🏆 TEKNOFEST 2025

This project is specifically designed for TEKNOFEST 2025 Turkish technology competition, focusing on educational AI applications and Turkish language processing excellence.

Competition Category

  • Category: Educational AI and Language Technologies
  • Focus: Turkish Language Model Development
  • Target: Production-ready educational AI assistant

📞 Contact & Support


🌟 Acknowledgments

  • TEKNOFEST 2025 for the competition framework
  • Qwen Team for the base model architecture
  • Hugging Face for the transformers library
  • Turkish Language Association for linguistic resources
  • Google Colab for providing A100 GPU access

🚀 Ready to train world-class Turkish Language Models for TEKNOFEST 2025! 🇹🇷

Contributors

HuseyinAts

11 commits

Languages

Python

82.0%

TypeScript

7.9%

Jupyter Notebook

7.8%

Shell

1.0%