Prompting
Language Models are incredibly sensitive to prompts. The current prompt philosophy of TrustGraph
is to be generic enough to work with most all Language Models. This philosphy means the prompts are not optimized for any one Language Model. Prompt optimization can yield significant performance improvements.
The prompts can be found at:
/trustgraph/model/prompt/generic/prompts.py
There are 4 prompts:
to_relationships
to_definitions
to_topics
to_kg_query
The prompts to_relationships
, to_definitions
, and to_topics
are used in the Naive Extraction
process. The prompt to_kg_query
builds the prompt for Graph RAG
where query
is the request from the test script, tests/test-graph-rag
.
Prompting Tips​
Prompt optimization techniques still vary from one Language Model to the next. Below are some general prompting tips for TrustGraph
:
- Less is more. Keep the prompts as concise as possible.
- Know your chosen Language Model's preferred format whether it's
Markdown
,XML
, or something else. - Avoid words like
summerize
andfacts
. - Some possible words to use to extract information are
claims
,topics
, andarguments
.
Asking a Language Model to summerize
text has the unintended consequence of asking the Language Model to make value judgements on what information in the text is "important". During a Naive Extraction
, it's not possible to know what is important, with the intent to be to extract the maximum amount of information as possible. The word fact
also triggers unintended consequences given most Language Model's training to reduce hallucinations.