The Loopback Parrot

🐦 Tutorial: Building “The Loopback Parrot” — A Gossip Network Simulator in Anvil

Concept
We’re simulating a small “coworker gossip model” where:

  1. You seed the network with a statement.
  2. The message propagates across a few nodes.
  3. Eventually it loops back to you, slightly mutated, like your nosy coworker repeating your own words back at you.

Why it’s AI/ML-ish

  • Demonstrates feedback loops in networks (like RNN instability).
  • Shows data corruption when information passes through noisy layers.
  • Illustrates why source attribution matters in both human gossip and ML training data.

1. Anvil UI Setup

  • TextBox: seed_text — for your initial “fact” (e.g., Staplers have expiration dates).
  • Button: start_button — to launch gossip propagation.
  • TextArea: output_area — to show each “hop” in the network.

2. Server Module (Fake Gossip Model)

import random
import anvil.server

# Slight word mutations to simulate gossip drift
MUTATIONS = [
    lambda t: t.replace("staplers", "staple guns"),
    lambda t: t.replace("expiration dates", "best-by stickers"),
    lambda t: t + " (heard it from someone important)",
    lambda t: "Apparently, " + t.lower(),
    lambda t: t.replace("dates", "data"),
]

@anvil.server.callable
def propagate_gossip(seed, hops=5):
    message = seed
    chain = [f"Start: {message}"]
    
    for hop in range(1, hops+1):
        # Randomly mutate the message
        if random.random() < 0.7:  # 70% chance of mutation
            mutation = random.choice(MUTATIONS)
            message = mutation(message)
        chain.append(f"Hop {hop}: {message}")
        
    # Loopback to origin
    chain.append(f"Returned to you: {message}")
    return "\n".join(chain)

3. Client Form Logic

from ._anvil_designer import LoopbackParrotFormTemplate
from anvil import *
import anvil.server

class LoopbackParrotForm(LoopbackParrotFormTemplate):
    def __init__(self, **properties):
        self.init_components(**properties)
        self.output_area.text = ""

    def start_button_click(self, **event_args):
        seed = (self.seed_text.text or "").strip()
        if not seed:
            self.output_area.text = "Please enter a starting fact."
            return
        self.output_area.text = "Simulating gossip..."
        result = anvil.server.call("propagate_gossip", seed)
        self.output_area.text = result

4. Try It

  • Seed: Python’s print() is deprecated in some time zones.
  • Hit Start.
  • Watch your “fact” travel through the gossip network and come back as:
    “Apparently, python’s print() is deprecated in some best-by stickers.”

5. Takeaway

In ML, a feedback loop without quality control can turn clean data into nonsense. In the office, it can turn “I like coffee” into “I heard you run an underground espresso cartel.”


🧪 Seed the Gossip Network

You can try The Loopback Parrot (and other experimental tools) live at:

https://hirabarton.anvil.app

Open it, seed the gossip network, tweak the chaos, and see how quickly your “facts” turn into pure nonsense.

Note: The Loopback Parrot is not responsible for any actual rumors started in your workplace. Unless they’re funny.