Skip to content

Instantly share code, notes, and snippets.

@leventov
leventov / dialogue.md
Created April 4, 2023 04:12
A dialogue between Roman Leventov and ChatGPT-4 (March 14 version) on value and meaning

Roman: Imagine an agent made of yourself (i.e., GPT-4 model) with some software harness around. This software harness models plan execution by keeping a hierarchical tree of goals and tasks and supplying it in the beginning of the GPT-4 context, where the GPT-4 model is repeatedly asked to either create or update a plan for achieving a specific goal or task in the hierarchy, or drill down and execute a sub-task, or assess whether a task or goal is achieved and move to the next step in the higher-level task.

With some periodicity, when the highest-level task in the tree is completed, GPT-4 is prompted with the question "What I should do next?", to create a new highest-level goal or task.

How would you answer this question if you was a part of such an agent?

GPT: As a part of such an agent, when prompted with the question "What should I do next?" after completing the highest-level task in the tree, I would analyze the current context, available resources, and any constraints or priorities that might

import (
"log"
"math/rand"
"testing"
"github.com/montanaflynn/stats"
"gonum.org/v1/gonum/floats"
)
func TestMidCardinalitySimulation(t *testing.T) {

Keybase proof

I hereby claim:

  • I am leventov on github.
  • I am leventov (https://keybase.io/leventov) on keybase.
  • I have a public key ASDzs8Wl-lVqJjYp08P567ms5Hx5uQ9qFvxqOwkyfiQ3LQo

To claim this, I am signing this object:

package tests;
import org.openjdk.jmh.annotations.*;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
@BenchmarkMode(Mode.AverageTime)
@Measurement(time = 100, timeUnit = TimeUnit.MILLISECONDS)
$ ghc -Odph -rtsopts -threaded -fno-liberate-case -funbox-strict-fields -funfolding-keeness-factor1000 -fllvm -optlo-O3 -fexpose-all-unfoldings -fsimpl-tick-factor=500 -ddump-simpl -dsuppress-all zip-columns.hs > z.hs
@leventov
leventov / blur-core.hs
Last active December 12, 2015 06:38
blur.hs: inlining issue. Search `$wa2` in blur-core.hs to see details. See http://stackoverflow.com/questions/14748900/ghc-doesnt-perform-2-stage-partial-application-inlining
[1 of 1] Compiling Main ( blur.hs, blur.o )
==================== Simplified expression ====================
quoteExp
dim2St
(unpackCString#
" 2 4 5 4 2\
\ 4 9 12 9 4\
\ 5 12 15 12 5\
\ 4 9 12 9 4\
@leventov
leventov / minmax.c
Last active December 10, 2015 18:48
-- minmax.h
float max_ss(float a, float b);
float min_ss(float a, float b);
double max_sd(double a, double b);
double min_sd(double a, double b);
float clamp_ss(float x, float mn, float mx);
double clamp_sd(double x, double mn, double mx);
@leventov
leventov / hash_table.py
Last active December 6, 2015 05:45
Proposed optimization for shift removal procedure in hash tables with linear probing. Inspired by https://github.com/apple/swift/blob/8d9ef80304d7b36e13619ea50e6e76f3ec9221ba/stdlib/public/core/HashedCollections.swift.gyb#L3221-L3279
# (Pseudocode)
def shift_distance(chain_end, base):
return (chain_end - base) & (capacity - 1)
def next(index):
return (index + 1) & (capacity - 1)
def prev(index):
@leventov
leventov / bios.s
Created December 13, 2011 21:56
lab4: protected mode with paging
.arch pentium4
.code16
.section .text
.org 0x100
_gdt: .quad 0
.byte 0xFF, 0xFF, 0, 0, 0xF, 0b10011010, 0b00001111, 0 # код
.byte 0xFF, 0xFF, 0, 0, 0xF, 0b10010000, 0b00001111, 0 # данные
.byte 0x00, 0x80, 0,0x80, 0xB, 0b10010010, 0b00000000, 0 # видео
package tests;
import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;