What is Artificial Intelligence?
Artificial Intelligence (AI) is the subfield of computer science dedicated to building systems capable of performing tasks that typically require human cognitiv...
Definition
Artificial Intelligence (AI) is the subfield of computer science dedicated to building systems capable of performing tasks that typically require human cognitive capabilities, such as reasoning, decision-making, pattern recognition, and natural language understanding.
Why It Exists
Traditional software engineering relies on explicit deterministic programming: This model fails for complex tasks like visual recognition or semantic comprehension, where the rules are too intricate to write manually. AI exists to shift the paradigm to: Allowing computer systems to dynamically determine the rules from inputs.
How It Works
AI systems range from simple heuristic/symbolic rule engines to highly complex neural architectures:
[Input Data] ──> [Feature Extraction/Representation] ──> [Inference Engine/Model] ──> [Output Decision]
▲ │
└───────── [Feedback / Learning Loop] ────┘- Input Encoding: Raw data (text, pixels, tabular) is converted into numerical formats.
- Inference / Reasoning: The model processes the numerical input using mathematical representations of logical trees, statistical distributions, or multi-dimensional vector math.
- Action Execution: The model outputs a prediction or decision (e.g., class label, token sequence).
Real-World Example
In GitHub Copilot, the AI system analyzes your current code editor context (surrounding files, comments) and generates the most probable completion. It does not search a database of pre-written templates; it synthesizes code based on learned semantic patterns.
Python Example
Here is a comparison between a hardcoded rule-based agent and a simple learning agent simulating decision-making:
import random
from typing import Dict, List
class RuleBasedAgent:
"""Uses deterministic rules for customer support routing."""
def route_ticket(self, text: str) -> str:
text = text.lower()
if "billing" in text or "invoice" in text or "charge" in text:
return "BILLING_DEPT"
if "login" in text or "password" in text or "reset" in text:
return "IT_SUPPORT"
return "GENERAL_SUPPORT"
class SimpleLearningAgent:
"""Uses empirical feedback to route support tickets dynamically."""
def __init__(self):
# Maps ticket keywords to historical successful resolutions
self.weights: Dict[str, Dict[str, float]] = {
"billing": {"BILLING_DEPT": 1.0, "IT_SUPPORT": 0.0},
"login": {"BILLING_DEPT": 0.0, "IT_SUPPORT": 1.0},
"slow": {"BILLING_DEPT": 0.1, "IT_SUPPORT": 0.9}
}
def route_ticket(self, text: str) -> str:
scores = {"BILLING_DEPT": 0.0, "IT_SUPPORT": 0.0}
words = text.lower().split()
for word in words:
if word in self.weights:
for dept, weight in self.weights[word].items():
scores[dept] += weight
# Fallback to rules if no weights found
if all(score == 0.0 for score in scores.values()):
return "GENERAL_SUPPORT"
return max(scores, key=scores.get)
# Quick demonstration
if __name__ == "__main__":
agent = SimpleLearningAgent()
ticket = "I have a slow connection and cannot login"
print(f"Learning Agent routed ticket to: {agent.route_ticket(ticket)}")Interview Questions
- Beginner: Explain the difference between traditional programming and Artificial Intelligence.
- Intermediate: What is the difference between heuristic-based systems and statistical learning systems?
- Advanced: How do modern software design patterns adapt to handle the non-deterministic output of AI agents?
Interview Answers
- Beginner: Traditional programming uses fixed, developer-defined instructions (rules) to transform data into outputs. AI systems reverse this process; they ingest raw data along with expected outcomes (in supervised learning) to learn patterns and construct dynamic rules.
- Intermediate: Heuristic systems rely on manually coded domain-expert rules (e.g., nested if-else structures). They are highly explainable but fragile. Statistical learning systems infer internal patterns directly from mathematical data representations, making them robust to noise but harder to audit.
- Advanced: Traditional patterns like strict assertions or unit testing fail because AI outputs are non-deterministic. Instead, production architectures use validation gates (e.g., Pydantic schema validation, LLM-based judges), fallback APIs, and decoupled worker queues with retries to handle unstable outputs gracefully.
Common Mistakes
- Treating AI as a magic box: Candidates often assume AI should solve everything. In interviews, don't recommend a deep learning model when a simple database lookup or regular expression suffices.
- Ignoring determinism: Beginners fail to write fallbacks or guardrails for when an AI engine produces unexpected formats.
Assignment
Write a Python script that evaluates the output of an AI text categorizer. If the model's prediction is not in a predefined whitelist of categories (["billing", "tech", "sales"]), fall back to a deterministic regex parser.