Challenge - 5 Problems
Contextual Compression Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate1:30remaining
What is the main goal of contextual compression in AI?
Contextual compression is used in AI to reduce the size of input data while preserving important information. What is the primary goal of this technique?
Attempts:
2 left
💡 Hint
Think about how compression should keep what matters most for understanding.
✗ Incorrect
Contextual compression aims to keep only the parts of data that are important for the current context, removing redundant or irrelevant information to make processing efficient.
❓ Predict Output
intermediate1:30remaining
Output of simple contextual compression code snippet
Given the following Python code that simulates a simple contextual compression by filtering words based on a context list, what is the output?
Prompt Engineering / GenAI
text = 'The quick brown fox jumps over the lazy dog' context_words = {'quick', 'fox', 'dog'} compressed = ' '.join([word for word in text.split() if word in context_words]) print(compressed)
Attempts:
2 left
💡 Hint
Look at which words are kept based on the context_words set.
✗ Incorrect
The code keeps only words that are in the context_words set. Those are 'quick', 'fox', and 'dog', joined by spaces.
❓ Model Choice
advanced2:00remaining
Choosing the best model for contextual compression in text data
You want to compress large text data by keeping only contextually important information for a chatbot. Which model type is best suited for this task?
Attempts:
2 left
💡 Hint
Think about models that understand context and relationships in sequences.
✗ Incorrect
Transformer models with attention can focus on important parts of text, making them ideal for contextual compression.
❓ Metrics
advanced1:30remaining
Evaluating contextual compression quality
Which metric best measures how well a contextual compression method preserves important information while reducing data size?
Attempts:
2 left
💡 Hint
Consider how to check if important information is still present after compression.
✗ Incorrect
Reconstruction accuracy or similarity scores show how much important information is preserved after compression and decompression.
🔧 Debug
expert2:00remaining
Debugging a contextual compression function that fails to filter correctly
This Python function is supposed to compress text by keeping only words in a given context set. What error or issue does it have?
Prompt Engineering / GenAI
def compress_text(text, context_set): return ' '.join(word for word in text if word in context_set) result = compress_text('hello world', {'hello'}) print(result)
Attempts:
2 left
💡 Hint
Look at what 'for word in text' iterates over in Python strings.
✗ Incorrect
Iterating over a string yields characters, not words. So the function filters letters, not words, causing incorrect compression.