Dynamics of a contracting fluid compound filament with a variable density ratio