0
0
Prompt Engineering / GenAIml~20 mins

Load balancing for AI services in Prompt Engineering / GenAI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Load Balancing Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What is the main purpose of load balancing in AI services?

Load balancing helps AI services handle many requests efficiently. What is its main goal?

ATo reduce the accuracy of AI predictions to speed up processing
BTo increase the size of the AI model automatically during high demand
CTo evenly distribute incoming requests across multiple AI servers to prevent overload
DTo store all AI data in a single server for faster access
Attempts:
2 left
💡 Hint

Think about how to avoid one server getting too busy while others are idle.

Predict Output
intermediate
1:30remaining
What output does this load balancing code produce?

Consider this Python code simulating round-robin load balancing for AI requests:

servers = ['AI1', 'AI2', 'AI3']
requests = 5
assignments = []
for i in range(requests):
    server = servers[i % len(servers)]
    assignments.append(server)
print(assignments)

What is the printed output?

Prompt Engineering / GenAI
servers = ['AI1', 'AI2', 'AI3']
requests = 5
assignments = []
for i in range(requests):
    server = servers[i % len(servers)]
    assignments.append(server)
print(assignments)
A['AI1', 'AI1', 'AI1', 'AI1', 'AI1']
B['AI3', 'AI2', 'AI1', 'AI3', 'AI2']
C['AI2', 'AI3', 'AI1', 'AI2', 'AI3']
D['AI1', 'AI2', 'AI3', 'AI1', 'AI2']
Attempts:
2 left
💡 Hint

Look at how the modulo operator cycles through the server list.

Hyperparameter
advanced
2:00remaining
Which hyperparameter affects load balancing efficiency in AI model serving?

When deploying AI models behind a load balancer, which hyperparameter most directly impacts how well the load is balanced?

ABatch size of requests processed by each AI server
BLearning rate of the AI model during training
CNumber of layers in the AI model architecture
DDropout rate used in the AI model
Attempts:
2 left
💡 Hint

Think about what controls how many requests a server handles at once.

Metrics
advanced
1:30remaining
Which metric best indicates load balancing effectiveness in AI services?

You monitor AI servers behind a load balancer. Which metric best shows if load balancing is working well?

ATotal number of AI model parameters
BVariance in CPU usage across all AI servers
CTraining accuracy of the AI model
DSize of the AI model file on disk
Attempts:
2 left
💡 Hint

Good load balancing means servers work evenly. What shows uneven work?

🔧 Debug
expert
2:30remaining
Why does this AI load balancer code cause uneven request distribution?

Review this Python code snippet for load balancing AI requests:

servers = ['AI1', 'AI2', 'AI3']
requests = 6
assignments = []
for i in range(requests):
    server = servers[(i // 2) % len(servers)]
    assignments.append(server)
print(assignments)

Why does this code cause uneven load distribution?

Prompt Engineering / GenAI
servers = ['AI1', 'AI2', 'AI3']
requests = 6
assignments = []
for i in range(requests):
    server = servers[(i // 2) % len(servers)]
    assignments.append(server)
print(assignments)
ABecause each server gets two consecutive requests before switching, causing bursts
BBecause the modulo operator is used incorrectly causing index errors
CBecause the loop runs fewer times than the number of requests
DBecause the servers list is empty, causing an error
Attempts:
2 left
💡 Hint

Look at how the index changes with integer division.