Text2Graph1.5B Model
This model was fine-tuned with reinforcement learning to extract structured information from text inputs.
Model Details
- Model Type: Causal Language Model (fine-tuned with RL)
- Training Method: Policy Gradient with adaptive baseline
- Language: English
- License: Proprietary
- Limitations: This model is specifically trained for structured information extraction tasks
Usage
You can use this model to extract structured information from text with the following code:
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load the model and tokenizer
device = "cuda" if torch.cuda.is_available() else "cpu"
model = AutoModelForCausalLM.from_pretrained("paytm/text2graph1.5b-original")
tokenizer = AutoTokenizer.from_pretrained("paytm/text2graph1.5b-original")
# Move model to appropriate device
model = model.to(device)
# Prepare your input text
text = '''
{
"task": "Extract structured information from SMS messages to identify financial details, message purpose, and related information",
"instructions": [
"Carefully read and analyze the entire SMS text without adding any information not present",
"Identify only the key themes that are explicitly mentioned in the SMS - do not infer themes that aren't directly supported by the text",
"Determine the primary purpose of the message according to exactly one of the predefined categories - do not create new categories",
"For credit notifications/deposits, categorize as 'settlement notification by payment aggregator' or 'refund information' as appropriate",
"Extract only product types that are explicitly mentioned - do not assume a product type if not clearly stated",
"For customer name, only extract clearly identifiable personal names - do not include the entire SMS message or transaction IDs",
"Differentiate between the sender's bank and the recipient's bank in credit/transfer messages",
"Do not confuse account credits/payments with bill reminders or payment failures",
"Extract exact monetary values as presented in the SMS",
"Always open and close output with <> and </>",
"Make sure you return the the numeric details and named entities only mentioned in latest_input.",
"Make sure to parse out the aggregator name like google pay/gpay/google pay pvt ltd/etc , PhonePe/phonepe/PhonePe pvt ltd/etc , paytm/one97/etc wherever mentioned."
],
"constraints": [
"Only extract information that is explicitly stated in the SMS text",
"Return null for any fields where information is not present",
"Do not invent or infer information that isn't directly stated in the text",
"Convert all monetary values to float numbers without currency symbols or commas",
"Format dates consistently when possible (YYYY-MM-DD format preferred)",
"Do not make assumptions about information that isn't clearly stated",
"Categorize message types strictly according to the predefined list",
"Focus on the primary purpose of the message, not tangential information",
"Do not include transaction IDs, account numbers, or UTR numbers in any of the fields",
"Return a clean JSON object with no extraneous characters or formatting"
],
"format": "Return a JSON object with the following fields extracted from the SMS text. Include only these exact fields in the response, using null for any fields where the information isn't present in the SMS.Make sure the json is well formed and no parsing or json laoding error exists",
"consistency_checklist": [
"key_themes: Extract only 3-5 main themes actually discussed in the SMS as an array of strings - avoid redundant or fabricated themes",
"message_type: Categorize as exactly one of: alert message, delayed payment, repayment reminder, auto-pay reminder, refund information, payment failed information, settlement notification by payment aggregator, loan_emi_reminder, emi_confirmation, loan_offer, new_merchant_acquisition, product_offer",
"product_type: Identify as one of: credit card, debit card, home loan, vehicle loan, merchant_qr_kit, soundbox (or null if not mentioned)",
"aggregator_name: Extract payment aggregator name like paytm, phonepe, gpay , bharatpe, one 97 communications (or null if not mentioned). The namees can be written with differen caps lock , inside urls etc. Pay attention and extract it correctly.Do not return bank names in aggregators",
"bank_nbfc_fintech_name: Extract the name of the financial institution the message is from (or null if not present). A bank might have aggregator service but dont confuse the bank with aggregator",
"emi_amount: Extract only a clearly identified EMI amount as a float number (or null if not mentioned)",
"Total_overdue_amount: Extract only a clearly identified total overdue or bill amount as a float (or null if not mentioned)",
"available_bank_balance: Extract only a clearly identified available bank balance as a float (or null if not mentioned). Do not mention available balance when not given",
"min_overdue_amount: Extract only a clearly identified minimum amount due as a float (or null if not mentioned)",
"overdue_date: Extract only a clearly identified payment due date as string (or null if not mentioned)",
"collection_team_lead: Extract only explicit mentions of collection team involvement (or null if not present)",
"legal_notice: Extract only explicit mentions of legal notices (or null if not mentioned)",
"customer_name: Extract only an explicitly identified customer name (or null if not mentioned)",
"settlement_amount": Amount credited by the aggregator to the bank account of the merchant/customer,
],
**example**
<input>"Dear Qagent, your XYZ credit card bill of Rs. 24,500 is due on 15-Jul-2023. Min amount due: Rs. 2,450. Account balance on 3-Jul-2023 is Rs 5,000.Pay now to avoid late fees. - XYZ Bank"</input>
<output>{
"key_themes": ["credit card bill reminder", "payment due", "late fee warning"],
"message_type": "repayment reminder",
"product_type": "credit card",
"aggregator_name": null,
"bank_nbfc_fintech_name": "XYZ Bank",
"emi_amount": null,
"Total_overdue_amount": 24500.0,
"available_bank_balance": 5000.0,
"min_overdue_amount": 2450.0,
"overdue_date": "2023-07-15",
"collection_team_lead": null,
"legal_notice": null,
"customer_name": "Qagent",
"settlement_amount":null
}</output>
<input>"{input}"</input>
<output>
'''
# Tokenize input and generate output
inputs = tokenizer(text, return_tensors="pt")
outputs = model.generate(**inputs.to("cuda"), max_new_tokens=185,do_sample=False,top_k=None,temperature=1.0,top_p=None)
# Decode the output
result = tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True)
print(result)
Quantized Versions
This model is available in multiple quantized versions:
- Original: Full precision model
- INT8: 8-bit quantized version for reduced memory usage
- INT4: 4-bit quantized version for minimal memory usage
- CPU Optimized: Version optimized for CPU inference
Benchmark Results
Performance metrics will be added soon.
Limitations and Biases
This model is specifically designed for structured information extraction tasks and may not perform well for general language tasks. The model should be used with appropriate input prompts as shown in the usage example.
- Downloads last month
- 19
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
๐
Ask for provider support
HF Inference deployability: The model has no library tag.