You walk into a restaurant you've never visited before. Within seconds, you know what to expect: a host, a menu, a table, the ritual of ordering, the eventual bill. You didn't learn this from scratch—your brain pulled a pre-packaged knowledge structure called "restaurant" from memory and filled in the blanks.
That's exactly what frames in artificial intelligence try to do for machines.
Marvin Minsky formalized this idea in 1974, and here's the thing that surprises most developers I talk to: frames aren't some dusty academic relic. They're quietly running under the hood of modern knowledge representation systems—Google's Knowledge Graph, medical diagnosis engines, even the structured reasoning layers wrapped around today's LLMs.
This guide is written for IT professionals who need to understand frames well enough to build with them. We'll cover the core structure, how inheritance works, the infamous frame problem, Python implementation, and where frames fit in the 2026 AI landscape.
What Are Frames in AI? Core Components and Structure
A frame is a data structure that represents a concept, object, or situation. Think of it as a labeled container with compartments. The container has a name—"Car," "Patient," "Restaurant"—and inside are slots that hold specific pieces of information.
What makes frames powerful isn't just the organization. It's that they let an AI system reason with the knowledge, not just store it.
The Anatomy of a Frame: Slots, Fillers, and Defaults
Every frame has three essential building blocks:
Slots are the attributes or properties. For a "Car" frame, slots might include brand, color, engine_type, max_speed. Fillers are the actual values that go into those slots—"Tesla," "Red," "Electric," "250 km/h."
Here's where it gets interesting: default values. If you create a "Car" frame and don't specify the number of wheels, the system can assume 4. This is called default reasoning, and it's one of the key differentiators between frames and simpler knowledge representation methods.
| Slot | Filler | Default |
|---|---|---|
| brand | Tesla | — |
| color | Red | Black |
| engine_type | Electric | Combustion |
| wheels | — | 4 |
| max_speed | 250 km/h | 180 km/h |
Frames also support procedural attachments—small if-then rules that fire when certain conditions are met. For example: if engine_type is "Electric," then add slot charging_time. This is something semantic networks can't do natively, and it's what makes frames feel more alive. |
Frame Inheritance: Single, Multiple, and Overriding
Inheritance is where frames go from "neat filing system" to "actually intelligent."
Single inheritance is straightforward. A parent "Vehicle" frame defines wheels, engine, max_speed. A child "Car" frame inherits all of those and adds its own slots like fuel_type and door_count. You define common properties once, and every child gets them for free.
Multiple inheritance gets trickier—and more realistic. An "ElectricCar" frame might inherit from both "Car" and "ElectricVehicle." That's powerful, but it creates potential conflicts. What if "Car" says engine = combustion and "ElectricVehicle" says engine = electric? Which one wins? I've seen teams spend weeks resolving these conflicts in production systems.
Overriding is the escape hatch. A child frame can replace an inherited value with its own. A "Truck" frame inherits from "Vehicle" but overrides max_speed from 180 km/h to 120 km/h.
Here's a Python example that demonstrates all three concepts:
class Frame:
def __init__(self, name, parent=None):
self.name = name
self.slots = {}
self.parent = parent
def add_slot(self, name, value):
self.slots[name] = value
def get_slot(self, name):
if name in self.slots:
return self.slots[name]
elif self.parent:
return self.parent.get_slot(name)
return None
vehicle = Frame("Vehicle")
vehicle.add_slot("wheels", 4)
vehicle.add_slot("engine", "combustion")
vehicle.add_slot("max_speed", "180 km/h")
truck = Frame("Truck", parent=vehicle)
truck.add_slot("max_speed", "120 km/h") # Override
truck.add_slot("cargo_capacity", "10 tons")
print(truck.get_slot("wheels")) # 4 (inherited)
print(truck.get_slot("max_speed")) # 120 km/h (overridden)
The get_slot method walks up the inheritance chain. That's the entire mechanism in 15 lines of code.
Frames vs. Other Knowledge Representation Methods
If you're evaluating knowledge representation approaches for a project, here's how frames stack up against the alternatives.
Frames vs. Semantic Networks: A Practical Comparison
Semantic networks represent knowledge as a graph—nodes for concepts, edges for relationships like IS-A and HAS-A. They're excellent for showing how things connect.
Frames take a different approach. Instead of a web of links, you get structured boxes with slots. The practical difference? Frames support default reasoning and procedural attachments. A semantic network can tell you that a sparrow IS-A bird, but it can't automatically assume the sparrow has wings unless you explicitly add that edge.
| Feature | Frames | Semantic Networks |
|---|---|---|
| Structure | Slots and fillers per entity | Nodes and edges (graph) |
| Default values | Yes | No |
| Procedural rules | Yes (if-then attachments) | No |
| Best at | Describing objects and entities | Showing relationships |
| Reasoning style | Inheritance + slot logic | Graph traversal |
| When to use which: Frames for object-centric reasoning where you need defaults and rules. Semantic networks for relationship mapping where the connections themselves are the primary value. |
Frames vs. Scripts vs. Ontologies: Clearing the Confusion
This is where I see the most confusion among developers. Let me break it down simply.
Scripts (Schank & Abelson, 1977) handle sequences of events—what happens. The classic restaurant script: enter, sit, order, eat, pay, leave. Scripts answer "what's the typical flow?"
Frames handle objects and concepts—what things are. A restaurant frame describes the entity itself: its menu, location, hours, cuisine type.
Ontologies are the formal, heavyweight cousin. They use standardized languages like OWL and RDF to define concepts, relationships, and constraints with formal semantics. They're better for complex logical reasoning and interoperability across systems.
| Method | Purpose | Strengths | Weaknesses |
|---|---|---|---|
| Frames | Objects & concepts | Defaults, inheritance, procedural rules | Limited formal semantics |
| Scripts | Event sequences | Temporal reasoning, causality | Rigid, domain-specific |
| Ontologies | Formal domain models | Rich logic, standardization, interoperability | Complex to build, heavy |
| Frames are often seen as a precursor to ontologies. In my experience, ontologies are what frames evolve into when you need formal rigor at scale. |
The Frame Problem in AI: Why It Still Matters
The name is misleading. The frame problem isn't about Minsky's frames at all—it's a much older, thornier issue that predates them.
What Is the Frame Problem? A Developer's Perspective
Imagine a robot tasked with moving a table from one corner of a room to another. The robot executes the action. The table's position changes. But what about everything else? Did the ceiling move? Did the wall color change? Is the fan still running?
To a human, the answer is obvious: of course not. To a logic-based AI, none of that is automatic. The system has to somehow conclude that thousands of unrelated facts remain unchanged after a single action. Spelling all of that out by hand is impossible.
John McCarthy and Patrick Hayes formalized this in their 1969 paper "Some Philosophical Problems from the Standpoint of Artificial Intelligence." [需核实] The core challenge: how do you efficiently specify what doesn't change when an action occurs?
For a developer building planning systems or robotics applications, this isn't academic. Every action your system takes has side effects you need to track—or deliberately ignore.
Modern Solutions: Non-Monotonic Reasoning and Situation Calculus
The frame problem doesn't have a single silver bullet, but several techniques help.
Non-monotonic reasoning allows the system to draw conclusions that can later be retracted. The system assumes facts remain unchanged unless contradicted by new information. This mirrors how humans actually reason—we make assumptions and revise them when necessary.
Default logic formalizes this: "Unless I have evidence to the contrary, assume facts persist." It's the computational equivalent of "if it ain't broke, don't fix it."
Situation calculus provides a formal framework for reasoning about actions and their effects. It represents the world as a sequence of situations, where each action transforms one situation into the next.
Here's pseudocode illustrating non-monotonic reasoning:
// Default: assume all facts persist
rule: persist(Fact, Action) :-
not contradicts(Action, Fact),
holds(Fact, current_situation)
// Only update what changes
action: move_table(new_location)
effect: table_location = new_location
// Everything else persists by default
Modern AI planning systems use variations of these techniques. The frame problem isn't "solved" in the sense of being eliminated—it's managed through these formal mechanisms.
Implementing Frame-Based Reasoning in Python
Theory is useful, but you're here to build things. Let's get practical.
Building a Simple Frame Class with Inheritance
The Python code I showed earlier is a minimal implementation. Here's a more complete version that handles multiple inheritance and includes procedural attachments:
class Frame:
def __init__(self, name, parents=None):
self.name = name
self.slots = {}
self.parents = parents or []
self.procedures = []
def add_slot(self, name, value, default=None):
self.slots[name] = {'value': value, 'default': default}
def get_slot(self, name):
if name in self.slots and self.slots[name]['value'] is not None:
return self.slots[name]['value']
# Check defaults
if name in self.slots and self.slots[name]['default'] is not None:
return self.slots[name]['default']
# Walk inheritance chain
for parent in self.parents:
result = parent.get_slot(name)
if result is not None:
return result
return None
def add_procedure(self, condition, action):
self.procedures.append((condition, action))
def evaluate(self):
for condition, action in self.procedures:
if condition(self):
action(self)
vehicle = Frame("Vehicle")
vehicle.add_slot("wheels", default=4)
vehicle.add_slot("engine", "combustion")
car = Frame("Car", parents=[vehicle])
car.add_slot("fuel_type", "petrol")
electric_car = Frame("ElectricCar", parents=[car])
electric_car.add_slot("engine", "electric")
def needs_charging(frame):
return frame.get_slot("engine") == "electric"
def add_charging_slot(frame):
frame.add_slot("charging_time", "6 hours")
electric_car.add_procedure(needs_charging, add_charging_slot)
electric_car.evaluate()
print(electric_car.get_slot("charging_time")) # 6 hours
This is production-ready enough for small to medium knowledge bases. For larger systems, you'd want to add persistence, indexing, and conflict resolution.
Practical Use Case: A Medical Diagnosis Frame System
Let me show you something I've actually built variations of for healthcare clients.
class Disease(Frame):
def __init__(self, name, symptoms, treatment):
super().__init__(name)
self.add_slot("symptoms", symptoms)
self.add_slot("treatment", treatment)
class Patient(Frame):
def __init__(self, name, age, symptoms):
super().__init__(name)
self.add_slot("age", age)
self.add_slot("symptoms", symptoms)
self.add_slot("diagnosis", None)
def match_disease(patient, disease):
patient_symptoms = set(patient.get_slot("symptoms"))
disease_symptoms = set(disease.get_slot("symptoms"))
match_ratio = len(patient_symptoms & disease_symptoms) / len(disease_symptoms)
return match_ratio
flu = Disease("Flu", ["fever", "cough", "body_ache"], "Rest and fluids")
covid = Disease("COVID-19", ["fever", "cough", "loss_of_taste"], "Isolation and monitoring")
patient = Patient("John", 45, ["fever", "cough", "fatigue"])
for disease in [flu, covid]:
score = match_disease(patient, disease)
print(f"{disease.name}: {score:.0%} match")
This approach has real limitations—it doesn't handle symptom severity, doesn't account for patient history, and breaks down at scale. But for a prototype or a bounded diagnostic tool, it works surprisingly well.
Frames in Modern AI: Knowledge Graphs and LLMs
The question I get most often from developers: "Are frames still relevant in 2026, or are they obsolete?"
Are Frames Still Relevant in 2026?
Direct answer: yes, but in evolved forms.
Google's Knowledge Graph is essentially a frame system scaled to billions of entities. Each entity has slots (attributes like "birth date," "occupation," "spouse") and fillers (the actual values). The inheritance hierarchy is implicit in the ontology. Microsoft's Concept Graph works similarly.
The "frame mindset" survives as a design pattern in modern AI pipelines. When you extract entities from text and map them to structured slots, you're doing frame-based reasoning whether you call it that or not.
How LLMs Use Frame-Like Structures
Let me be precise here, because there's a lot of hand-wavy nonsense written about this.
LLMs like ChatGPT and Claude do not literally use Minsky frames under the hood. They learn statistical patterns from text. But those patterns often mimic slot-filling behavior. When an LLM tracks entities in a conversation—who said what, what's being asked, what details are still unknown—it's doing something conceptually similar to filling slots in a frame.
Many production systems wrap LLMs with structured layers precisely for this reason. Consider a customer support chatbot:
Frame: SupportTicket
Slot: customer_name -> "Sarah"
Slot: issue_type -> "billing"
Slot: priority -> "high"
Slot: status -> "open"
Slot: resolution -> (to be filled by LLM)
The LLM generates natural language responses, but the structured frame ensures the system maintains context and can reason about what information is still missing. The frame provides the skeleton; the LLM provides the flesh.
Frequently Asked Questions
What are frames in artificial intelligence?
Frames are data structures for representing knowledge about objects, concepts, or situations. They consist of slots (attributes) and fillers (values), organized hierarchically with inheritance. Marvin Minsky introduced them in 1974, using the analogy of how humans use pre-packaged knowledge structures—like the "restaurant" frame that tells you what to expect without relearning it each time.
What is the difference between frames and scripts in artificial intelligence?
Frames represent objects and concepts—what things are. Scripts represent sequences of events—what happens. Using the restaurant example: a frame describes the restaurant itself (cuisine, location, hours), while a script describes the dining experience (enter, order, eat, pay). They're complementary, not competing.
What is the frame problem in AI?
The frame problem is the challenge of determining what facts remain unchanged after an action occurs. When a robot moves a table, it must somehow know that the ceiling didn't move, the walls didn't change color, and the fan is still running. McCarthy and Hayes formalized this in 1969. Modern solutions include non-monotonic reasoning, default logic, and situation calculus.
How do I implement frames in Python?
Python classes map naturally to frames. Each class is a frame, attributes are slots, and class inheritance handles frame inheritance. For more complex systems, you can build a custom Frame class with dictionary-based slots and explicit parent references, as shown in the code examples above.
Conclusion
Frames remain one of the most influential ideas in knowledge representation. They're not obsolete—they've evolved into knowledge graphs, structured reasoning layers, and the design patterns that make modern AI systems reliable.
The core insight—that knowledge should be organized into reusable, hierarchical structures with sensible defaults—is as relevant in 2026 as it was in 1974. Whether you're building an expert system, a chatbot, or a knowledge base, frame-based thinking gives you a clearer mental model for designing AI that actually reasons instead of just guessing.
Ready to build your own frame-based system? Start by identifying the core entities in your domain and mapping them to Python classes. Share your implementation challenges in the comments below!