Rewarded Observation 1: Unit Conversion

Each observation artifact documents a successful training step where the system evolved its executable theory in response to a prompt. These packages show the prompt context, the code changes that resulted, how success was measured through loss evaluation, and how reward was distributed through the dependency graph to reinforce the definitions that contributed to the successful output.

This package archives the first rewarded observation in the current training sequence. A tutor prompt about metric length and mass conversions promotes the first working measurement scaffold for unit-aware calculations.

Download bundle:

Knowledge Change Diff

This update adds the initial measurement scaffold: core unit and value types, meter-centimeter and gram-kilogram conversion factors, and a small validation probe.

Show unified diff
--- kf_02-27T08-43-03-067303.py
+++ kf_03-02T15-25-10-840374.py
@@ -1 +1,65 @@
 
+class Name:
+    def __init__(self, name: str):
+        self.name = str(name)
+class Symbol:
+    def __init__(self, symbol: str):
+        self.symbol = str(symbol)
+class Unit:
+    def __init__(self, name: Name, symbols: list[Symbol]):
+        if not isinstance(name, Name):
+            raise TypeError('name must be a Name instance.')
+        if not isinstance(symbols, list) or not symbols or any(not isinstance(symbol, Symbol) for symbol in symbols):
+            raise TypeError('symbols must be a non-empty list of Symbol instances.')
+        self.name = name
+        self.symbols = list(symbols)
+meter_unit = Unit(name=Name('meter'), symbols=[Symbol('m')])
+centimeter_unit = Unit(name=Name('centimeter'), symbols=[Symbol('cm')])
+gram_unit = Unit(name=Name('gram'), symbols=[Symbol('g')])
+kilogram_unit = Unit(name=Name('kilogram'), symbols=[Symbol('kg')])
+class Value:
+    def __init__(self, number: float, unit: Unit):
+        if unit is None:
+            raise ValueError('unit is required.')
+        if not isinstance(unit, Unit):
+            raise TypeError('unit must be a Unit instance.')
+        self.number = float(number)
+        self.unit = unit
+    def convert_to(self, target_unit: Unit) -> 'Value':
+        if not isinstance(target_unit, Unit):
+            raise TypeError('target_unit must be a Unit instance.')
+        source_name = self.unit.name.name
+        target_name = target_unit.name.name
+        if source_name == target_name:
+            return Value(self.number, self.unit)
+        factor = unit_conversion_factors.get((source_name, target_name))
+        if factor is None:
+            raise ValueError(f'No conversion from {source_name} to {target_name}.')
+        return Value(self.number * factor, target_unit)
+class Distance:
+    def __init__(self, value: Value):
+        if not isinstance(value, Value):
+            raise TypeError('value must be a Value instance.')
+        if value.unit.name.name not in {'meter', 'centimeter'}:
+            raise ValueError('Distance only accepts meter or centimeter units.')
+        self.value = value
+unit_conversion_factors: dict[tuple[str, str], float] = {
+    ('meter', 'centimeter'): 100.0,
+    ('centimeter', 'meter'): 0.01,
+    ('gram', 'kilogram'): 0.001,
+    ('kilogram', 'gram'): 1000.0,
+}
+def distance_validation_probe() -> dict[str, bool]:
+    value_requires_unit = False
+    distance_in_kg_rejected = False
+    distance_in_m_ok = False
+    try:
+        Value(5, None)
+    except ValueError:
+        value_requires_unit = True
+    try:
+        Distance(Value(2.0, kilogram_unit))
+    except ValueError:
+        distance_in_kg_rejected = True
+    distance_in_m_ok = Distance(Value(2.0, meter_unit)).value.unit.name.name == 'meter'
+    return dict(value_requires_unit=value_requires_unit, distance_in_kg_rejected=distance_in_kg_rejected, distance_in_m_ok=distance_in_m_ok)

Observation Summary

Latest (f) is the incumbent theory; Updated (f′) is the candidate being evaluated.

Computation

dict(length_cm=Value(2.37, meter_unit).convert_to(centimeter_unit).number, mass_kg=Value(845.0, gram_unit).convert_to(kilogram_unit).number, back_to_m=Value(237.0, centimeter_unit).convert_to(meter_unit).number)

Prompt Context

A desk length is 2.37 meters and a parcel mass is 845 grams. Convert the length to centimeters, convert the mass to kilograms, and convert 237 centimeters back to meters. Reply with the three numeric results.

Latest Result

Error: Computation failed: name ‘Value’ is not defined

Updated Result

{‘length_cm’: 237.0, ‘mass_kg’: 0.845, ‘back_to_m’: 2.37}

Sensor Result

The answers are: 237 cm, 0.845 kg, and 2.37 m.

Latest Loss

2.422

Updated Loss

1.516

Threshold 0.129

Score +0.469

Score measures how much the updated theory improves on the latest version. When Score exceeds Threshold, the observation succeeds and the update is promoted. See Equality Proxy for calibration details.

Reward DAG Preview

This diagram traces how reward flows backward from the successful output through the code changes that made it possible. First payout-step reward DAG for observation 1, rooted at the rewarded output. The blue node is the rewarded root, the gold node is the payout recipient group, the red nodes are the immediate upstream edit definitions, and the dotted continuation marks the remaining upstream lineage outside this cropped first-slice view.

Observation and Reward Files

Knowledge (Theory) Files

In these implementation artifacts, knowledge is the runtime name for the essay’s executable theory module.