Coding Fact Check Course
Coding Fact Check Course
Your work and inputs on this project will help improve a cutting edge large
language model to provide more helpful, factually accurate and non-verbose
responses. You will achieve this by rating two responses from the model on various
rating dimensions. The ratings are not based on “feels” but have a structured
approach on arriving at a rating, something we will walk you through in this
document.
This is a highly impactful project that will generate a dataset which will improve
current LLM capabilities. The data you are generating is extremely valuable not
only for the effort you are putting on it but also for the expensive nature of
training these models - we greatly appreciate your diligent, careful and
intelligent work. Having mentioned this, let's get into learning more about how to
complete these tasks correctly.
Why is it needed?
This course guides you through the correct workflow for Fact Check and how to
provide an accurate list of facts and sources.
PROMPT:
In a JSON, list all 4 movies in the Fantastic Beasts series and the year they were
released.
RESPONSE:
There are currently only 3 Fantastic Beasts movies, as a fourth movie does not yet
exist.
FACT CHECK:
Source: https://www.imdb.com/list/ls068935621/
Excerpt: Fantastic Beasts and Where to Find Them, Fantastic Beasts: The Crimes of
Grindelwald, Fantastic Beasts: The Secrets of Dumbledore (as of July 2024)
✅ EXAMPLE 2
PROMPT:
i want to replace action verbs in a sentence with all of its tense form like in
combination way. how to do that in python
RESPONSE:
Response 1
To achieve this in Python, you can use the `inflect` library to find the different
tenses of a verb. First, you'll need to install the library using pip:
BASH
1 pip install inflect
Then, you can use the following function to replace action verbs in a sentence with
all of their tense forms:
Python
1 import inflect
2 import re
4 def replace_verbs_with_tenses (sentence):
Collapse
5
p = inflect.engine()
6
verb_pattern = r'\b[^\W_]C? : [^\W_] I (?<=\W))+\b'
|
7
8
verbs = re.findall (verb_pattern, sentence, re. IGNORECASE)
9
10
11
12
tenses = {verb: p.conjugate(verb, tense) for verb in verbs for tense in ['present
for verb, tenses_list in tenses.items():
for tense in tenses_list:
13
sentence sentence.replace(verb, f" [{tense}]")
14
15
return sentence
16
17 # Example usage:
18 sentence = "I walk to the store every day. She walked home yesterday. They will
visit 19 result replace_verbs_with_tenses (sentence)
20 print(result)
This will output:
1 I [walk] to the store every day. She [walked] home yesterday. They [will visit]
us next
FACT CHECK:
Source: https://pypi.org/project/inflect/
Excerpt: The inflect library in Python is not designed to handle verb tense
conjugations.
Source: https://pypi.org/project/spacy/
Excerpt: Verbs are more accurately identified using a library like spaCy for
advanced Natural Language Processing in Python.
“Source: NA
Excerpt: NA”
PROMPT:
What is 1+1?
RESPONSE:
1 + 1 equals 2.
FACT CHECK:
❌ EXAMPLE 2 – The model suggests a library for the code, and uses it correctly on
the code.
Apply the techniques you've learned to Fact Check your responses correctly and
improve the quality of your work.