Skip to main content

ConSCompF: Consistency-focused Similarity Comparison Framework

Python implementation of ConSCompF - LLM similarity comparison framework that accounts for instruction consistency proposed in the original paper.

LLM comprarison using ConSCompF

Features

  • Generates LLM similarity matrices and compresses them using PCA.
  • Can be used in few-shot scenarios.
  • Supports multiple input formats including lists, HF datasets, and pandas DataFrames.
  • Supports different return types including lists, PyTorch tensors, and pandas DataFrames.
  • Supports embedding caching.

Installation

Currently, there is no package available on pip. You can build and install it manually:

git clone https://github.com/alex-karev/conscompf
cd conscompf
python -m build .
pip install .

Usage

from conscompf import ConSCompF

conscompf = ConSCompF(quiet=True)

data: list[dict[str, list[str]]] = [
    {
        "model1": [
            "Text 1...",
            "Text 2...",
        ], 
        "model2": [
            "Text 1...",
            "Text 2...",
        ], 
    }, {
        "model1": [...],
        "model2": [...]
    }, ...
] # Or use HF dataset with a similar structure

out = conscompf(data, return_type="df") # Available return types: pt, df, list

print(out["sim_matrix"])
print(out["pca"])
print(out["consistency"])

The same minimalistic example, but with real data can be found in examples/simple.py.

More examples are available in examples directory.

For a full list of available functions and arguments use the documentation:

pydoc conscompf.ConSCompF

Citation

This project is currently contributed by Alexey Karev and Dong Xu from School of Computer Engineering and Science of Shanghai University.

If you find our work valuable, please cite:

 @article{
    Karev_Xu_2025, 
    title={ConSCompF: Consistency-focused Similarity Comparison Framework for Generative Large Language Models}, 
    volume={82}, 
    ISSN={1076-9757}, 
    DOI={10.1613/jair.1.17028},
    journal={Journal of Artificial Intelligence Research}, 
    author={Karev, Alexey and Xu, Dong}, 
    year={2025}, 
    month=mar, 
    pages={1325–1347} 
}

The original dataset used during the experiments described in the original paper is available here.

Contribution

Feel free to fork this repo and make pull requests.

Lisense

Free to use under Apacha 2.0. See LICENSE for more information.

Metadata

Release files for conscompf 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for conscompf 0.2
File Size Uploaded Provenance Actions
conscompf-0.2.tar.gz 94.0 kB Without provenance Details for conscompf-0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for conscompf 0.2
File Interpreter ABI Platform Actions
conscompf-0.2-py3-none-any.whl Python 3 none any Details for conscompf-0.2-py3-none-any.whl

Total release size: 103.8 kB

Release files / conscompf-0.2.tar.gz

Download URL conscompf-0.2.tar.gz
Size 94.0 kB
Tags Source
SHA-256 checksum
How to use checksums
aff27a34a7244b68a9e388f4c3575616f396287812f5e89f7468643ae6c6c560
BLAKE2b-256 checksum
How to use checksums
9f2d640bb786d0b8c63d20c9e6571d3e07eba60458ddaf3b4d0a2bf0ea638eec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.16

Release files / conscompf-0.2-py3-none-any.whl

Download URL conscompf-0.2-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea82a61d61d7f0ebc9cc6927077fb6e34048ab2ebdc0383f985b1eba020c06e2
BLAKE2b-256 checksum
How to use checksums
66f934c48329fcc77f603d0bb7ef6c288e76608ea7f793be66da038c8b980b8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.16

Security for conscompf 0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page