Harvey's machine can resemble a human completely or not at all.
1a) ... The extent to which it resembles a human is determined by its software.
1b) ... To which extent it resembles a human is determined by its software.
The placement of "to which" in the surface form is optional, and both sentences (appear to) carry the same meaning. But we can't do this in general:
2a) ... The machine to which I'm referring is in the room.
2b) ... # To which machine I'm referring is in the room.
At first, it seems like it might be to do with "extent" vs. "machine". But consider
Harvey has made several machines.
3a) ... The machine to which I'm referring is unclear.
3b) ... To which machine I'm referring is unclear.
which makes me suspect this is at least in part a more general semantics issue.
(If these judgments don't sound correct, try un-pied-piping the "to", and then they definitely do sound correct.)
In 2, we're talking about a particular machine that's in the room. But in 3, there's a sense in which we haven't "evaluated" 'which machine' yet—we're talking about my denotation of the machine, not a particular machine itself. It seems almost like a de re/de dicto distinction. Or maybe there's just a [+Q] somewhere. But if so, where?
How is this formally modeled? Is there a syntactic distinction between the two situations? If not, how do we model the acceptability of having a [+wh] phrase in a different position under certain semantics but not others?
Or just generally—what's going on with the placement of the wh-phrases in these sentences?