Skip to main content

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.

  1. 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).

  2. 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.

  3. 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

  1. Clone the repository or download the .zip file.
  2. 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 claim-identification-prompt-tuning 0.1.1

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

Source distribution (sdist)

Source distribution for claim-identification-prompt-tuning 0.1.1
File Size Uploaded Provenance Actions
claim_identification_prompt_tuning-0.1.1.tar.gz 4.6 kB Without provenance Details for claim_identification_prompt_tuning-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for claim-identification-prompt-tuning 0.1.1
File Interpreter ABI Platform Actions
claim_identification_prompt_tuning-0.1.1-py3-none-any.whl Python 3 none any Details for claim_identification_prompt_tuning-0.1.1-py3-none-any.whl

Total release size: 10.0 kB

Release files / claim_identification_prompt_tuning-0.1.1.tar.gz

Download URL claim_identification_prompt_tuning-0.1.1.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7131dd3ae76066ca3805bf6cd6f0ebb434eb1d80caf8114d4bd33a72b231f5e7
BLAKE2b-256 checksum
How to use checksums
9c78dee6de5f22757262939fc2220bb8bd006bebf7894592e1b7c02e6070b956
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Release files / claim_identification_prompt_tuning-0.1.1-py3-none-any.whl

Download URL claim_identification_prompt_tuning-0.1.1-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
544ad8a82e1af373f3d2bd9d95caa819b2241c696f31bce12c19926634c3414f
BLAKE2b-256 checksum
How to use checksums
db6a95feb74dd5bd93b54016c9b3c749cda62ae16fc520c0e3282e2cdc5f5535
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Security for claim-identification-prompt-tuning 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.

Release history Release notifications | RSS feed

This release

0.1.1 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