Time to AI, anyone’s guess?

When somebody asks me how long until AI is developed, I say between two and four decades. The question as posed refers to artificial intelligence that is competent at a variety of tasks that humans can carry out. Competent means not obviously distinguishable from a human’s performance.  So even though the question is not technically precise, it  is reasonably well defined, because human standards of performance are implicit in the question.

Now, getting back to the question, my usual answer as I said is two to four decades. But this brings me to this post I read recently, which tries to shed light on the matter by surveying and analyzing a large number of AI predictions, both from experts and non-experts.  The first conclusion, which I quote from the summary is

Over a third of predictors claim AI will happen 16-25 years in the future.

But I find the following two results of special significance

There is little difference between experts and non-experts (some possible reasons for this can be found here).
There is little difference between current predictions, and those known to have been wrong previously.

This paints a pretty bleak picture as to our ability to predict the development of AI. If experts can’t be distiguished from non-experts, it means that for the purposes of predicting AI, there really exist no experts at all, and uninformed guesses are as good as anything.

Along the same lines goes the second point I quoted. If current predictions are similar to previous ones that we know were flawed (because they were completely wrong), this suggests current ones could also be wrong. More specifically, if predictions made at different times, with significantly different contexts (ie scientific and technological progress) yielded the same predictions, it suggests that the predictions are independent of concrete scientific and technological considerations; they are based on non-specific reasoning, or even worse, unrelated factors (eg psychological) that are common to both periods.

Lastly, there is another point to be made about expert predictions. These experts are by definition active in the field of AI research, and have a stake (eg funding) in what is believed will happen. Plus, if they’re working towards AI, presumably they want their predictions to be true, it is their goal as researchers.

Where does this leave “two to four decades”? It’s not an expert prediction, although my intuition for this number is certainly based on expert opinions I’ve come accross over the years. In theory, reconsidering with the extra information should change my mind. Rationality dictates that one should widen the prediction interval in order to reflect the extra uncertainty that this new information introduces. The widening could be asymmetrical, because ignorance about how to achieve something points to that something being difficult rather than easy, so one could say something like “15 to 50 years”.

Perhaps this meta level correction is not incompatible with my original, object level intuitions: Advances in machine learning, neuroscience and computing power together with growth trends in funding suggest to me that arrival of AI in 30 years is quite likely, and that in 40 years it is beginning to approach certainty. But one has to admit, these are just intuitions and handwaving, we simply do not seem to have the tools to make predictions in a technical way.

Prediction is very difficult, especially if it’s about the future.
– Niels Bohr

Compile-time metaprogramming for Scala

Macros will come to Scala in 2.10. Here’s a quote from the proposal

Compile-time metaprogramming has been recognized as a valuable tool for enabling such programming techniques as:

  • Language virtualization (overloading/overriding semantics of the original programming language to enable deep embedding of DSLs),
  • Program reification (providing programs with means to inspect their own code),
  • Self-optimization (self-application of domain-specific optimizations based on program reification),
  • Algorithmic program construction (generation of code that is tedious to write with the abstractions supported by a programming language).

An example of algorithmic program construction in action can be found in Slick (database access framework) in direct embedding mode.

Like implicit conversions, macros should be used with care as they have the potential to make code obscure. Code changes effected by macros are not immediately visible to the programmer, just as implicit conversions can make method invocations hard to track. Both mechanisms can affect code “at a distance”; without proper discipline this can lead to confusion.

Visualizing a Scala Functor

I was reading about functors in scala and decided to draw a picture of an example functor

The outermost rectangles are categories, with the inner rectangles represent objects, in this example Scala types. The inner arrows are morphisms between objects, while the outer arrows represent the functors themselves, with List as the type constructor. Functors map categories, made up of objects and morphisms, so here we have

  • The object Int is mapped to the object List[Int]
  • The morphism Int.toString() is mapped to the morphism List[Int].map(Int.toString())

Note that morphisms map objects in the sense of their constituents, whereas functors map the objects themselves (as they are one of the constituents of the category).

Google does Knowledge Representation

Knowledge Representation is one of the main problems in AI. The aim is to encode knowledge formally to allow automated querying and reasoning about such knowledge, in effect allowing software agents to “know” things about the world. The exact representation may vary, but the language is usually based on some kind of logic. One fairly intuitive case of such a representation is the network, such as in semantic networks. These represent concepts as nodes of the network, and relationships as links. Here is some knowledge expressed in this way (image from Wikipedia)

where some simple facts about animals are expressed as nodes and links.

Bringing knowledge representation to the world wide web has been a recurring ambition for many years now. This initiative is known as the Semantic Web, the aim is to provide the currently free-form information on the web in structured-data equivalents that would allow computers to extract and reason about it. Here’s a quote by Tim Berners-Lee

I have a dream for the Web [in which computers] become capable of analyzing all the data on the Web – the content, links, and transactions between people and computers. A ‘Semantic Web’, which should make this possible, has yet to emerge, but when it does, the day-to-day mechanisms of trade, bureaucracy and our daily lives will be handled by machines talking to machines. The ‘intelligent agents’ people have touted for ages will finally materialize.

The Semantic Web initiative has resulted in many standards to support this vision. To date however, this vision has not been realized, and it does not seem like it will any time soon. Which brings us to Google’s Knowledge Graph. Note the term graph which has the clear signature of a semantic-network-like approach to capturing knowledge. What google is trying here is to bring some benefits of knowledge representation to search, without having to realize the Semantic Web vision in all its glory. Instead of waiting for the entire web to go semantic, google will internally maintain a smaller scale equivalent of web knowledge and use that instead. This also bypasses another of the main problems of the semantic web vision, expecting the “wild” web to maintain quality, coherent data. It’s certainly more feasible with an internal, controlled knowledge base.

So what we can expect is for google to incrementally augment it’s traditional search via its knowledge graph. The core of search will still be keyword-based and statistical, but it will begin to recognize concepts in data retrieved through its keyword approach, in effect going from semantic-free strings of letters (words) to concepts. Once these concepts are recognized, the knowledge graph can be exploited to present more detailed search results, and also better present these results.

Will it be a substantial improvement, or just another gimmick that won’t go anywhere? Many “google killers” have come and gone over the years, some of them promising to revolutionize search by going beyond keywords. That this has never worked is evidence of how keyword based search is surprisingly effective and robust. But google knows this better than anybody, and the key word in my previous paragraph is incremental.

I’ve inherited 200K lines of spaghetti code—what now?

Here is an article on arstechnica about what to do when you inherit a gigantic code mess. Nothing new here, but still nice to get all these ideas into one place, and many of them are applicable in general, not just when something nasty’s been dumped on you.

Other related topics to think about are how and why does code rot into spaghetti, and more ambitiously, how to characterize programming in terms of engineering , science and craftmanship.