If I have correctly understood what you are trying to do (by the way, it would be good to include a compilable minimal working example (MWE) to your questions so that it is easier to help you), the following code should work:
Here is the ouput:
Note that the
\titleformat command is documented on page 4 of the
titlesec manual (the
texdoc titlesec command should open the documentation). The syntax is as follows:
<command> is the name of the sectioning command you need to customiz.
<sep> is the separation between the label (in your case the roman numeral) and title, not between the left margin and the label. The
<format> code allows you to specify the style applied to the whole heading (label+title). This is were you should put commands like
Edit: following @GonzaloMedina's comment, I have redefined the commands
\thesubsection to make sure that any
\ref will produce the reference label in roman and not arabic numerals.