Learning by Experimentation
My First Steps with Claude

Whenever I start learning something new, I’ve noticed one thing consistently helps: experimentation.
Without understanding the foundational concepts, complex terminology and fast-moving AI trends rarely make sense.
My approach is simple:
Pick a platform
Read the official documentation
Experiment with small, focused examples
Learn how each concept behaves in practice
For this journey, I chose Claude and started directly from its documentation.
Starting Simple with Claude Haiku
To keep things lightweight and focused, I began with the Claude Haiku model.
It’s fast, cost-efficient, and ideal for understanding how inference parameters work without too much noise.
I used the claude-3-haiku-20240307 model to build a very simple chatbot that interacts with the Claude API.
Key Parameters to Understand
Before diving into the code, there are a few important parameters worth understanding:
max_tokens
Sets the maximum length of the model’s output (measured in tokens).temperature
Controls how creative or random the model’s responses are.Ranges from0.0to1.0Top-K Sampling
Restricts the model to only consider the K most likely tokens at each step.Top-P (Nucleus Sampling)
Allows the model to consider the smallest group of tokens whose combined probability is at least P.
In simple terms:
Bigger
max_tokens→ longer responsesSmaller
max_tokens→ concise responses, possibly cut offLower
temperature→ predictable, factual outputHigher
temperature→ more expressive and varied language
A Simple Claude Chatbot Example
Below is a minimal chatbot loop that sends user input to Claude and prints the response:
import os
from anthropic import Anthropic
client = Anthropic()
while True:
user_input = input("You: ")
if user_input.lower() in ["exit", "quit"]:
break
response = client.messages.create(
model="claude-3-haiku-20240307",
max_tokens=100,
messages=[
{"role": "user", "content": user_input}
],
temperature=0.0
)
print("Claude:", response.content[0].text)
Observing Temperature in Action
To understand how temperature affects output, I used a simple prompt:
Input
Describe India
Output with temperature = 0.0
India is a vast and diverse country located in South Asia. It is the second-most populous country in the world, with over 1.3 billion people, and is known for its rich cultural heritage, vibrant traditions, and stunning natural landscapes.
Here are some key aspects of India:
1. Geography: India is a peninsula, bordered by the Indian Ocean, the Arabian Sea, and the Bay of Bengal...
Output with temperature = 1.0
Here's a brief overview of India:
Geography:
- India is a large country located in South Asia, covering an area of over 3.2 million square km.
- It is bordered by the Arabian Sea, the Bay of Bengal, and the Indian Ocean.
- The geography is diverse, ranging from the Himalayan mountains in the north to tropical rainforests in the south.
Key Learning
Even though the information remains correct, changing the temperature alters:
sentence structure
verbosity
tone and flow
This small experiment made it clear that parameters don’t change knowledge — they change expression.
Final Thought
Reading documentation gives you the theory, but running small experiments builds intuition.
Once these fundamentals are clear, more advanced concepts and newer AI capabilities start to make much more sense.
This is just the beginning of my learning journey—and I plan to keep experimenting as I go.



