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.
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]
Checking the Version
You can check the installed version using the command-line interface:
llm-insight-forge --version
Or from within Python:
import llm_insight_forge as lif
print(lif.__version__)
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
)
Example Scripts
Check out the examples/ directory for more usage examples:
basic_evaluation.py: Simple response evaluation workflowadvanced_metrics.py: Using advanced hallucination and bias metricsprompt_optimization.py: Optimizing prompts for different modelsfine_tuning_example.py: Complete fine-tuning workflowinference_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}
}
Metadata
Release files for llm-insight-forge 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| llm_insight_forge-0.1.2.tar.gz | 76.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llm_insight_forge-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 143.5 kB
Release files / llm_insight_forge-0.1.2.tar.gz
| Download URL | llm_insight_forge-0.1.2.tar.gz |
|---|---|
| Size | 76.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ddf18bdca4b1307ce1529449613a1d74e2ec74dd551e03ee5a72c6d1d39e028f
|
|
BLAKE2b-256 checksum How to use checksums |
f6c541d146c5dc9aab80ef2ca496e25f644fe003b1a546428c992e1cb92aabbc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.5
|
Release files / llm_insight_forge-0.1.2-py3-none-any.whl
| Download URL | llm_insight_forge-0.1.2-py3-none-any.whl |
|---|---|
| Size | 66.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4cf3d57b6c384b0362e5c98498179c90bdcb15c52f2e82b40ac3e61eb9499609
|
|
BLAKE2b-256 checksum How to use checksums |
bdca128d7081c5e3b68ba9d4c268349ea0e95e9642b4c1f9bbaa2e0288baaa94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.5
|