This project implements a comprehensive framework for investigating the application of Large Language Models (LLMs) for efficient log summarization. The research develops a customized fine-tuning dataset of logs and their corresponding summaries, fine-tunes multiple LLMs ranging from 50 million to 8 billion parameters, and evaluates their performance using rigorous metrics including BLEU, ROUGE, METEOR, and BERTScore.
The implementation provides a complete end-to-end pipeline supporting both CUDA-enabled GPUs and Apple Silicon processors, with comprehensive testing framework, automated evaluation metrics, and visualization capabilities.
The project is structured as a modular framework with the following key components:
major_project/
├── logic/ # Core implementation modules
│ ├── cuda/ # CUDA-optimized implementations
│ │ ├── cudafft.py # Fine-tuning with LoRA
│ │ ├── cudamerge.py # Model merging utilities
│ │ ├── cudaeval.py # Comprehensive evaluation
│ │ └── tests/ # Comprehensive test suite
│ ├── apple_silicon/ # Apple Silicon optimized implementations
│ │ ├── apl_fft.py # Fine-tuning for Apple Silicon
│ │ ├── apl_merge.py # Model merging for Apple Silicon
│ │ └── apl_eval.py # Evaluation for Apple Silicon
│ └── utility/ # Data processing utilities
│ ├── generate_dataset.py # Automated dataset generation
│ └── download_dataset.py # Dataset acquisition utilities
├── README.md # This comprehensive documentation
└── TEST_EXPLAIN.md # Detailed testing documentation
cudafft.py / apl_fft.py)Core Features:
r=8, alpha=32, dropout=0.1r=12, alpha=64, dropout=0.1r=8, alpha=32, dropout=0.1bfloat16 for memory efficiencyKey Components:
# LoRA Configuration Selection
def get_lora_config(model_name: str) -> LoraConfig:
"""Selects optimized LoRA configuration based on model architecture"""
# Custom Dataset Class
class CustomDataset(torch.utils.data.Dataset):
"""Handles instruction-following dataset format with proper tokenization"""
# Enhanced Metrics Callback
class PlotMetricsCallback(TrainerCallback):
"""Real-time training metrics collection and visualization"""
Training Pipeline:
cudamerge.py / apl_merge.py)Functionality:
bfloat16 precision throughout the processCore Process:
def merge_and_save(base_model_name, lora_path, output_path):
"""
Complete model merging pipeline:
1. Load base model and tokenizer
2. Load LoRA adapter using PEFT
3. Merge and unload adapter weights
4. Save consolidated model and tokenizer
"""
cudaeval.py / apl_eval.py)Evaluation Metrics:
Accuracy & Overlap Metrics:
Semantic Similarity:
Quality & Style Metrics:
Evaluation Pipeline:
def evaluate_and_compare(base_model_path, finetuned_model_path, test_data_path, num_samples):
"""
Complete evaluation workflow:
1. Load base and fine-tuned models
2. Generate responses for test dataset
3. Calculate comprehensive metrics
4. Generate comparative visualizations
5. Produce detailed evaluation report
"""
Automated Visualization:
generate_dataset.py)Advanced Features:
Data Pipeline:
Rate Limiting Architecture:
class RateLimiter:
"""
Sophisticated rate limiting with:
- Per-API-key tracking
- Automatic key rotation
- Token-based limiting
- Graceful degradation
"""
bfloat16 for memory efficiency and speedThe project includes a comprehensive testing suite covering all major components:
logic/cuda/tests/)Test Modules:
conftest.py: Shared fixtures and test configurationtest_cudafft.py: Fine-tuning functionality validation (176 lines)test_cudamerge.py: Model merging operation testing (126 lines)test_cudaeval.py: Evaluation framework validation (180 lines)Testing Strategy:
unittest.mockFine-Tuning Tests:
Model Merging Tests:
Evaluation Tests:
Python >= 3.13.x
PyTorch >= 2.0 (with CUDA support)
Transformers >= 4.35.0
PEFT >= 0.6.0
Accelerate >= 0.24.0
NLTK >= 3.8
ROUGE-Score >= 0.1.2
BERTScore >= 0.3.13
TextStat >= 0.7.3
Matplotlib >= 3.7.0
Instructor >= 0.4.0
LiteLLM >= 1.0.0
Pydantic >= 2.0.0
Coloredlogs >= 15.0
# Clone repository
git clone <repository-url>
cd major_project
# Install dependencies
pip install torch transformers peft accelerate
pip install nltk rouge-score bert-score textstat matplotlib
pip install instructor litellm pydantic coloredlogs
# Configure API keys in .env file
export GEMINI_API_KEY="your_api_key_here"
# Generate dataset from logs
python logic/utility/generate_dataset.py \
--input_dir data/ \
--output_file dataset/log_summaries.jsonl \
--chunk_size 10
# CUDA fine-tuning
python logic/cuda/cudafft.py \
--model_name "TinyLlama/TinyLlama-1.1B-Chat-v1.0" \
--dataset_path dataset/log_summaries.jsonl \
--output_dir models/tinyllama_finetuned \
--num_epochs 3 \
--batch_size 4
# Apple Silicon fine-tuning
python logic/apple_silicon/apl_fft.py \
--model_name "TinyLlama/TinyLlama-1.1B-Chat-v1.0" \
--dataset_path dataset/log_summaries.jsonl \
--output_dir models/tinyllama_finetuned \
--num_epochs 3 \
--batch_size 4
# Merge LoRA adapter with base model
python logic/cuda/cudamerge.py \
--base_model_name "TinyLlama/TinyLlama-1.1B-Chat-v1.0" \
--lora_path models/tinyllama_finetuned \
--output_path models/tinyllama_merged
# Comprehensive evaluation
python logic/cuda/cudaeval.py \
--base_model_path "TinyLlama/TinyLlama-1.1B-Chat-v1.0" \
--finetuned_model_path models/tinyllama_merged \
--test_data_path dataset/test_data.jsonl \
--num_samples 100
# Run complete test suite
pytest logic/cuda/tests/ -v
# Run specific test modules
pytest logic/cuda/tests/test_cudafft.py -v
pytest logic/cuda/tests/test_cudamerge.py -v
pytest logic/cuda/tests/test_cudaeval.py -v
# Run with coverage reporting
pytest logic/cuda/tests/ --cov=logic.cuda --cov-report=html
This project represents a comprehensive implementation of LLM-based log summarization with the following key achievements:
The framework provides researchers and practitioners with a robust foundation for investigating LLM applications in log analysis, while offering practical solutions for enterprise-scale log management challenges.
For technical support, bug reports, or research collaboration inquiries, please refer to the project's issue tracker or contact the development team.
Project Status: Active Development
Last Updated: December 2024
Version: 1.0.0
License: [Specify License]
Python
98.6%
Shell
1.4%
This project implements a comprehensive framework for investigating the application of Large Language Models (LLMs) for efficient log summarization. The research develops a customized fine-tuning dataset of logs and their corresponding summaries, fine-tunes multiple LLMs ranging from 50 million to 8 billion parameters, and evaluates their performance using rigorous metrics including BLEU, ROUGE, METEOR, and BERTScore.
The implementation provides a complete end-to-end pipeline supporting both CUDA-enabled GPUs and Apple Silicon processors, with comprehensive testing framework, automated evaluation metrics, and visualization capabilities.
The project is structured as a modular framework with the following key components:
major_project/
├── logic/ # Core implementation modules
│ ├── cuda/ # CUDA-optimized implementations
│ │ ├── cudafft.py # Fine-tuning with LoRA
│ │ ├── cudamerge.py # Model merging utilities
│ │ ├── cudaeval.py # Comprehensive evaluation
│ │ └── tests/ # Comprehensive test suite
│ ├── apple_silicon/ # Apple Silicon optimized implementations
│ │ ├── apl_fft.py # Fine-tuning for Apple Silicon
│ │ ├── apl_merge.py # Model merging for Apple Silicon
│ │ └── apl_eval.py # Evaluation for Apple Silicon
│ └── utility/ # Data processing utilities
│ ├── generate_dataset.py # Automated dataset generation
│ └── download_dataset.py # Dataset acquisition utilities
├── README.md # This comprehensive documentation
└── TEST_EXPLAIN.md # Detailed testing documentation
cudafft.py / apl_fft.py)Core Features:
r=8, alpha=32, dropout=0.1r=12, alpha=64, dropout=0.1r=8, alpha=32, dropout=0.1bfloat16 for memory efficiencyKey Components:
# LoRA Configuration Selection
def get_lora_config(model_name: str) -> LoraConfig:
"""Selects optimized LoRA configuration based on model architecture"""
# Custom Dataset Class
class CustomDataset(torch.utils.data.Dataset):
"""Handles instruction-following dataset format with proper tokenization"""
# Enhanced Metrics Callback
class PlotMetricsCallback(TrainerCallback):
"""Real-time training metrics collection and visualization"""
Training Pipeline:
cudamerge.py / apl_merge.py)Functionality:
bfloat16 precision throughout the processCore Process:
def merge_and_save(base_model_name, lora_path, output_path):
"""
Complete model merging pipeline:
1. Load base model and tokenizer
2. Load LoRA adapter using PEFT
3. Merge and unload adapter weights
4. Save consolidated model and tokenizer
"""
cudaeval.py / apl_eval.py)Evaluation Metrics:
Accuracy & Overlap Metrics:
Semantic Similarity:
Quality & Style Metrics:
Evaluation Pipeline:
def evaluate_and_compare(base_model_path, finetuned_model_path, test_data_path, num_samples):
"""
Complete evaluation workflow:
1. Load base and fine-tuned models
2. Generate responses for test dataset
3. Calculate comprehensive metrics
4. Generate comparative visualizations
5. Produce detailed evaluation report
"""
Automated Visualization:
generate_dataset.py)Advanced Features:
Data Pipeline:
Rate Limiting Architecture:
class RateLimiter:
"""
Sophisticated rate limiting with:
- Per-API-key tracking
- Automatic key rotation
- Token-based limiting
- Graceful degradation
"""
bfloat16 for memory efficiency and speedThe project includes a comprehensive testing suite covering all major components:
logic/cuda/tests/)Test Modules:
conftest.py: Shared fixtures and test configurationtest_cudafft.py: Fine-tuning functionality validation (176 lines)test_cudamerge.py: Model merging operation testing (126 lines)test_cudaeval.py: Evaluation framework validation (180 lines)Testing Strategy:
unittest.mockFine-Tuning Tests:
Model Merging Tests:
Evaluation Tests:
Python >= 3.13.x
PyTorch >= 2.0 (with CUDA support)
Transformers >= 4.35.0
PEFT >= 0.6.0
Accelerate >= 0.24.0
NLTK >= 3.8
ROUGE-Score >= 0.1.2
BERTScore >= 0.3.13
TextStat >= 0.7.3
Matplotlib >= 3.7.0
Instructor >= 0.4.0
LiteLLM >= 1.0.0
Pydantic >= 2.0.0
Coloredlogs >= 15.0
# Clone repository
git clone <repository-url>
cd major_project
# Install dependencies
pip install torch transformers peft accelerate
pip install nltk rouge-score bert-score textstat matplotlib
pip install instructor litellm pydantic coloredlogs
# Configure API keys in .env file
export GEMINI_API_KEY="your_api_key_here"
# Generate dataset from logs
python logic/utility/generate_dataset.py \
--input_dir data/ \
--output_file dataset/log_summaries.jsonl \
--chunk_size 10
# CUDA fine-tuning
python logic/cuda/cudafft.py \
--model_name "TinyLlama/TinyLlama-1.1B-Chat-v1.0" \
--dataset_path dataset/log_summaries.jsonl \
--output_dir models/tinyllama_finetuned \
--num_epochs 3 \
--batch_size 4
# Apple Silicon fine-tuning
python logic/apple_silicon/apl_fft.py \
--model_name "TinyLlama/TinyLlama-1.1B-Chat-v1.0" \
--dataset_path dataset/log_summaries.jsonl \
--output_dir models/tinyllama_finetuned \
--num_epochs 3 \
--batch_size 4
# Merge LoRA adapter with base model
python logic/cuda/cudamerge.py \
--base_model_name "TinyLlama/TinyLlama-1.1B-Chat-v1.0" \
--lora_path models/tinyllama_finetuned \
--output_path models/tinyllama_merged
# Comprehensive evaluation
python logic/cuda/cudaeval.py \
--base_model_path "TinyLlama/TinyLlama-1.1B-Chat-v1.0" \
--finetuned_model_path models/tinyllama_merged \
--test_data_path dataset/test_data.jsonl \
--num_samples 100
# Run complete test suite
pytest logic/cuda/tests/ -v
# Run specific test modules
pytest logic/cuda/tests/test_cudafft.py -v
pytest logic/cuda/tests/test_cudamerge.py -v
pytest logic/cuda/tests/test_cudaeval.py -v
# Run with coverage reporting
pytest logic/cuda/tests/ --cov=logic.cuda --cov-report=html
This project represents a comprehensive implementation of LLM-based log summarization with the following key achievements:
The framework provides researchers and practitioners with a robust foundation for investigating LLM applications in log analysis, while offering practical solutions for enterprise-scale log management challenges.
For technical support, bug reports, or research collaboration inquiries, please refer to the project's issue tracker or contact the development team.
Project Status: Active Development
Last Updated: December 2024
Version: 1.0.0
License: [Specify License]
Python
98.6%
Shell
1.4%