How smart are insects?

Is "smart" the same as "ingenious little buggers"?

they might not be "smart" compared to a human, but being able to replicate/copy/mimic/understand (?) them is the key to making huge advances in science and engineering, like medicine, space, robotics etc so there kind of responsible for making us "smart" aren't they?
So they might not be "smart" but they make bloody good teachers. Incredible things aren't they, never cease to be amazed by what they can do.
This should have been posted to biology. Sorry, but now I can't move it.
When I wave (the byebye or shoo wave, not a swat where they will turn and attack me) at wasps flying into the garage, and tell them to leave they do. Most often times not returning. If they do return, and I wave and talk again usually they fly out and not return. Never had an instance where that did not happen. I've had several instances of house flies waiting to leave the house. Today, one kept bothering me by flying around, and alighting on my head. It would then sit on a window blind returning not soon after to bothering me again. So I open the window and screen and let it out. It does fly out immediately upon my opening the screen. How do they know to bother me - that I am something that will let them out? As I say, this has happened many times in both instances of flies and wasps. I do not harbor doubt about this being anything but an insect knowing what is happening, or with the flies knowing that I was the thing that would let them out of the house. Is there an explanation for this behavior?
Interesting...I have observed intelligent actions from a spider... does anyone have any information on the intellectual abilities of the spider species?