Current theories of planetary evolution predict that infant giant planets have large radii and very low densities before they slowly contract to reach their final size after about several hundred million years 1,2 . These theoretical expectations remain untested so far as the detection and characterization of very young planets is extremely challenging due to the intense stellar activity of their host stars 3,4 . Only the recent discoveries of young planetary transiting systems allow initial constraints to be placed on evolutionary models [5][6][7] . With an estimated age of 20 million years, V1298 Tau is one of the youngest solar-type stars known to host transiting planets; it harbours a system composed of four planets, two Neptune-sized, one Saturn-sized and one Jupiter-sized 8,9 .Here we report a multi-instrument radial velocity campaign of V1298 Tau, which allowed us to determine the masses of two of the planets in the system. We find that the two outermost giant planets, V1298 Tau b and e (0.64 ± 0.19 and 1.16 ± 0.30 Jupiter masses, respectively), seem to contradict our knowledge of early-stages planetary evolution. According to models, they should reach their mass-radius combination only hundreds of millions of years after formation. This result suggests that giant planets can contract much more quickly than usually assumed.V1298 Tau is a relatively bright (V = 10.1), very young K1 star with a mass of 1.170 ± 0.060 M ⊙ (where M ⊙ is the solar mass), a radius of 1.278 ± 0.070 R ⊙ (where R ⊙ is the solar radius), an effective temperature of 5,050 ± 100 K and solar metallicity (Table 1 and Extended Data Fig. 1). It is the physical companion of the G2 star HD 284154. The pair belongs to the Group 29 stellar association 10 and has an age of 20 ± 10 Myr (Extended Data Figs. 1 and 2). V1298 Tau was observed by Kepler's 'Second Light' K2 mission 11 . The analysis of the K2 data revealed the presence of four transiting planets in the system 9 . The three inner planets (b, c and d) were determined to have orbital periods of 24.1396 ± 0.0018, 8.24958 ± 0.00072 and 12.4032 ± 0.0015 days, and radii of 0.916 +0.052 −0.047 , 0.499 +0.032 −0.029 and 0.572 +0.040 −0.035 R Jup (where R Jup is the Jupiter radius). The fourth planet, e, was identified with only a single transit event, with a radius of 0.780 +0.075 −0.064 R Jup and orbital period estimated to be between 40 and 120 days. A previous study constrained the mass of V1298 Tau b to be less than 2.2 M Jup (ref. 12 ) (where M Jup is the Jupiter mass).To measure the planetary masses, we performed an intensive spectroscopic campaign, collecting more than 260 radial velocity (RV) measurements of V1298 Tau using the high-resolution spectrographs HARPS-N, CARMENES, SES and HERMES between April 2019 and April 2020. To monitor its stellar activity variations, we performed contemporaneous V-band photometry using the Las Cumbres Observatory Global Telescope (LCOGT) network 13 .V1298 Tau is a very active star that induces large RV activity variations. To extract the planetary sig...