noamgat / lm-format-enforcer

Enforce the output format (JSON Schema, Regex etc) of a language model
MIT License
1.57k stars 70 forks source link

Add Trust Score to JSON Output for Quick Reliability Assessment #137

Open wrench1997 opened 2 months ago

wrench1997 commented 2 months ago

Hello,

I'd like to propose a new feature for our module's JSON output. Currently, we provide data in JSON format, but I believe we can enhance its usefulness by adding a "trust score" for each field.

Feature Request:

Benefits:

  1. Quick identification of highly reliable data points
  2. Easier prioritization of which fields may need further verification
  3. Enhanced transparency about the reliability of the output

Example of proposed JSON structure:

{
  "name": {
    "value": "John Doe",
    "trustScore": 0.9
  },
  "age": {
    "value": 30,
    "trustScore": 0.7
  },
  "occupation": {
    "value": "Software Engineer",
    "trustScore": 0.3
  }
}

In this example, the "name" field has a high trust score, indicating high reliability, while the "occupation" field has a lower score, suggesting it may need verification.

Implementation Considerations:

I believe this addition would significantly improve our ability to quickly assess the reliability of our output. It would be particularly useful for prioritizing verification efforts, quality assurance, and improving the overall dependability of our system.

Please let me know your thoughts on this proposal. I'm happy to provide more details or discuss this further if needed.

Thank you for your consideration!

noamgat commented 2 months ago

I'm not sure how this could be handled by API, but if you have a concrete suggestion, I'm open to reading about it. The question of "what is the trust score algorithm" is a very deep and hard one. Its an entire field of research.

It might be related to https://github.com/noamgat/lm-format-enforcer?tab=readme-ov-file#diagnostics---will-i-always-get-good-results , I think users who want to research into hallucinations can use that part of the API