It may not be either Lepidoptera OR Hymenoptera! It could be Coleoptera (beetle). In January 2013 at Chuen Lung, I found some small (~5 mm) larvae as well as larger 7.5 mm larvae that looked much like your images. Their behavior as well as appearance of their pupal form, could very well be Coleoptera. Since the pupae have only just formed it is not yet settled. The length of your larva, if you remember, might determine if it the same. At Chuen Lung, the larvae I found were feeding on Polygonum chinense 火炭母, the LFP of Heliophorus epicles.