Guest User

AGI progress

a guest
Jun 23rd, 2020
275
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3.  
  4. "Intended to address the 'narrow window argument' for takeoff speeds: https://wiki.issarice.com/wiki/Narrow_window_argument_against_continuous_takeoff"
  5.  
  6. class AIProgress:
  7.     def __init__(self,self_improvement_fn,optimisation_effort, plttype,top=1,precision=500,initial_Int=1,steep=None):
  8.         self.time_fn = np.linspace(0,top,precision)
  9.         self.I_fn = np.ones(precision)*initial_Int
  10.         self.self_improvement_fn = self_improvement_fn
  11.         self.optimisation_effort = optimisation_effort
  12.         self.plttype = plttype
  13.         self.boosts = []
  14.         self.steep = steep
  15.    
  16.     def rate_of_improvement(self,I):
  17.         """
  18.        Yudkowsky:
  19.            I'm not saying you literally get dy/dt = e^y that goes to infinity after finite time
  20.            Yudkowsky has us abruptly switch from y' = y to y' = e^y once we hit the threshold where RSI is possible.
  21.            For continuous takeoff we model always the same equation y' = Ay + f(y)*e^y
  22.        """
  23.         #return self.optimisation_effort*I + (self.self_improvement_fn(I)*np.exp(I)), self.self_improvement_fn(I)
  24.  
  25.         """
  26.        Bostrom:
  27.            dI/dt = cI vs dI/dt = (c+I)I = cI + I^2 'when the AI reaches the crossover point'
  28.            where difference is modelled as cI + f(I)*I^2
  29.        """
  30.         if self.steep is not None:
  31.             return self.optimisation_effort*I + (self.self_improvement_fn(I,self.steep)*I**2), self.self_improvement_fn(I,self.steep)
  32.         return self.optimisation_effort*I + (self.self_improvement_fn(I)*I**2), self.self_improvement_fn(I)
  33.  
  34.  
  35.         "no assumption of exponential progress by default, 'constant underlying increase'"
  36.         #return self.optimisation_effort + (self.self_improvement_fn(I)*I), self.self_improvement_fn(I)
  37.    
  38.     def simulate(self):
  39.         dt = self.time_fn[1]
  40.         for i,t in enumerate(self.time_fn):
  41.             I_approx = self.I_fn[i-1]
  42.             dIdT, boost = self.rate_of_improvement(I_approx)
  43.             #print(t,I_approx,dIdT)
  44.             self.I_fn[i] = I_approx + dIdT*dt
  45.             self.boosts.append(boost)
  46.             #print(t,boost)
  47.    
  48.     def doubling_intervals(self):
  49.         Intelligence = self.I_fn[0]
  50.         doubling_intervals = [[Intelligence,0]]
  51.         for i,I_t in enumerate(self.I_fn):
  52.             time = i * self.time_fn[1]
  53.             if I_t > Intelligence*2:
  54.                 interval = time
  55.                 Intelligence = I_t
  56.                 doubling_intervals.append([Intelligence,interval])
  57.         return doubling_intervals
  58.  
  59.     def get_results(self,ax1,ax2):
  60.         self.simulate()
  61.         ax1.plot(self.time_fn,self.I_fn, label=self.plttype)
  62.         ax2.plot(self.time_fn,self.boosts,label=self.plttype+("-RSI fraction"))
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69. """
  70. VARIABLES
  71.  
  72. """
  73.  
  74. scale = 1 #how strong (in absolute size) is an AGI's RSI ability?
  75. effort = 1 #outisde optimisation
  76. AGI = 4 #Intelligence level at which AI reaches its maximum ability to exert improvements on itself
  77. IniInt = 1 #Initial capability of the AI system
  78. krange = np.hstack((np.arange(5)/2,np.array(1e10))) #the range of different continuous progress scenarios
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87. def sigmoid(x):
  88.   return 1 / (1 + np.exp(-x))
  89.  
  90. def continuous_function(Intelligence):
  91.     if d == 0:
  92.         return 0
  93.     return sigmoid(d*(Intelligence-AGI))*scale
  94.  
  95. if __name__ == "__main__":
  96.     plt.style.use('fivethirtyeight')
  97.     #plt.rcParams.update({'font.size': 10})
  98.     top = 2.5
  99.     precision = 2000
  100.     YMAX = 5*AGI
  101.     #krange = (np.arange(4)*2)[1:]
  102.  
  103.     t = np.linspace(0,2*AGI,precision)
  104.     #plt.plot(t,[yud_function(t1) for t1 in t],label='yudkowsky')
  105.     fig,(axis1) = plt.subplots(1,sharex=True,figsize=(16,9))
  106.     for d in krange:
  107.         plt.plot(t,[continuous_function(t1) for t1 in t],label='d='+str(d))
  108.     #plt.plot(t,[slow_function(t1) for t1 in t],label='slow')
  109.     axis1.set_xlabel('I')
  110.     axis1.set_ylabel('f(I)')
  111.     axis1.legend()
  112.     fig.savefig("RSI-able.png")
  113.  
  114.     #fig,(axis1,axis2) = plt.subplots(2,sharex=True,figsize=(16,9))
  115.     fig,(axis1) = plt.subplots(1,sharex=True,figsize=(16,9))
  116.     fig2,(axis2) = plt.subplots(1,sharex=True,figsize=(16,9))
  117.     axis1.set_xlabel("Time")
  118.     axis1.set_ylabel("I(t)")
  119.     axis2.set_ylabel("RSI-able Fraction")
  120.  
  121.     axis1.plot(np.linspace(0,top,precision),AGI+np.zeros_like(np.linspace(0,top,precision)),'--',label = 'AGI')
  122.     axis1.set_title("s={}, c={}, I_AGI = {}, I_0 = {}".format(scale,effort,AGI,IniInt))
  123.     #print('Discontinuous')
  124.     #progress = AIProgress(yud_function,effort,'Discontinuous',top,precision,IniInt)
  125.     #progress.get_results(axis1,axis2)
  126.     print('Continuous')
  127.     for d in krange:
  128.         progress2 = AIProgress(continuous_function,effort, 'd=' +str(d),top,precision,IniInt)
  129.         progress2.get_results(axis1,axis2)
  130.  
  131.     #print('Slow')
  132.     #progress3 = AIProgress(slow_function,effort,'Slow',top,precision,IniInt)
  133.     #progress3.get_results(axis1,axis2)
  134.  
  135.     axis1.axis(ymax=YMAX,ymin=0)
  136.     #plt.yscale("linear")
  137.     #plt.ylim(1,1e3)
  138.     axis1.legend()
  139.     axis2.legend()
  140.     #fig.savefig(str(effort)+str(AGI)+str(IniInt)+"_Progress_lin.png")
  141.     axis1.set_yscale('log')
  142.     axis1.axis(ymax=YMAX**2)
  143.     fig.savefig(str(scale)+str(effort)+str(AGI)+str(IniInt)+"_Progress_log.png")
  144.     #fig2.savefig(str(effort)+str(AGI)+str(IniInt)+"RSI-ABLE.png")
  145.     plt.show()
RAW Paste Data