views:

199

answers:

3

Disclaimer: I'm not a mathematical genius, nor do I have any experience with writing neural networks. So, please, forgive whatever idiotic things I happen to say here. ;)

I've always read about neural networks being used for machine learning, but while experimenting with writing simple virtual machines, I began to wonder if they could be applied in another way.

Specifically, can a virtual machine be created as a neural network? If so, how would it work (feel free to use an abstract description here, if you have to)?

I've heard of the Joycean Machine, but I can't find any information other than very, very vague explanations.

EDIT: What I'm looking for here is an explanation of exactly how a neural network-based VM would interpret assembly. How would inputs be handled, etc? Would each individual input be a memory address? Let's brainstorm!

+1  A: 

Of course. With a rather complex network no doubt.

Much of the parsing of bytecodes/opcodes is pattern matching which neural networks excel at.

mcjabberz
+1  A: 

You really made my day buddy...

Since an already trained neural network won't be much different than a regular state machine, there is no point writing a neural network VM for a deterministic instruction set.

It might be interesting to train such a VM with multiple instruction sets or an unknown set. However, I doubt it will be practical to execute such a training and even a %99 correct interpreter will be of any use for conventional bytecode.

The only use of a neural network VM I can think of is executing a program that contains fuzzy logic constructs or AI algorithm heuristics.

Some silly stack machine example to demonstrate the idea:

push [x1]
push [y1] ;start coord
push [x2]
push [y2] ;end coord
pushmap [map] ;some struct
stepastar ;push the next step of A* heuristics to accumulator and update the map
pop ;do sth with is and pop
stepastar ;next step again
... ;stack top is a map
reward ;we liked the coordinate. reinforce the heuristic
stepastar
... ;stack top is a map
punish ;we didn't like the next coordinate. try something different

There is no explict heuristic here. Just assume we keep all state in *map including the heuristic algorithm.

You see it looks silly and not completely context sensitive but a neural network is of no value if it doesn't learn online.

artificialidiot
A: 

You could certainly do this with a neural network - I could easily see learning the correct state transitions for a given piece of bytecode.

Input could be something like:

  • Value at top of stack
  • Value in current accumulator
  • Byte code at current instruction pointer
  • Byte value at current data pointer
  • Previous flags

Output could be something like:

  • Change to instruction pointer
  • Change to data pointer
  • Change to accumulator
  • Stack operation (push, pop, or nothing)
  • Memory operation (read to accumulator, write accumulator or nothing)
  • New flags

However - I'm not sure why you would want to do this in the first place. A neural network would be much less efficient (and potentially make mistakes unless you trained it well enough) compared to just executing the bytecode directly. You'd probably need to write an accurate bytecode evaluator anyway just to create enough training data....

Also, in my experience neural networks tend to be good at pattern recognition but very bad at learning logical operations (like binary addition or XORs) once you get beyond a certain scale (i.e. more than a few bits). So depending on the complexity of your instruction set, the network could take a very large amount of time to train.

mikera