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.0.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.0-py3-none-any.whl (66.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llm_insight_forge-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 e68455fe0bf715a63e26117eebd5d8a8ab59d0d9421571dd7c16cc3a299290f6
MD5 12643a97af670741c8c35de40910e419
BLAKE2b-256 a53c1083c91c076423039bb6efaeb98b3ff9e040c2141544778d4b7a96f1290e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llm_insight_forge-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3049c9b31d9e4ef6baf6680afd5704d7b8b0e0928356ad58e5c05de9b8581189
MD5 5834a2b521dfbbd1953acb283cebd068
BLAKE2b-256 d8ef6a79a1b9606378f83192a3f7121d79a41322db7f8a79e023153d6bea1084

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