0
0
Prompt Engineering / GenAIml~20 mins

Factual consistency checking in Prompt Engineering / GenAI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Factual Consistency Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is the main goal of factual consistency checking in AI-generated text?
Choose the best description of what factual consistency checking aims to achieve in AI-generated content.
AMaximizing the length of the generated text regardless of content.
BEnsuring the generated text matches the facts in the source or knowledge base.
CImproving the creativity and style of the generated text without regard to facts.
DReducing the computational cost of generating text.
Attempts:
2 left
💡 Hint
Think about why we want AI to be truthful and accurate.
Predict Output
intermediate
2:00remaining
Output of a simple factual consistency check using cosine similarity
Given the following Python code snippet that compares embeddings of a source and generated sentence, what is the printed output?
Prompt Engineering / GenAI
from sklearn.metrics.pairwise import cosine_similarity
import numpy as np

source_embedding = np.array([[0.1, 0.3, 0.5]])
generated_embedding = np.array([[0.1, 0.3, 0.5]])
similarity = cosine_similarity(source_embedding, generated_embedding)[0][0]
print(round(similarity, 2))
A1.0
B0.0
C0.5
DError: cosine_similarity requires 2D arrays
Attempts:
2 left
💡 Hint
Cosine similarity of identical vectors is 1.
Model Choice
advanced
2:00remaining
Best model type for factual consistency checking in text generation
Which model type is most suitable for checking factual consistency between a source document and generated summary?
ABinary classifier trained to predict if generated text is factually consistent with source
BSequence-to-sequence model trained for summarization
CUnsupervised clustering model grouping similar documents
DGenerative adversarial network (GAN) for image generation
Attempts:
2 left
💡 Hint
Think about a model that can say yes or no about factual correctness.
Metrics
advanced
2:00remaining
Which metric directly measures factual consistency in generated text?
Among these metrics, which one is designed specifically to evaluate factual consistency between generated text and source content?
ABLEU score
BPerplexity
CFactCC score
DROUGE score
Attempts:
2 left
💡 Hint
This metric was created for factual consistency evaluation.
🔧 Debug
expert
3:00remaining
Why does this factual consistency check code fail to detect errors?
Consider this Python code snippet that compares source and generated sentences using exact string match for factual consistency. Why might it fail to detect factual errors?
Prompt Engineering / GenAI
source = "The Eiffel Tower is in Paris."
generated = "The Eiffel Tower is in Berlin."
consistent = (source == generated)
print(consistent)
AIt always returns True because variables are assigned incorrectly.
BIt raises a TypeError because strings cannot be compared with '=='.
CIt uses cosine similarity which is not suitable for strings.
DIt only checks exact string equality, so it misses factual differences in similar sentences.
Attempts:
2 left
💡 Hint
Think about what comparing two sentences by '==' really means.