Skip to main content

A comprehensive toolkit for LLM evaluation, prompt engineering, fine-tuning, and inference optimization

Project description

LLM Insight Forge

A comprehensive toolkit for working with Large Language Models (LLMs), offering advanced capabilities for evaluation, prompt engineering, fine-tuning, and inference optimization.

PyPI version Python Version License: MIT

Features

LLM Insight Forge provides a modular toolkit for various LLM operations:

📊 Evaluation

  • Text similarity metrics (BLEU, ROUGE)
  • Semantic similarity using embeddings
  • Factuality assessment
  • Hallucination detection
  • Bias detection
  • Coherence and fluency scoring
  • Comprehensive benchmarking

✨ Prompt Engineering

  • Structured prompt templates
  • Prompt optimization techniques
  • Jailbreak detection and prevention
  • Cross-model prompt compatibility

🔧 Fine-Tuning

  • Dataset preparation and preprocessing
  • Supervised fine-tuning (SFT)
  • Parameter-efficient tuning methods (LoRA, P-Tuning, etc.)
  • Training job management and monitoring

⚡ Inference Optimization

  • Model quantization techniques
  • Batched inference processing
  • Caching strategies
  • Hardware-specific optimizations

Installation

pip install llm-insight-forge

For development:

pip install llm-insight-forge[dev]

For building documentation:

pip install llm-insight-forge[docs]

Quick Start

import llm_insight_forge as lif

# Evaluate model responses
score = lif.evaluate_response(
    response="The Earth orbits around the Sun in 365.25 days.",
    reference="The Earth completes one orbit around the Sun in approximately 365.25 days.",
    metrics=["bleu", "semantic_similarity", "factuality"]
)
print(f"Evaluation score: {score}")

# Create and optimize prompts
template = lif.PromptTemplate(
    "Answer the following question about {topic}: {question}"
)
prompt = template.format(
    topic="astronomy",
    question="How long does it take for Earth to orbit the Sun?"
)
optimized_prompt = lif.optimize_prompt(prompt, target_model="gpt-4")

# Prepare datasets for fine-tuning
dataset = lif.prepare_dataset(
    data_path="path/to/data.jsonl",
    instruction_field="instruction",
    input_field="input",
    output_field="output"
)

# Train a model
lif.train_model(
    model_name="meta-llama/Llama-2-7b-hf",
    dataset=dataset,
    method="lora",
    output_dir="./fine_tuned_model"
)

# Optimize inference
quantized_model = lif.quantize_model(
    model_path="./fine_tuned_model",
    bits=4
)

Documentation

For comprehensive documentation, visit our documentation site.

Example Scripts

Check out the examples/ directory for more usage examples:

  • basic_evaluation.py: Simple response evaluation workflow
  • advanced_metrics.py: Using advanced hallucination and bias metrics
  • prompt_optimization.py: Optimizing prompts for different models
  • fine_tuning_example.py: Complete fine-tuning workflow
  • inference_optimization.py: Quantization and batch inference

Contributing

Contributions are welcome! Please check out our contributing guidelines.

License

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

Citation

If you use LLM Insight Forge in your research, please cite:

@software{biswanath2025llminsightforge,
  author = {Roul, Biswanath},
  title = {LLM Insight Forge: A Toolkit for LLM Evaluation and Optimization},
  year = {2025},
  url = {https://github.com/biswanathroul/llm_insight_forge}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_insight_forge-0.1.1.tar.gz (76.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_insight_forge-0.1.1-py3-none-any.whl (66.1 kB view details)

Uploaded Python 3

File details

Details for the file llm_insight_forge-0.1.1.tar.gz.

File metadata

  • Download URL: llm_insight_forge-0.1.1.tar.gz
  • Upload date:
  • Size: 76.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for llm_insight_forge-0.1.1.tar.gz
Algorithm Hash digest
SHA256 db0c207db35f188de2640db7b50a815d85a8ae43ac064e10b125b5c65287b62c
MD5 47eebab0462dbbeeef573654eb36a5f0
BLAKE2b-256 c860718a97158f81e3fe817608718f746b38d60ac77c4152a249ac17eecce041

See more details on using hashes here.

File details

Details for the file llm_insight_forge-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_insight_forge-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 47f8e7aa02b8229e8cee14694ab0a14720717c8e7abe2caa70c3eb6d6dd58a4e
MD5 efeac01d302a09143794b510403dd9c9
BLAKE2b-256 bc67834a54705cecca68774b6b113574d78d9801b1553a8fb106f8988746e06b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page