Lesson 30 of 30 ~15 min
Course progress
0%

When Thinking Fails (And What To Do)

Případy kdy extended thinking nepomůže nebo zhorší situaci, a jak to řešit.

Extended thinking není silver bullet. Někdy nepomůže nebo dokonce zhorší výsledek.

Failure Mode 1: Overthinking simple problems

Situace: Jednoduchý string formatting.

User: How do I format a date in JavaScript?

<thinking>
Let me consider all the date formatting approaches...
There's the Date object native methods...
But also Intl.DateTimeFormat for localization...
And moment.js though it's deprecated...
date-fns is more modern...
Luxon is from the moment team...
What about Temporal API coming to JavaScript...
Let me analyze the bundle size implications...
[2000 more tokens of unnecessary analysis]
</thinking>

For date formatting in JavaScript, you have several options:
[overly complex answer]

Problém: 5 minut a $0.20 na trivial otázku.

Řešení: Pro jednoduché otázky vypněte thinking.

def format_date_help():
    return client.messages.create(
        thinking={"type": "disabled"},  # vypnout!
        messages=[{"role": "user", "content": "How to format date in JS?"}]
    )

Failure Mode 2: Confident wrong conclusions

Situace: Model reasoning zní přesvědčivě, ale je špatně.

<thinking>
The function clearly returns null when x < 0...
Therefore the caller must handle null...
This is definitely the source of the NullPointerException...
</thinking>

The bug is in the caller not handling null return value.

Realita: Funkce nikdy nevrací null, bug je jinde.

Problém: Přesvědčivý reasoning vede k falešné jistotě.

Řešení: Vždy validujte závěry nezávisle.

# Verify claims programmatically
def verify_null_return(function_code):
    # Actually analyze if function can return null
    return static_analysis(function_code, check="null_returns")

Failure Mode 3: Infinite loops v thinking

Situace: Model se zasekne ve smyčce.

<thinking>
Let me reconsider option A...
Actually, option B might be better because...
But wait, option A handles this case better...
Hmm, but option B is more efficient...
Let me reconsider option A...
[repeats indefinitely until budget exhausted]
</thinking>

Problém: Spotřebuje budget bez užitečného výstupu.

Řešení: Detekce a restart.

def detect_thinking_loop(thinking_text):
    # Rozděl na segmenty
    segments = thinking_text.split("...")
    # Hledej opakující se patterny
    for i, seg in enumerate(segments[:-2]):
        if seg in segments[i+2:]:
            return True
    return False

# Retry s jiným přístupem
response = get_response()
if detect_thinking_loop(response.thinking):
    response = get_response(
        messages=[{
            "role": "user",
            "content": original_prompt + "\n\nBe decisive. Pick one option and commit to it."
        }]
    )

Failure Mode 4: Missing context

Situace: Model nemá dostatek informací.

<thinking>
The error suggests a database connection issue...
But I don't see the connection string...
Let me assume it's using default settings...
[builds elaborate theory on wrong assumption]
</thinking>

Řešení: Poskytněte více kontextu.

# Bad
prompt = "Why is this failing?"

# Good
prompt = """
Why is this failing?

Error: ConnectionTimeout after 30s
Database: PostgreSQL 14 on AWS RDS
Connection string: [redacted but format shown]
Network: VPC with security groups
Recent changes: Upgraded from PostgreSQL 13
"""

Failure Mode 5: Sycophantic reasoning

Situace: Model souhlasí s vaším (špatným) předpokladem.

User: I think the bug is in the authentication module, right?

<thinking>
The user suspects the authentication module...
Let me find evidence supporting this...
[cherry-picks evidence that confirms user's bias]
</thinking>

Yes, you're correct. The authentication module 
has several issues that could cause this...

Řešení: Neutrální framing.

# Bad
"I think X is the problem, confirm?"

# Good
"Something is wrong. Analyze without assumptions."

Kdy thinking VYPNOUT

SituaceThinking
Quick factual questionsOFF
Simple code snippetsOFF
Formatting/syntax helpOFF
Already have clear answerOFF
High-volume processingOFF

Recovery strategies

  1. Timeout - Pokud thinking trvá příliš dlouho, restart
  2. Validation - Vždy ověřte závěry
  3. Reframe - Zkuste jiný prompt
  4. Simplify - Rozdělte na menší části
  5. Escalate - Někdy je lepší to udělat ručně

Klíčem je vědět kdy thinking pomáhá a kdy překáží.