More seriously: it depends entirely on the details of your party and the tactics they use. You know those better than anyone. You also know better than anyone what you mean when you say you want a "deadly" encounter. Do you mean that you definitely want to kill at least one PC? Do you just mean that you want the potential for PC death to be there if they mess up?It's more than possible for a four-man party of level 5 PCs to kill a Marilith, but if your PCs are capable of that you'll know it already because they'll have been killing other high-CR monsters like Mind Flayers and young dragons too. (Actually you'll know probably just from listening to table talk when a monster shows up--you can tell when a group is experienced at cooperative tactics. E.g. they never panic, and they may have specialized jargon.)
For a group of five bog-standard PCs with random classes and builds and played in a straightforward fashion ("I walk up to the Marilith and start swinging with my magic axe") to have a guaranteed win but not guaranteed survival for all PCs, I'd probably shoot for level 12ish, or level 15ish if they don't have magical weapons or warlock cantrips. Each PC will have to do about 40 HP of damage to the Marilith in order to kill her, which should take them 2-3 rounds if they're just attacking unimaginatively with magic weapons; meanwhile she's doing around 90 HP of damage to them per round in return plus restraining one PC. (Make the tail attack first so the longswords get advantage if it hits.) If she plays it slightly smarter (constrict the paladin while beating the wizard unconscious with swords, and then next round teleport away with the paladin to beat on him in isolation too) she might even kill two PCs.
ncG1vNJzZmivp6x7prrWqKmlnF6kv6h706GpnpmUqHytu9aeqq1lnJrDpriMraZmnpmctbV5wGakmqqZoba1tI1uaG1raWd8