Prompt Tuning for Claim Summarization
This Python package provides a tool to generate short summaries for content based on a set of zero-shot examples. The approach leverages prompt tuning to generate summaries of claims from input content using pre-existing models like Gemini, without needing a fine-tuning phase.
Approach
We utilize prompt tuning as the primary method for this project. Instead of fine-tuning the language model (which requires large datasets), we provide prompts by showing the model several examples of "Content" followed by the expected "Summary of Claims". This method is particularly useful when working with small datasets.
-
Data: The input data consists of "Content" (such as a conversation between a user and an agent) and "Reasons" (which are comma-separated summaries of the issues or claims).
-
Zero-shot learning: For each query, we randomly select a subset of examples (e.g., 7) from the dataset to use as reference examples. The prompt generator constructs a natural language prompt from these examples, asking the model to summarize the new content.
-
Evaluation: We evaluate the model's performance using:
- ROUGE Scores: Measures the overlap between the generated summary and the actual summary (Reason).
- Cosine Similarity: Measures the similarity between the TF-IDF vectors of the generated summary and the actual reason.
How to Use
Installation
- Clone the repository or download the
.zipfile. - Ensure you have the required dependencies installed. You can install them using the following:
pip3 install setuptools
Usage
This package exposes two main functions to the user:
1. Performance Evaluation (perfomance_on_data)
This function evaluates the model's performance across the entire dataset by generating summaries and calculating ROUGE and Cosine Similarity metrics.
from your_package_name import perfomance_on_data
# Evaluate the performance on the dataset
perfomance_on_data()
Output:
- The function will print out the generated summaries, the actual summaries, ROUGE scores, and Cosine Similarity scores for each example.
- It will also print the average ROUGE and Cosine Similarity scores across all examples.
2. Generate Summary on Query (genrate_on_query)
This function allows the user to input a query (i.e., new content) and receive a generated summary of claims based on the trained model.
from your_package_name import genrate_on_query
# Generate summary for a user-provided query
genrate_on_query()
Dependencies
transformers: For utilizing pre-trained language models.sklearn: For cosine similarity and vectorization.rouge: For calculating ROUGE scores.
This package offers a lightweight and flexible way to generate summaries using zero-shot learning and can be integrated into any workflow requiring natural language summarization.
Metadata
Release files for IdentificationOfClaims 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| IdentificationOfClaims-0.1.1.tar.gz | 4.5 kB | Without provenance | Details for IdentificationOfClaims-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| IdentificationOfClaims-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for IdentificationOfClaims-0.1.1-py3-none-any.whl |
Total release size: 9.8 kB
Release files / IdentificationOfClaims-0.1.1.tar.gz
| Download URL | IdentificationOfClaims-0.1.1.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db7549dc4dd52cbc5bd573a5345a6ec756bc0995928b1fe435c4618af4a77948
|
|
BLAKE2b-256 checksum How to use checksums |
88d0034d80de6865f32204baba88750ef56585bc3e28c0ad5868ce95636c993a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|
Release files / IdentificationOfClaims-0.1.1-py3-none-any.whl
| Download URL | IdentificationOfClaims-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d40ac089f2da7bd47f84e04beb0937b9abb07d7fae5617c6f47b833fb5306329
|
|
BLAKE2b-256 checksum How to use checksums |
93251b461386196c2001714a0e61faab11808f0fc16d06cb9afae0de78b1b9f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|
Security for IdentificationOfClaims 0.1.1
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.