Real-World Use Cases for Predicted Outputs
On this page
Three Families of Use Cases
The common thread across these three families is simple: Predicted Outputs pay off when most of the output is known in advance. The nature of the task—code, text, or template—matters less than the proportion of the result you can provide as a prediction. At 90% unchanged content, the gain is dramatic; at 30%, it becomes negligible, regardless of the use case.
Keep this ratio in mind as you explore the three families below. They represent scenarios where that ratio is naturally high. In this lesson, you’ll see concrete examples for each category, along with patterns you can replicate in your own applications.
Use Case 1: Code Editing
This is the most natural fit because code mechanically maximizes the ratio: renaming a variable in a 500-line file leaves 498 lines strictly identical. You start with an existing source file and want to make a targeted change. The model only needs to regenerate the modified lines.
Rename a Variable
existing_code = """
def calculate_total(items):
tax_rate = 0.20
subtotal = sum(item.price for item in items)
tax = subtotal * tax_rate
total = subtotal + tax
return total
"""
prompt = (
"Rename the variable 'tax_rate' to 'vat_rate' throughout this code. "
"Reply with only the modified code."
)
response = client.chat.complete(
model="codestral-latest",
messages=[
{"role": "user", "content": prompt},
{"role": "user", "content": existing_code}
],
prediction={"type": "content", "content": existing_code}
)
The model knows the code structure remains identical. It only recalculates the tokens affected by the rename.
Change an Import or Dependency
existing_code = """
from flask import Flask, request, jsonify
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
@app.route('/api/predict', methods=['POST'])
def predict():
data = request.get_json()
result = model.predict(data['input'])
return jsonify({'prediction': result})
"""
prompt = (
"Migrate this code from Flask to FastAPI. "
"Keep the same business logic. "
"Reply with only the code."
)
response = client.chat.complete(
model="codestral-latest",
messages=[
{"role": "user", "content": prompt},
{"role": "user", "content": existing_code}
],
prediction={"type": "content", "content": existing_code}
)
Use Case 2: Text Editing
Text follows the same logic as code, with one important nuance: text changes are often less localized than you might think. Changing a number in a report can trigger rewrites of the sentence commenting on it, the summary paragraph, and the conclusion. The gain is real, but measure it on your actual documents rather than assuming it equals the gain you see with code.
Update a Section in a Report
report = """
# Q4 2025 Quarterly Report
## Executive Summary
Revenue reached €2.3M in Q4 2025, up 15%
from Q3. Operating margin stands at 22%.
## Sales Performance
The sales team signed 47 new contracts, including 12 key accounts.
Average deal size grew 8% to €49,000.
## Q1 2026 Outlook
We anticipate 10% growth driven by the launch of the
Enterprise product and expansion into the German market.
"""
prompt = (
"Update this report for Q1 2026 with the following data: "
"Revenue = €2.7M (+17%), margin = 24%, 53 new contracts, "
"average deal size = €51,000 (+4%). "
"For the Q2 outlook, mention expansion into the Benelux region. "
"Keep the exact same structure."
)
response = client.chat.complete(
model="mistral-large-latest",
messages=[
{"role": "user", "content": prompt},
{"role": "user", "content": report}
],
prediction={"type": "content", "content": report}
)
Use Case 3: Template Filling
When you have a fixed template where only a few values change, prediction is nearly perfect:
email_template = """
Hello {name},
Following up on our conversation on {date}, I confirm the following points:
1. The {project} project will start on {start_date}
2. The team will consist of {num_people} people
3. The estimated budget is €{budget} (excl. tax)
I remain at your disposal for any questions.
Best regards,
{signatory}
"""
# Partially fill the template for prediction
prediction = email_template.replace("{name}", "Mr. Dupont")
prediction = prediction.replace("{signatory}", "Marie Martin")
prompt = (
"Complete this email with the following information: "
"date = March 28, 2026, project = Cloud Migration, "
"start_date = April 15, 2026, num_people = 5, "
"budget = 85,000."
)
response = client.chat.complete(
model="mistral-large-latest",
messages=[
{"role": "user", "content": prompt},
{"role": "user", "content": prediction}
],
prediction={"type": "content", "content": prediction}
)
Measuring Real-World Gains
To evaluate the effectiveness of Predicted Outputs for your use case, systematically compare runs with and without prediction:
import time
# Without prediction
start = time.time()
resp_normal = client.chat.complete(
model="mistral-large-latest",
messages=messages
)
time_normal = time.time() - start
# With prediction
start = time.time()
resp_predicted = client.chat.complete(
model="mistral-large-latest",
messages=messages,
prediction={"type": "content", "content": predicted_content}
)
time_predicted = time.time() - start
gain = (1 - time_predicted / time_normal) * 100
print(f"Without prediction: {time_normal:.2f}s")
print(f"With prediction: {time_predicted:.2f}s")
print(f"Latency gain : {gain:.1f}%")
The gain varies based on the percentage of content correctly predicted. For a 5% change in a 500-line file, expect a 60% to 80% reduction in latency.
Key Takeaways
- Code editing (renaming, migration, light refactoring) is the primary use case
- Text editing (reports, documents) benefits from stable structure
- Templates with a few dynamic values offer the best gain-to-effort ratio
- Always measure the real-world gain in your context before deploying to production