{'fraction_non_alphanumeric': 0.039718676884710764, 'fraction_numerical': 0.025162167084635107, 'mean_word_length': 4.267749077490775, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Rest-UV Absorption Lines as Metallicity Estimator: the Metal Content of Star-Forming Galaxies at z~5

We measure a relation between the depth of four prominent rest-UV absorption complexes and metallicity for local galaxies and verify it up to z~3. We then apply this relation to a sample of 224 galaxies at 3.5= 4.8) in COSMOS, for which unique UV spectra from DEIMOS and accurate stellar masses from SPLASH are available. The average galaxy population at z~5 and log(M/Msun)>9 is characterized by 0.3-0.4 dex (in units of 12+log(O/H)) lower metallicities than at z~2, but comparable to z~3.5. We find galaxies with weak/no Ly-alpha emission to have metallicities comparable to z~2 galaxies and therefore may represent an evolved sub-population of z~5 galaxies. We find a correlation between metallicity and dust in good agreement with local galaxies and an inverse trend between metallicity and star-formation rate (SFR) consistent with observations at z~2. The relation between stellar mass and metallicity (MZ relation) is similar to z~3.5, however, there are indications of it being slightly shallower, in particular for the young, Ly-alpha emitting galaxies. We show that, within a"bathtub"approach, a shallower MZ relation is expected in the case of a fast (exponential) build-up of stellar mass with an e-folding time of 100-200 Myr. Due to this fast evolution, the process of dust production and metal enrichment as a function of mass could be more stochastic in the first billion years of galaxy formation compared to later times.


INTRODUCTION
Metallicity is an important diagnostic for understanding the details of galaxy formation, because its connection to the history of a galaxy's star-formation rate (SFR), gas in-and outflows -i.e., the interplay between the inter-stellar medium (ISM) and the inter-galactic medium (IGM). While the metal content of galaxies and its relation to other physical properties has been studied in depth at z ∼ 2 − 3, there are only a handful of observations at higher redshifts.
The presence of a tight relation (0.07−0.20 dex scatter) between the galaxy's stellar mass and gas-phase metallicity (the MZ relation), measured by the ratio of oxygen to hydrogen 1 , has been seen in local galaxies as early as in the 1970's (Lequeux et al. 1979, see also Bothwell et al. (2013)). Recently improved instrumental capabilities in the near-infrared (near-IR) allowing the measurement of metallicity at higher redshifts, show that this relation holds up to z ∼ 2 (Savaglio et al. 2005;Maier et al. 2005;Erb et al. 2006;Maiolino et al. 2008;Roseboom et al. 2012;Henry et al. 2013;Gallazzi et al. 2014;Wuyts et al. 2014;Maier et al. 2015;Sanders et al. 2015b; afaisst@ipac.caltech.edu 1 We define the solar metallicity as Z = 0.02. Salim et al. 2015) and even up to z ∼ 3 although only by small sample sizes (Mannucci et al. 2009;Belli et al. 2013;Maier et al. 2014, Onodera et al. 2015. At all redshifts, the metal content of galaxies is observed to increase with increasing stellar mass but flattens out above a stellar mass of roughly log(M/M ) = 10.0−10.5. The MZ relation is also observed to evolve with redshift with galaxies at high redshifts showing a lower metal content. Galaxies at z ∼ 3 are found to have only ∼1/5 th of the solar metal abundance (Mannucci et al. 2009;Jones et al. 2012, Onodera et al. 2015. Besides the correlation of metallicity with stellar mass and cosmic time, an inverse dependence with SFR has been found in local galaxies Lara-López et al. 2010;Andrews & Martini 2013). This has led to the socalled "fundamental mass-metallicity relation" (see Mannucci et al. 2010), however, the universality of this 3dimensional relation is debated as there are evidences of it breaking down at z ∼ 2 − 3 (see e.g., Maier et al. 2014;Salim et al. 2015) Several physical processes have been suggested for the origin of the MZ relation. For example, the deficit of metals in low mass galaxies can be attributed to strong winds (stellar winds or supernovae feedback) that excavate metal-rich gas out of the galaxy's low gravita-tional potential (e.g., Larson 1974;Edmunds 1990;Garnett 2002;Tremonti et al. 2004;De Lucia et al. 2004;Finlator & Davé 2008). Such strong outflows are found to be ubiquitous in local star-burst galaxies as well as starforming galaxies at higher redshifts (e.g., Steidel et al. 2010;Martin et al. 2012;Kornei et al. 2012). Also, more massive galaxies tend to form their stars earlier (an effect called "Downsizing", e.g., Cowie et al. 1996;Gavazzi & Scodeggio 1996;Franceschini et al. 2006;Pérez-González et al. 2008;Ilbert et al. 2013) and therefore start to enrich their ISM earlier than less massive galaxies. It is also important to mention that the shape of the initial stellar mass function (IMF) affects the rate at which the ISM gets enriched by metals and thus has a direct influence on the shape of the MZ relation (e.g., Köppen et al. 2007). The evolution of metallicity with cosmic time and its dependence on stellar mass and SFR has been successfully predicted by semi-empirical models under the assumption that the metal content in the ISM is set by the balance between the inflow of pristine (i.e., metal poor) gas and enrichment through star formation. (see Bouché et al. 2010;Davé et al. 2012;Lilly et al. 2013;Pipino et al. 2014;Harwit & Brisbin 2015;Feldmann 2015).
The gas-phase metallicity of a galaxy is commonly derived from the ratio between strong emission line features in the optical part of spectrum ([O II], [O III], Hα, Hβ, [N II]) calibrated to theoretical models (e.g., Nagao et al. 2006;Kewley & Dopita 2002;Kewley & Ellison 2008;Maiolino et al. 2008). The most common of these socalled "strong-line methods" include the R 23 diagnostics (combining [O III], [O II], and Hβ; Pagel et al. 1979) as well as the N2 method (combining Hα and [N II]; Storchi-Bergmann et al. 1994) that is commonly used to break the degeneracy and dust dependence of the R 23 method. While the strong-line methods can be employed up to z ∼ 3, at higher redshifts the diagnostic lines fall out of the wavelength window of ground based near-IR spectrographs. This considerably hampers the investigation of the metal content of galaxies at very early epochs and therefore our understanding of the formation of these galaxies, until the advent of the James Webb Space Telescope (JWST).
A correlation between metallicity and the equivalent width (EW) of absorption features in the rest-frame ultra-violet (UV) is expected from theoretical models (e.g., Eldridge & Stanway 2012) and is observed in starburst galaxies in the local universe (e.g., Heckman et al. 1998;Leitherer et al. 2011). It provides an alternative way to probe statistically the metal content of galaxies. This method has already been used to determine stellar and gas-phase metallicities of z ∼ 3 galaxies returning reasonable results (e.g., Mehlert et al. 2002;Savaglio et al. 2004;Maraston et al. 2009;Sommariva et al. 2012). However, the this correlation has never been directly verified to hold at high redshifts.
In this paper, we aim (i) to verify the EW vs. metallicity relation at high redshift and (ii) use it to investigate the metal content of 224 star-forming galaxies at z ∼ 5 with rest-frame UV spectra obtained by the Deep Imaging Multi-Object spectrograph (DEIMOS, Faber et al. 2003). The large sample size allows us to investigate the dependence of metallicity on stellar mass for the first time at these early epochs, giving us clues on how these galaxies are formed.
The paper is organized as follows: We first verify the EW vs. metallicity relation of local galaxies on a sample of z ∼ 2 − 3 galaxies (Section 2). We then present in Section 3 the sample of z ∼ 5 galaxies to which we will apply this relation to estimate their metallicities. In Section 4 we present the z ∼ 5 composite spectrum and describe the measurement of EWs including the correction for various biases. The results of our analysis are presented in Section 5. Eventually, in Section 6, we discuss the metal content of z ∼ 5 galaxies and conclude and summarize the results of this paper in Section 7.

UV ABSORPTION LINES AS A MEASURE OF
METALLICITY The strong-line methods, based on the ratio of strong optical emission lines to determine gas-phase metallicities work well up to redshift of z ∼ 3. Above that the lines are shifted out of the wavelength range of current ground-based near-IR spectrographs. An alternative way of estimating metallicity is to use the relation between the EW of inter-stellar (IS) and photospheric absorption features in the rest-frame UV. In this section, we calibrate this relation using a set of local galaxies and verify it at redshifts as high as z ∼ 3, before applying it to a sample of z ∼ 5 galaxies.
There are several physical aspects that could cause a correlation between metallicity and EW of UV absorption lines. For details we refer to (Heckman et al. 1998), here we briefly summarize the main points.
• In general, the spectral properties are set by OB stellar populations. The evolutionary history of these correlations strongly depends on the stellar mass-loss rates, which in turn depend on the metal abundance (Maeder & Conti 1994).
• Winds from hot stars contribute to the line profiles of C IV and Si IV. As shown theoretically (and also confirmed observationally), the wind strength of these stars is metal dependent (see Castor et al. 1975;Walborn et al. 1995).
• Dust extinction is proportional to metallicity and sets the column density for producing the absorption features (e.g., Heckman et al. 1998).
• Most of the IS lines are optically thick at average columns densities of the ISM in star-forming galaxies (e.g., Heckman et al. 1997;Sahu & Blades 1997;Pettini & Lipman 1995). Therefore, their line depths depend only weakly on the column density but more strongly on the velocity dispersion of the absorbing gas.
• The more metal rich star-bursts are, the more powerful in terms of their UV and IR luminosities.  -The top five panels show absorption line features as well as He II emission as a function of metallicity and age for synthetic spectra generated by the BPASS code. Shown are models with metallicities Z = 0.02 (blue), Z = 0.004 (green), and Z = 0.001 (red). These metallicity abundances are shown for a 10, 100, and 500 Myr old stellar population, shown in dotted, dashed, and solid lines, respectively. Notice that above ∼ 100 Myr there is no significant dependence of the absorption features on age. The bottom five panels show the same wavelength ranges but of 22 observed spectra of local star-burst and star-forming galaxies by Leitherer et al. (2011). The spectra are split and stacked in four different metallicity bins given their oxygen abundances measured by various authors (see Leitherer et al. 2011). The general trends of absorption depth with metallicity are consistent with the BPASS models except for the ISM lines that are not included in this model. Moreover, they reside in more massive galaxies with higher average ISM velocity dispersion caused by both supernovae and stellar winds. The velocity dispersion widens the optically thick IS lines.
While the EW vs. metallicity relation is clearly seen in local galaxies, it has not been verified at higher redshifts. In the following, we combine the data from more than 50 local galaxies and use ∼ 20 galaxies at z ∼ 2 − 3 to test the relation at high-z. We focus on the strongest lines observed in the spectra of high-z galaxies, which are: the photospheric/IS Si III complex at 1300Å, the IS C II doublet at 1335Å as well as the Si IV and C IV wind features.

Synthetic stellar library BPASS
We begin by investigating the relation between absorption line EW and metallicity from a theoretical perspective using a synthetic stellar library created by the Bi-nary Population and Spectral Synthesis (BPASS, Eldridge & Stanway 2009 3 models. These combine stellar evolution models with libraries of synthetic atmospheric spectra and to provide high-resolution modeling of stellar populations. They also include the binary evolution of stars, resulting in stellar populations that are bluer and older compared to populations of stars without binaries. In addition, the models are post-processed by Cloudy (Ferland et al. 1998) to include nebular emission. These models allow us to estimate the correlations of the EW with other physical quantities like the age of stellar population. In the following, we use the BPASS models with constant star-formation and the contribution of binary stars.
We use 9 different model populations with different stellar population ages and metallicities. These consist of a old (500 Myr), intermediate age (100 Myr), and young (10 Myr) stellar populations with metallicities of Z = 0.001, 0.004, and 0.02. In the top five panels of Figure 1, we show the regions around absorption line complexes and He II from BPASS generated models. The solid, dashed, and dotted lines correspond to old, intermediate age, and young stellar populations and the colors show different metallicities. The correlation between IS absorption and metallicity is clearly evident. Also, the models are largely independent of age for stellar populations older than ∼ 100 Myrs. The He II emission variations with metallicity are more complicated so He II is not used in our analysis. Figure 2 shows the above mentioned trends more quantitatively by the rest-frame EW measured for different absorption features as a function of metallicity 4 . The BPASS models are represented as magenta dotted, dashed, and solid lines for stellar populations of 10, 100, and 500 Myrs. As mentioned above, the change in EW with age for stellar populations older than ∼ 100 Myr is negligible. However, for younger galaxies we expect an increased C IV absorption and a deficit for the Si III complex. The C II absorption, on the other hand, remains unchanged with age even for very young stellar populations. In high S/N spectra, the ratio between C II and C IV could therefore be used as an additional constraint on the age of the underlaying stellar population.

Calibration on local galaxies
We consider two partially overlapping samples of local star-burst galaxies with UV spectral coverage between 1000Å and 2000Å and measured metallicities from, if available, electron temperature (ratio of [O III] line ratios at different wavelengths) and strong-line methods (using the Edmunds & Pagel (1984) calibration) to investigate the relation between IS absorption line EWs and metallicity. Both samples are based on the International Ultraviolet Explorer (IUE) data archives (see Kinney et al. 1993) and are presented in detail in Heckman et al. (1998) and Leitherer et al. (2011). Furthermore, we make sure that these samples do not contain AGNs.
The Heckman et al. (1998) sample consists of a compilation of 45 local star-burst galaxies with low-resolution (R ∼ 200 − 300) UV spectral coverage of 1150 − 2000Å as well as metallicity measurements from the literature. The metallicity of the sample ranges from 12 + log(O/H) = 7.5 to 12 + log(O/H) = 9.5. In their study, Heckman et al. (1998) show the correlation for individual galaxies between metallicity and average IS (Si II, O I, Si III, and C II) as well as wind (C IV and Si IV) absorption EWs. However, since the Si IV and C IV lines show very different EWs we re-extract the spectra from the NED archive 5 and measure the EWs of the lines separately on stacked spectra of different metallicity bins to be consistent with our methods.
The Leitherer et al. (2011) sample consists of a compilation of 46 spectra in sub-regions of 28 local star-burst and star-forming galaxies 6 with moderateresolution (R ∼ 1300) UV spectral coverage of 1150 − 3200Å as well as metallicity measurements from the literature. The spectra were obtained by the Faint Object Spectrograph (FOS, Harms et al. 1979) as well as the Goddard High Resolution Spectrograph (GHRS, Brandt et al. 1994) onboard the Hubble Space Telescope (HST). The metallicity of the sample ranges from 12 + log(O/H) = 7.5 to 12 + log(O/H) = 9.5. Out of these 46 spectra, we have carefully chosen 22 for which there is good data coverage across the spectral features examined in the previous section and that show no emission due to the O I airglow line at 1304Å as this would impact the measurement of the Si III absorption complex at 1300Å. The lower panels of Figure 1 show the stacked spectra in four different metallicity bins in the same five spectral ranges as for the BPASS models. The composites quantitatively show the connection between strong IS absorption and metallicity. Furthermore, the blue wing of C IV is more pronounced for metal rich systems in agreement with stellar winds having higher terminal velocities in high metal abundance regions as expected from the BPASS models. Figure 2 shows the correlation between EW and metallicity for the Leitherer et al. (blue circles) and Heckman et al. (green squares) galaxies binned in metallicity. The horizontal error bars represent the dispersion of metallicities in each bin and the vertical error bars are derived from a Monte-Carlo sampling accounting for the uncertainties in the measurements of the continuum. We find a relatively tight, monotonic relation between the EWs and the metallicity in good agreement with the BPASS models for the wind dominated lines Si IV and C IV. The models, however, do not treat the ISM part of absorption and therefore under-estimate the EW of the low-ionization (pure IS) absorption complexes around Si III and C II (the same is partially true for Si IV).
2.3. Galaxies at z ∼ 2 − 3 To verify the local relation at higher redshifts, we repeat the previous test at z ∼ 2−3. First, we use a sample of 20 galaxies at 2.1 < z < 2.5 presented in Maier et al. (2014) with zCOSMOS-deep (see Lilly et al. 2007) UV spectra in the observed wavelength range 3600 − 6800Å and metallicities estimated by a simultaneous fit (using the Kewley & Dopita (2002) models) to five optical emis- -Correlation between the rest-frame EW of UV absorption features at 1200 − 1600Å and gas-phase metallicity. The dotted, dashed, and solid magenta lines show BPASS models with stellar population ages of 10, 100, and 500 Myrs, respectively. The symbols show galaxy samples with observed rest-frame UV absorption features and metallicities measured by the strong-line methods. These samples have been compiled at different redshifts and are binned in metallicity: local (blue squares, green circles; Heckman et al. 1998;Leitherer et al. 2011), z ∼ 2 (yellow triangles; Maier et al. 2014), and z ∼ 3 (red diamonds; Onodera et al. in prep.). Note that the BPASS models under-estimated the EW of low-ionization IS absorption features that are mainly produced in the ISM of galaxies that are not included in the models (see text). We verify that the locally observed EW vs. metallicity relation to hold up to redshift of z = 2 − 3. The fitted parameters are given in Table 1, the fit is shown as black solid line. The hatched region shows the range of EWs for our z ∼ 5 galaxies with log(M/M ) > 9.0.  Maier et al. 2005). For each of these galaxies, we retrieve fully calibrated zCOSMOS-deep UV spectra and measure the EW of the UV absorption features on composite spectra in bins of metallicity as it will be outlined in the later sections where we describe the measurements on our z ∼ 5 galaxy sample. The result is shown in Figure 2 (yellow triangles). The measurements at z ∼ 2 agree well with the local EW vs. metallicity relation at 12 + log(O/H) ∼ 8.5.
A further test is conducted using a sample of 11 galaxies at z ∼ 3 with metallicities ranging between 8.0 < 12 + log(O/H) < 8.8 from Onodera et al. The EWs of UV absorption complexes are derived from zCOSMOS-deep UV spectra using the same methods as for the z ∼ 2 galaxies. The galaxies (stacked in three metallicity bins by a running mean) are shown with red diamonds in Figure 2. They agree well with the local relation and the z ∼ 2 galaxies.
Overall the EW vs. metallicity relation appears to hold up to z ∼ 3, a time range of 11 billion years.

The UV EW vs. metallicity relation
Since the relation is verified to be valid up to z ∼ 3, we fit this relation for each UV absorption complex by a 2 ndorder polynomial function of the metallicity Z (expressed in 12 + log(O/H)). The fit is valid between 7.3 < 12 + log(O/H) < 9.5. The coefficients for each of the UV absorption complexes are given in Table 1 and the best fit is shown in Figure 2 as solid black line. We estimate the errors on the fit using a Monte-Carlo simulation including the errors on the EW measurements and the widths of the metallicity bins. We now apply this relation to a sample of z ∼ 5 galaxies, which we describe in the following section.
3. SAMPLE OF Z ∼ 5 GALAXIES 3.1. DEIMOS campaign on the COSMOS field The data is based on the spectroscopic follow-up campaign of the Cosmic Evolution Survey (COSMOS, Scoville et al. 2007) using the Deep Imaging Multi-Object Spectrograph (DEIMOS, Faber et al. 2003) on the Keck II telescope. This campaign was designed with the goal of building up a sample of high redshift galaxies that spans a wide range of stellar masses, dust, and galaxy activity, in order to study the mass assembly, black hole growth, and feedback processes that control star-formation in the early universe. In total, there are about 1,500 sources at redshifts z > 3.5, including galaxies, AGNs, as well as radio sources. The diverse sample consists of galaxies selected by photometric redshifts, continuum-selected Lyman Break galaxies dropping out in the B−, g−, V −, r−, i−, and z−band broad-band filters, narrow-band selected Lyα emitting galaxies in IA624, NB711, and NB816, and galaxies selected in the infrared as well as radio 7 . For more details on the sample selection we refer to Mallery et al. (2012).
The observations of the targets were carried out over the course of three years between January 2007 and February 2010. The DEIMOS set-up is a G830 grating blazed at 8640Å (optimal wavelength range is 5800 − 9800Å) with an OG550 blocker and 1 wide slitlets resulting in a resolution of 3.3Å (or R ∼ 2600, δv = 130 km s −1 ). This is sufficient to distinguish the [O II]λ3727 doublet structure and provides secure redshifts. The average integration time per target is 3.5 hours in blocks of 30 minutes. The raw spectra were reduced and processed by the DEEP2 data reduction pipeline, which was modified to accommodate dithering. The relative flux calibration was performed by using calibration stars (HZ44, GD71, Feige110) that were observed in the same configurations as the science masks in each individual night and for the absolute flux calibration we used the existing multi-wavelength photometry available on COSMOS.

Sample selection and spectroscopic redshifts
3.2.1. General sample selection The spectroscopic redshifts of the galaxies are determined to 1st order by their Lyα emission as well as lowand high-ionization absorption lines (the spectra are analyzed manually by using SpecPro; Masters & Capak 2011). The Lyman break detected by broad-band photometry is simultaneously used to support the redshifts. A quality flag between 1 (very uncertain redshift) and 4 (very certain redshift) is assigned based on the number of people (three in total) agreeing on the visually estimated redshift. The redshift distribution peaks at z ∼ 1.0 and z ∼ 4.5. For the purpose of this work, we choose galaxies with 3.5 < z < 6.0 (with z ∼ 4.8, see Figure 3) in order to have access to their rest-frame UV wavelength range (1200 − 1800Å). In an additional step we manually remove galaxies with (broad) C IV emission at 1550Å that indicates a substantial contribution from active galactic nuclei (AGN, e.g., Allen et al. 1998).

Determination of redshift
The determination of systemic redshifts is difficult at high redshifts due to strong outflows and resonant scattering of UV spectral features. For our sample of galaxies, the systemic indicators are either blended and too faint to be observed in individual galaxies (photospheric Redshift distribution for galaxies with Lyα detection -the final sample used this work (blue) measured by fitting a skewed gaussian to the emission line. The red hatched histogram shows the distribution of redshifts for single galaxies determined from IS absorption features (Si II, C II, Si III, C IV). The green hatched histogram shows galaxies for which redshifts from Lyα and IS absorption features are available. Bottom: The stellar mass distribution of galaxies with Lyα redshifts (gray) and with only weak or no Lyα emission (red). The stellar mass are obtained by SED fitting of 32-band COSMOS photometry including deep Spitzer/IRAC photometry (Laigle et al. submitted) to a comprehensive template library using the publicly available code Le Phare. The stellar masses are measured for a Chabrier (2003) IMF.
lines Si III, C III, N IV and Fe V), or fall out of the wavelength range of ground-based near-IR spectrographs (nebular lines Hα, Hβ and [O III]).
The most prominent spectral features of high-z starforming galaxies are the Lyα emission, IS absorption lines (Si II, C II, Si IV, C IV), and the blended photospheric Si II/C III/O I line complex at 1300Å. The photospheric lines are blended and cannot be used to derive systemic redshifts. The Lyα emission and IS absorption lines are affected by galactic winds and therefore shifted red-and blue-ward, respectively, by up to 1000 km s −1 (e.g., Pettini et al. 2000Pettini et al. , 2002Steidel et al. 2010;Leitherer et al. 2011). These different velocity shifts have to be taken into account when stacking the spectra.
For this work, we aim for a galaxy sample that is as complete as possible in photometric and spectral proper-ties. Thus we include galaxies for which the Lyα line is detected as well as galaxies that have weak or no Lyα emission or even Lyα in absorption. For the former, the redshifts (z Lyα ) are obtained by the fitting of a skewed gaussian profile to the Lyα emission line thereby accounting for the absorption on the blue side. For a detailed description of this procedure, we refer to Mallery et al. (2012). The redshifts of the latter (z IS ) are measured from their IS absorption lines (Si IV as well as C IV and C II). The top panel of Figure 3 shows the distribution of Lyα redshifts (blue), the distribution of IS absorption redshifts (red) as well as the redshift distribution for galaxies for which a redshift from Lyα and IS absorption features is available (green). The spike at z ∼ 5.7 contains galaxies selected in narrow-band imaging and therefore strong Lyα emission. We have checked that these galaxies do not bias our sample.
In the following stacking analysis, we will treat these samples (i.e., galaxies with and without Lyα emission) separately but will eventually combine them for the measurement of metallicity. This allows us to investigate possible selection effects that would occur if only focusing on one of the two populations. Also, we note that galaxies have in general a diversity of velocity offsets between IS absorption lines and Lyα emission. This complicates the stacking analysis and also affects quantities measured on the composite spectrum. We will investigate and discuss this later in this paper.

Stellar masses
The stellar masses for our galaxies are derived from the fitting of COSMOS 32-band photometry from far-UV to IR (including-broad and narrow-bands in the optical) to a large library of spectral energy distribution (SED) templates at fixed spectroscopic redshifts using the publicly available code Le Phare (Arnouts et al. 1999;Ilbert et al. 2006;Laigle et al. submitted). In the following, we briefly outline the procedure to obtain stellar masses for our galaxies. For more details on the SED fitting procedure, the imaging data reduction, and the extraction of the photometry we refer to Laigle et al. (submitted) as well as Capak et al. (2007), McCracken et al. (2012 and Ilbert et al. (2010Ilbert et al. ( , 2013. The library of synthetic templates is based on Bruzual & Charlot (2003) stellar population synthesis models, assuming a Chabrier (2003) initial mass function (IMF) 8 . Star-forming templates include common emission lines ([O II], [O III], Hα, Hβ, and Lyα ), which fluxes we define to be proportional to the UV luminosity (Kennicutt 1998). Accounting for emission lines in SED fitting is crucial at z 4 to avoid a systematic over-estimation of stellar masses (up to factors of two at z ∼ 5 − 6) as well as biases in the measurement of colors (e.g., Schaerer & de Barros 2009;Stark et al. 2013;Wilkins et al. 2013;González et al. 2014;de Barros et al. 2014;Santini et al. 2015;Faisst et al. in prep.). We use exponentially declining star-formation histories (SFHs) with τ = [0.3, 1, 3, 5, 30] Gyr along with delayed models (SFR(t) ∝ τ −2 te −t/τ ) in which the peak of star formation happens after τ = [0.1, 0.5, 1, 3] Gyr. We take spectroscopic 0 < z < 6 3 < z < 4 z > 4 z > 5 7 8 9 10 11 12 7 8 9 10 11 12 log M (with mid−IR) log M (no mid−IR) spectroscopic 0 < z < 6 3 < z < 4 z > 4 z > 5 6.5 7.5 8.5 9.5 6.5 7.5 8.5 9.5 log age (with mid−IR) log age (no mid−IR) Fig. 4.-The importance of deep mid-IR data for the computation stellar masses of z > 3.5 galaxies. The two panels show the stellar masses and light-weighted ages of the stellar population from SED fitting including and omitting mid-IR data from Spitzer/IRAC. The symbols are colored as a function of spectroscopic redshifts (gray dots: 0 < z < 6; gray open circles: 3 < z < 4; blue points: z > 4; red squares: z > 5). Not using mid-IR data at z > 3 results in over-estimated stellar masses by up to one magnitude at log(M/M ) < 10.0 as well as over-estimated ages for young galaxies by more than one order of magnitude at z 3.
into account different metallicities (Z and 0.2Z ), and vary E(B − V) between 0 and 0.8. For the extinction curve we assume the following parameterizations: a λ 0.9 law (see Arnouts et al. 2013) and a Calzetti et al. (2000) parametrization including a distinct 2175Å feature that is observed in the extinction curve of the Milky Way and Large Magellanic Cloud as well as in galaxies at z = 2−4 (e.g., Savage & Mathis 1979;Fitzpatrick 1989;Scoville et al. 2015a). We do not find a significant difference in the stellar mass estimates using the original Calzetti et al. (2000) dust extinction curve. The stellar masses (including active stars and remnants) are defined to be the median of the probability distribution function after marginalizing over the templates. The bottom panel of Figure 3 shows the stellar mass distribution for galaxies with Lyα emission (gray) and with weak or no Lyα emission (red).
The final sample that is used in the following consists of 224 galaxies in the redshift range 3.5 < z < 6.0 and stellar masses log(M/M ) > 8.0. Of these, 182 are detected in Lyα emission and 42 show weak or no Lyα emission.
3.3.2. Aside: Importance of mid-IR photometry at z > 4 At redshifts of z 3.5, the observed optical to near-IR photometry does not cover the 4000Å Balmer break, which is a sensitive measure of various parameters describing the stellar populations of a galaxy. Therefore, stellar mass estimates at high redshifts that lack mid-IR photometry can be severely biased. To overcome this problem, we use the Spitzer Large Area Survey with Hyper-Suprime-Cam (SPLASH, see Steinhardt et al. 2014) on COSMOS. The SPLASH provides Spitzer/IRAC data at 3.6 µm and 4.5 µm that are ∼ 2 magnitudes deeper (> 25.5 mag at 3σ in 3 apertures) than existing mid-IR data on COSMOS and therefore allows to measure reliable stellar masses at z > 4 by providing a deep coverage of wavelength redder than the 4000Å break. The Spitzer photometry is extracted using an improved version of IRACLEAN (Hsieh et al. 2012) in order to overcome the sources confusion (blending) in the Spitzer imaging data. For optimal de-blending, the combined zY JHK s images have been used as a prior for the position and shape of the sources (for more details, see Laigle et al. submitted).
To demonstrate the importance of the mid-IR data, we have performed the stellar mass fitting with and without the addition of mid-IR data from SPLASH. As shown in Figure 4, excluding mid-IR photometry results in an over-estimation of the stellar masses at log(M/M ) < 10.0 by up to an order of magnitude at z > 3. Stellar population ages are over-estimated by the same amount. This illustrates that without constraints in the mid-IR, the SED fitting of these high-z galaxies is dominated by the rest-frame UV part of the spectral energy distribution, i.e., directly proportional to the UV continuum slope β with no constraints on the 4000Å break.

COMPOSITE SPECTRUM OF Z ∼ 5 GALAXIES
In practice, investigations of spectral features as a function of physical parameters (e.g., stellar mass, see below) requires us to stack individual galaxy spectra because of the low S/N in individual spectra. In this section we describe the stacking procedure and the measurements as well as bias correction of the EWs.  1679Å). We use the same wavelength windows to fit the continuum, which we use to rectify the individual galaxy spectra before stacking to account for their different UV continuum slope. The composite spectrum is created by the median stacking of the individual, rectified and normalized spectra in the rest-frame of the Lyα emission line in the case of galaxies detected in Lyα and in the rest-frame of IS absorption lines in the case of weak or no Lyα emission.  I I I  L y a  N  V  N  V  C  I I I  S I I S i I I  S i I I I  S i I I I  S i I I I  O  I  S i I I  C  I I  C  I I *  S i I V S i I V  S i I I I  S i I I  S i I I * C  I V  C  I V  F e I I  F e I I  H  e I I  A  l I  In the former sample (with Lyα emission), the brightest and highest S/N galaxies with strong observed absorption features, however few in numbers, could bias the derived composite spectrum. We have checked, by removing 12 galaxies fulfilling this criteria, that the inclusion of these does not affect the results of this paper.
The binned and rectified z = 4.8 composite spectrum in the rest-frame of Lyα emission is shown in Figure 5 for galaxies with Lyα emission (black line) and with weak or no Lyα emission (red solid line). For a better comparison of the two stacks, we have shifted the latter into Lyα rest-frame according to the average velocity offset between Lyα and IS absorption lines measured for individual galaxies (see Appendix A). The most prominent spectral features are indicated by vertical lines.
One could argue that the comparison of these two composites is unfair since the stacking in the rest-frame of the IS absorption lines may produces more enhanced absorption features than in the case of the composite in the rest-frame of Lyα emission. This because galaxies show a distribution in velocity offsets between Lyα and IS absorption lines that could blur the spectral features in the case of Lyα stacks. To investigate this effect, we artificially blur the composite spectrum for galaxies with weak or no Lyα emission by shifting the individual spectra randomly according to the gaussian velocity offset distribution with mean ∆v Lyα−IS = 429 ± 230 km s −1 as derived in Appendix A. We find that this effect is The rest-frame equivalent width (EW) of absorption features characterizes the physical properties of galaxies. In this section, we measure EWs of different spectral features that we will later use to quantify the metal content of our galaxies.
The EW of a spectral features is defined as where f λ,feat is the flux density across the absorption/emission feature and f λ,cont is the flux density of the continuum (both in erg s −1 cm 2Å−1 ). Here, we define a "pseudo-continuum" across the spectral feature by a linear interpolation of the median continuum measured red-and blue-ward in a 10 − 20Å window. In the case of absorption lines, we integrate over the pixels below this pseudo continuum and vice versa for emission lines. We find that the measurement of the pseudo continuum is the major source of uncertainty. This is especially true for galaxies at high redshifts and low S/N, and we therefore estimate the uncertainties of the measured EW by Monte-Carlo'ing over different pseudo continua, which are obtained including the errors in their flux densities.

Uncertainties, biases, and limitations
There are several biases and uncertainties in the measurements of the EWs. First, individual galaxies show different velocity offsets of absorption lines to systemic. Stacking them in the rest-frame of the Lyα emission line may cause a broadening of these absorption features. Second, there are uncertainties in the measurement of low EWs introduced by background noise. The latter does also set a detection limit.
We first investigate the effect of velocity offsets on the measured EW. For this we create 100 representations of a composite spectrum by shifting each individual spectrum according to the probability distribution of the velocity offsets derived in Appendix A and listed in Table 3. For each representation, we measure the EW of the absorption features and compute the 1σ dispersion (see Table 2). We find the corresponding error on the EW measurements to be less than 20%. This is smaller or similar to the measurement uncertainties of the EWs and therefore not a dominant source of error.
Next, we investigate possible biases in the measurement of the EWs due to the effect of background noise. We create artificial composite spectra with gaussian absorption features (placed at 1330Å) for a grid of input EWs and include a noise level that we measure on the real composite spectra. We systematically underestimate absorption EWs stronger than 1.5Å by ∼ 5%. EWs weaker than 1Å are still detected but with a more substantial over-estimation of up to ∼ 30% on average. Although these biases are small compared to the uncertainties in the measurements, we correct for these in the following.
In Table 3 we list the (corrected) rest-frame EW measured on the composite spectrum of log(M/M ) > 8 galaxies for five different absorption complexes (Si III (1300Å), C II (1335Å), Si IV (1400Å), C IV (1550Å), and Fe II (1610Å)) as well as He II. Note, that the uncertainty on the latter (only observable in the highest redshift galaxies) is large, because of the decreasing number of galaxies and S/N of the spectra at high redshifts.

Dependences on EW
Relations between metallicity (i.e., UV absorption EW) and dust, SFR, and stellar mass are expected from galaxies at lower redshifts (z < 2). In the following, we focus the dependence of UV absorption EWs on SFR and dust attenuation.
We derive the line of sight dust attenuation for our galaxies from the UV continuum slope β (log(f λ ) ∼ β log(λ)), which is fit on the COSMOS broad-band photometry between rest-frame 1300Å and 2200Å. We restrict our sample to galaxies for which at least four filters are available for the fitting of β. The SFRs are derived from SED fitting and do not include (rest-frame) far-IR data, hence should therefore be taken with caution. Figure 6 shows the positive correlation between EW and dust for all absorption complexes except Si IV. This might be due to the strong wind component in this line. The gray band shows the EW vs. β relation from local galaxies (Heckman et al. 1998) derived by inverting our EW vs. metallicity relation (see Section 2). This comparison shows the very similar behavior of dust vs. metallicity between local and high-z galaxies. Figure 7 shows the dependence of EW on SFR. We find a negative correlation, i.e., galaxies with high star-formation have a systematically lower EWs (or, equivalently, metallicities). This is expected in a picture where SFR is held up and fueled by the inflow of pristine (i.e., metal poor) gas. Also, metals can be expelled from (low mass) galaxies by strong outflows due to their high star-formation. The gray band shows the expected dependence of UV absorption EW on SFR (again derived by inverting the EW vs. metallicity relation) from z = 0 − 2.2 galaxies in the same stellar mass range (Mannucci et al. 2010). The relations are consistent with each other within 1 σ and indicate a continued relation between SFR and metallic-  Leitherer et al. (2011) and references therein.  -Dependence of EW of UV absorption complexes on UV continuum slope β (dust attenuation) measured from COSMOS broad-band photometry between 1300Å and 2200Å. The points show our measurements at z ∼ 5, the gray bands show the relation measured for local galaxies (Heckman et al. 1998). Both data agree well within 1σ for β > −2 (except for Si IV), indicating a correlation between dust and metal content in z ∼ 5 galaxies as it is seen in local galaxies. Si IV and C IV are strongly affected by winds, which might reduce their correlation with dust attenuation.
ity from low-z to high-z.
Summarizing, we find a significant correlation between UV absorption EW and dust as well as a negative correlation between UV absorption EW and SFR. These relations found here are in good agreement with what is expected from local and low-z galaxies.

Metallicity vs. stellar mass at z ∼ 5
We now investigate the dependence of UV absorption EW on stellar mass. For this, we split the sample of our 224 galaxies into three bins of stellar mass: 8.5 < log(M/M ) < 9.0, 9.0 < log(M/M ) < 10.0, and log(M/M ) > 10.0. We designed these bins to maximize the S/N as well as the baseline in stellar mass, but a different binning does not change our results.
In Figure 8 (see also Table 4), we show the UV absorption EWs as a function of stellar mass for each of the for absorption complexes. We split galaxies with Lyα emission and weak/no Lyα emission (only show for log(M/M ) > 9 because of their small number). While for log(M/M ) < 9 galaxies the Si IV and C II is in good agreement with the expectation of an increasing EW with stellar mass, C IV shows an excess and Si III a deficit in EW. This discrepancy can be explained by two reasons, namely (i) the lower S/N of the low mass galaxies and -Inverse correlation between EW of UV absorption complexes and star-formation (measured from SED fitting). The points show our measurements at z ∼ 5, the gray bands show the metallicity vs. star-formation relation for z = 0 − 2.2 galaxies based on emission lines (Mannucci et al. 2010). We have converted the metallicity to UV EW by using our relations presented in Table 1. The data agree well within 1σ, indicative that this inverse correlation at z ∼ 5 is real. This is expected in a picture where starformation is help up by inflow of pristine (i.e., metal-poor) gas.
(ii) their young ages predominantly < 100 Myr (also verified by the stellar population ages estimated from SED fitting). As described in Section 4.2.2, we correct for the former and therefore this effect cannot explain the discrepancies. The latter is expected to have a dominant impact on the UV EWs. As shown by the BPASS models (see Figure 2), galaxies younger than ∼ 100 Myrs show an excess in C IV and a deficit in Si III compared to older stellar populations at all metallicities. Unfortunately, this trend cannot be verified by the samples used to calibrate the EW vs. metallicity relation since these galaxies are not representative of these young stellar populations.
Focusing on log(M/M ) > 9, we find a systematically higher UV EWs for more massive galaxies in all of the absorption complexes except Si III. Note that we do not expect all absorption complexes to show the same behavior. This because these elements are produced in different regions of the galaxy. For example, Si III may be produced at lower temperature and deeper in the ISM compared to C IV or Si IV. The expected EW vs. stellar mass relations for z = 2.2 and z = 3.5 galaxies derived by inverting our EW vs. metallicity relation are shown as light and dark gray bands. For Lyα emitting galaxies, the EWs are comparable to the ones expected for -Dependence of EW of UV absorption complexes on stellar mass. The points show our data at z ∼ 5 (black dots). We split galaxies with Lyα emission (blue down-triangles) and weak/no Lyα emission (red up-triangles, only show for log(M/M ) > 9 because of their small number). The gray bands show the expected correlation from the mass vs. metallicity relations at z = 2.2 and z = 3.5 from the literature. We have converted the metallicity to UV EW by using our relations presented in Table 1. The data in the hatched region (log(M/M ) < 9) depend significantly on age, especially in the case of C IV and Si III (see text), and are therefore not considered here. At a fixed stellar mass, z ∼ 5 with Lyα emission galaxies show systematically > 1σ lower UV EWs than z = 2.2 galaxies, however, similar values than z = 3.5 galaxies. Galaxies with weak/no Lyα emission show enhanced EW similar to z ∼ 2.2 galaxies. z = 3 − 3.5 galaxies, however, the EW vs. stellar mass relations are shallower for our z = 5 galaxies by at least 1σ. For galaxies with weak/no Lyα emission, we find higher EWs comparable to galaxies at z ∼ 2.2.
Next, we convert these UV EWs into metallicities. For a given EW, we compute its corresponding metallicity by a χ 2 minimization to the 2 nd -order polynomial fit derived in Section 2. The errors are estimated by a Monte-Carlo sampling that accounts for the uncertainty of the EW measurements as well as the input EW vs. metallicity relation. This is done for each single absorption complex. We then compute a combined metallicity for all the absorption complexes by the weighted mean of the normalized probability distribution function derived from the single absorption complexes. The weights are determined from the covariance matrices of the corresponding EW vs. metallicity relations. The results are listed in Table 4. The symbols in Figure 9 show our results (for galaxies with and without Lyα emission) for the combined absorption complexes along with measurements from the literature at z = 0.07 (Kewley & Elli-son 2008), z = 0.7, 2.2, 3.5 (Maiolino et al. 2008), and z = 3.0 (Mannucci et al. 2009). The errors on the points include systematic uncertainties (from the measurement of the EW and the EW vs. metallicity relation) as well as the scatter in the metallicity measurements from single absorption complexes. The data reflects our previous results that (i) the metal content of z = 5 Lyα emitting galaxies is more than 2σ lower than at z ∼ 2 and (ii) galaxies with weak/no Lyα emission show enhanced metallicities comparable to z ∼ 2 galaxies. The MZ relation of the average population of z ∼ 5 galaxies is very similar to z ∼ 3.5. However, there are indications that it is slightly shallower.
Summarizing, we find a more than a factor of two lower metal content for the average population of z = 5 Lyα emitting galaxies compared to z = 2. On the other hand, they show similar metallicities than z = 3 − 3.5 galaxies and we find an indication of a shallower MZ relation, however, only with 1σ significance.

Lyα vs. weak/no Lyα emission
We have designed our sample to be as complete as possible, so it includes galaxies with strong Lyα emission as well as galaxies with weak or no emission. In the following, we investigate the properties of these two populations in more detail. Figure 9 shows the MZ relation split in galaxies with Lyα emission (blue) and with weak or no emission (red). The latter is only shown at log(M/M ) > 9 due to the lack of a sufficient number of galaxies in the lowest mass bin. At a fixed stellar mass, galaxies with weak/no Lyα emission show a more than a factor of two higher metal content than galaxies with strong Lyα emission at z ∼ 5. This is also reflected in their larger EWs (see Figure 8). In particular, their metal content is similar to that found in z = 2 galaxies in terms of its amount and also in terms of its dependence on stellar mass, where as strong Lyα emitters show no significant MZ relation. Lyα is resonantly scattered on neutral gas in the galaxy, which also traces dust. A weak Lyα emission therefore occurs in a dusty system, in agreement with having a higher average metal content. Summarizing, our results indicate that weak Lyα emitting galaxies are more evolved with higher dust and metal content. This result is strengthened by observation of a less prominent P-Cygni profile in these galaxies (see Figure 5). Strong Lyα emitting galaxies on the other hand show lower metallicities and a less significant MZ relation, indicative of them being young.

WHAT WOULD WE EXPECT THE MZ
RELATION TO BE AT HIGH-Z? Up to redshifts of z ∼ 3, a strong dependence of metallicity on stellar mass is measured. This indicates the gradual build-up of stellar mass and metallicity over time including feedback, gas inflows and outflows. Furthermore, metallicity is directly linked to the gas and dust content of galaxies (e.g., Roseboom et al. 2012;Feldmann 2015), inducing a relation between stellar mass and dust attenuation (e.g., Garn & Best 2010;Finkelstein et al. 2012;Sobral et al. 2012;Santini et al. 2014;Heinis et al. 2014;Oteo 2014). Also, it is expected that there exists an negative correlation between SFR and metallicity, which might be due to feedback or star-formation fueled by the This work (z~5) average Lyα and weak/no Lyα with Lyα emission weak/no Lyα emission 8.5 < logM < 9: 41 galaxies 9 < logM < 10: 113 galaxies logM > 10: 31 galaxies 8. -Gas phase metallicity as a function of stellar mass for galaxies at different redshifts. The large symbols show our results at z ∼ 5 split in galaxies with Lyα emission (blue), weak/no Lyα emission (red), and the average of both (black). The metallicities are obtained by a simultaneous fit to all the absorption complexes (see text). The dashed lines show different measurements from the literature at z = 0.07 (Kewley & Ellison 2008), z = 0.7, 2.2, 3.5 (Maiolino et al. 2008), and z = 3.0 (Mannucci et al. 2009). Lyα emitting galaxies at z ∼ 5 have a metal content similar to z ∼ 3 − 3.5 galaxies and only a weak dependence on stellar mass. Galaxies devoid of Lyα emission show a higher metallicity at fixed mass comparable to z ∼ 2 galaxies together with a stronger dependence on stellar mass. This is indicative of them being more evolved systems and highlights the diversity amongst z ∼ 5 galaxies.
accretion of pristine gas onto the galaxy (e.g., Mannucci et al. 2010). Galaxies at low-z have formed over several billion years and thus had time to reach an equilibrium state between the above quantities and to set up the observed relations. Several studies have shown that these relations hold up to redshifts as high as z = 3−3.5. A correlation between stellar mass and dust is even expected up to z = 7 (e.g., Finkelstein et al. 2012), although the stellar mass estimates in these studies are very uncertain due to the lack of deep observed mid-IR data.
Taking these local relations bluntly at face value and applying them to higher redshifts, we would thus expect positive correlations between metallicity (i.e., UV absorption line EW), stellar mass, and dust extinction as well as a negative correlation between metallicity and SFR. Indeed, our data show a correlation between dust attenuation and UV absorption EW as expected from local galaxies, indicating that the dust vs. metallicity relation is intact at z = 5 ( Figure 6). Furthermore, we see a negative correlation between SFR and UV absorption strength consistent with low-z data, indicative of strong -Dependence of UV continuum (dust attenuation) on stellar mass for our z ∼ 5 galaxies. We do not find a significant correlation between dust and stellar mass in contradiction to studies at lower redshifts.
accretion of pristine gas in high-z galaxies as fuel for their star-formation (Figure 7). However, we do not see  4 Bias corrected rest-frame EW measurements and estimated metallicities for z ∼ 5 galaxies split in different stellar mass bins. a significant correlation between stellar mass and dust attenuation ( Figure 10) for the average galaxy population and so it is not unexpected that we do not see a significant correlation between stellar mass and metallicity, either ( Figure 9). This indicates that something might be changing at z ∼ 5 and local relations start to weaken.

--------EW [Å] -12 + log(O/H) --------log(M/M ) # galaxies
What could be the cause for a weak relation between stellar mass and metallicity at z = 5? It might be that our assumption and observational techniques fail at these redshifts. First, the EW vs. metallicity relation may not be applicable at z > 3, however, it is unclear why this should happen over this time period. This cannot be tested until JWST. Second, galaxies at high-z are dominated by emission lines that can substantially boost their stellar masses (e.g., Schaerer & de Barros 2009;Atek et al. 2011;Stark et al. 2013;Faisst et al. in prep.). Although we include emission lines in our SED templates, their contribution and strength are not known reliably and the obtained stellar masses can still be biased (see e.g., Hsu et al. 2014). This effect would in particular boost the masses of low mass galaxies with significant [O III] emission (Atek et al. 2011). Third, there are indications that the strong line methods (used to calibrate our UV absorption line vs. metallicity relation up to z = 3) are less reliable at high-z due to the changing internal properties of the galaxies (Steidel et al. 2014;Masters et al. 2014;Shapley et al. 2015;Sanders et al. 2015a).
Keeping these caveats in mind, there might also be interesting physical reasons responsible for the weakening of the MZ relation. Several studies indicate that high-z galaxies behave differently and live in different environments than the average galaxy at low-z. They are characterized by a clumpy mode of star-formation (Förster Schreiber et al. 2011), caused by strong gas inflows in the dense and gas-rich high-z universe. They show shorter gas depletion times (e.g., Scoville et al. 2015b;Silverman et al. 2015) and a mass build-up on shorter timescales indicated by their high specific SFRs (Stark et al. 2013;Speagle et al. 2014;Faisst et al. in prep.). All these different properties of high-z galaxies and their surrounding have an impact on the observed MZ relation. In the following, we use a "bathtub model" approach (e.g., Lilly et al. 2013) to investigate this in more detail.
In brief, we assume a similar set of differential equation as set up in Feldmann (2015). We assume a mass -Theoretical prediction of the slope of the MZ relation as a function of different SFHs in the "bathtub" formalism. The SFH are parametrized by SFR(t) ∝ e t/τ with different τ as well as SFR(t) = const. We also assume two different gas depletion times (i.e., inverse of star-formation efficiency) of 50 and 200 Myrs (e.g., Scoville et al. 2015b). The MZ relations are normalized to their value at log(M/M ) = 10.5 in order to remove dependences from other constants (e.g., yield). The slope of the MZ relations significantly change with the assumed SFH. Flatter relations can be achieved by a star-burst like SFH with short τ . dependent mass loading factor as described in their equation 24, which is motivated by hydro-dynamical simulations of galactic winds (Hopkins et al. 2012). For the gas depletion time t depl we assume 200 Myr and 50 Myr independent of redshift (e.g., Scoville et al. 2015b). We let the galaxies evolve according to two different sets of SFHs in the ∼ 1 billion years to redshift z = 5. We assume three exponential increasing SFH with τ = 50, 150, and 300 Myr as well as a constant SFH with SFR 0 = 50 M /yr and SFR 0 = 100 M /yr. Figure 11 shows how the slope of the MZ relation derived from our simple bathtub model is affected by the different SFHs and gas depletion times. From our simple model, we expect that the slope becomes shallower for star-burst like SFH (i.e., exponentially increasing with a short τ ) as well as for short gas depletion times as long as τ > t depl . We note, that the uncertainty in our data does not allow us to constrain the model's parameters. Rather, the model should give  Figure 11). Our derived MZ relation at z ∼ 5, if real, requires star-formation on short time-scales, while at lower redshifts (e.g., z ∼ 3 − 3.5) a shallower SFH is favored. This hints towards a rapid growth of massive galaxies in the early epochs of our universe.
an idea what could happen at high-z and what we expect in terms of the evolution of the MZ relation to high redshifts.
Keeping this in mind, Figure 12 shows a sub-set of models normalized to log(M/M ) = 10.5 along with our estimates at z = 5 and data at lower redshifts. We pick a constant SFH with SFR 0 = 50 Myr and t depl = 200 Myr as well as an exponentially increasing SFH with τ = 150 Myr and t depl = 200 Myr matching well the data at z = 5 and z = 3.5, respectively. A shallower MZ relation is therefore in agreement with the mass build-up of in high-z galaxies on short timescales as expected from their high specific SFRs.
A mass build-up on short timescale might also prevent the galaxy population as a whole to have a clear relation between stellar mass and dust obscuration along the line of sight within the galaxy. It indicates that the processes that form the galaxies at high-z are more stochastic than at low-z. In the same stellar mass range (i.e., without dependence on mass), the dust and metallicity properties of these galaxies vary substantially. This is probed by our sample consisting of galaxies with strong Lyα emission as well as galaxies showing weak/no Lyα emission. Since Lyα is resonantly scattered off neutral gas (that is correlated with dust), weak Lyα emission is indicative of a higher dust column density and therefore a higher metal content of these galaxies. This is in agreement with our findings: weak Lyα emitting galaxies show stronger UV absorption (Figure 5), i.e., a higher metallicity that is similar to z ∼ 2 galaxies (Figure 9). Furthermore, their less prominent P-Cygni profile is indicative of an older stellar population; hence they are more evolved than strong Lyα emitting galaxies. Since they do have the same mass distribution and redshift as galaxies with strong Lyα emission, they might have experienced a more gradual formation over a longer time scale, closer to the SFHs of galaxies at z = 2 − 3. Interestingly, galaxies with Lyα deficit do show a more significant MZ relation ( Figure 9) comparable to z = 2 − 3 galaxies. This is in agreement with a SFH with a longer e−folding time as shown by our simple bathtub model approach.
Summarizing, we do expect a weakening of the MZ relation at z = 5 if galaxies are formed on fast, exponential time scales with e−folding times of 100 − 200 Myrs. The weaker MZ relation indicated by our data is supported by the lack of a significant correlation between stellar mass and dust attenuation. Furthermore, the z = 5 galaxy population is diverse, including (at the same masses) evolved galaxies with metal contents similar to z = 2 galaxies. The big diversity might be indicative of the process of galaxy formation at z = 5 being more stochastic and diverse. This could weaken the clear relations seen at lower redshifts.

SUMMARY & CONCLUSIONS
Emission features employed to measure metallicity in z 3 galaxies are red shifted out of the wavelength range of current ground-based detectors. It is therefore not possible to probe the metal content of z > 3 galaxies using these lines until the advent of JWST. Instead, we have to rely on alternative methods. In this paper, we use the correlation between metallicity and the EW of rest-frame UV absorption features to infer the metal properties of a large sample of galaxies at z ∼ 5.
We compile a sample of ∼ 50 local galaxies and calibrate the relation between metallicity and the most prominent absorption features seen in high-z galaxies (Si IV, C IV, Si III, C II). For the first time, we verify this relation to hold up to z ∼ 3 by using a sample of ∼ 30 galaxies at z = 2−3 with metallicity measurements from strong optical emission lines. We then apply (correcting for various biases) this method to a spectroscopic sample of 224 galaxies at z ∼ 5, which is constructed to be as diverse as possible in terms of physical properties of the galaxies. Most importantly, this sample allows us to investigate directly the properties of galaxies with strong Lyα emission as well as no or weak Lyα emission.
The findings of this paper are the following.
• The average population of z ∼ 5 galaxies shows very similar gas-phase metallicities as z ∼ 3 − 3.5 galaxies at a fixed stellar mass but a factor of ∼ 2 lower metal content compared to z ∼ 2.
• The positive correlation between metallicity and UV continuum slope and the negative correlation between metallicity and SFR agree very well with what is expected from low redshifts. This indicates the dependence of dust and metallicity to hold up to z ∼ 5 as well as a scenario where star-formation is held up by strong inflow of pristine (metal-poor) gas.
• We do not see a significant correlation between dust attenuation and stellar mass (as seen at lower redshifts). Also, we do not find a significant MZ relation at z ∼ 5 within the uncertainties of our measurements for Lyα emitting galaxies.
• We find a large diversity in our galaxy sample at z ∼ 5. Galaxies with weak/no Lyα emission (∼ 25% at log(M/M ) > 10.0) show a clear MZ relation with metallicities comparable to z ∼ 2. This is indicative of them being more evolved than systems with strong Lyα emission, which is supported by the less prominent P-Cygni profiles in their stacked spectra.
Taking our results at face value, there are multiple reasons for the lack of an apparent MZ relation at z ∼ 5. Most of these can be reduced to uncertainties in the measurements of the various parameters (in particular metallicity and stellar mass). However, if real, it allows us to constrain the build up of stellar mass in galaxies at these early epochs. Using a "bathtub-model" approach, we find that a shallow MZ relation can be caused by a fast build-up of stellar mass on the order of only a couple 100 Myrs. The fast formation of these galaxies might cause a more stochastic distribution of the properties and therefore weaken out possible relations that are seen at lower redshifts. This is supported by the observation of our set of galaxies devoid of Lyα emission that show a factor of two increased metal content at the same stellar masses than the rest of our sample at z ∼ 5.
For firm conclusions, the reliability of these measurements has to be improved and systematic effects have to be minimized. This can be done by (i) using stellar population models with a better treatment of the ISM effects to investigate in more depth the age and metallicity, and, (ii) targeting specifically low metallicity galaxies at lower redshifts to decrease the systematics of the EW vs. metallicity relation. The galaxy sample presented in this work spans a wide range in physical parameters and stems from a spectroscopic survey that is as complete as possible. This sample is therefore ideal to follow-up by JWST, which will be able to measure metallicities for these galaxies and verify our results.

VELOCITY OFFSETS DUE TO OUTFLOWS AND WINDS IN Z ∼ 5 GALAXIES
Winds and outflows are common in local star-burst and star-forming galaxies at high redshifts and related to their metal content. A direct evidence for strong outflows and winds in our sample at z ∼ 5 are the strong P-Cygni profiles seen in the C IV and Si IV absorption lines (see Figure 5). Different velocity offsets of the galaxies can cause biases and uncertainties in the measurements of the spectral properties on stacked spectra. For example, this can lead to a broadening of absorption features or their complete removal in the stacked spectra. In this section, we provide estimates of velocity offsets due to outflows and winds in our z ∼ 5 galaxies that we use to quantify the uncertainties in the EW measurements. Moreover, these measurements are useful for further studies of this galaxy sample in the future. Figure 13 shows the velocity offset of the IS absorption lines with respect to Lyα (∆v Lyα−IS ) for individual galaxies for which both Lyα and IS absorption is observed. We find a mean velocity offset of ∆v Lyα−IS ∼ 538 ± 189 km s −1 for the most secure IS absorption redshifts and ∆v Lyα−IS ∼ 429 ± 229 km s −1 if including all galaxies with measured IS absorption. This is broadly consistent with measurements of ∼ 50 galaxies at z ∼ 2−3 (Steidel et al. 2010) shown by the the blue dashed histogram. The ∆v Lyα−IS measurements on the composite spectrum for single absorption features are given in Table 3 and range between −1000 km s −1 and −380 km s −1 . The uncertainties of these measurements  Fig. 13.-Distribution of velocity offset between Lyα and IS absorption features for galaxies for which both can be measured (all galaxies: light gray, most secure: dark gray). The data from Steidel et al. (2010) at z = 2 − 3 is shown in dashed blue.

Velocity offsets between IS lines and Lyα
are conservatively estimated as ±100 km s −1 , which is twice a resolution element (100 km s −1 or 0.5Å). The median over all absorption lines (∼ 570 km s −1 ) is consistent with the values for individual galaxies shown in Figure 13.

Systemic velocity offsets of Lyα and IS lines
Finding the absolute velocity components of Lyα and the absorption lines (∆v sys ) with respect to systemic is more difficult as we need to measure the systemic redshift of the galaxies from photospheric absorption or emission lines, which is not possible for most of the individual galaxies because of their low S/N. However, the complex of photospheric lines at 1300Å consisting of Si III, C III, and O I is clearly detected in the composite spectrum. Unfortunately, these lines are blended and therefore an exact systemic redshift cannot be assigned. In addition, because of the different velocity offsets of the individual galaxies, the stacking in the Lyα rest-frame changes the measured systemic redshift from the true.
Since our galaxies on average show similar ∆v Lyα−IS values as the Steidel et al. (2010) sample at z = 2−3 (Figure 13), we use their galaxies (which have systemic redshift from Hα measurements) to investigate the systematic biases when measuring ∆v sys from the composite spectrum. These simulations are detailed in the next section and we summarize the main points in the following. First, from Steidel et al. (2010) we know that the point of largest absorption of the Si III/C III/O I-complex is a good tracer of the systemic redshift. We then use the systemic redshifts obtained for 8 of our galaxies from the measurement of the C II fine-structure line at 157.7µm using the Atacama Large Millimeter/Submillimeter Array (ALMA) to verify our approach (Capak et al. 2015). An extensive Monte-Carlo simulation using the Steidel et al. (2010) sample as input finally shows that there is a bias towards bluer velocity offsets for Lyα and IS absorption of 40 km s −1 and 90 km s −1 , respectively. This is mainly due to the stacking of galaxies with different ∆v Lyα−IS in the Lyα rest-frame as mentioned above.
The uncorrected and corrected (in brackets) velocity offsets as well as uncertainties from the Monte-Carlo run are listed in Table 3 for the different spectral lines. Note that the velocity offset of the He II emission is consistent with the systemic velocity measured by the blended O I line; this is an independent verification of the calibration of the systemic rest-frame. We find bias corrected velocities for IS absorption features of −200 ± 90 km s −1 and for Lyα 340 ± 170 km s −1 measured on the composite spectrum. Both the Lyα and IS absorption velocity offsets are in agreement with studies at z = 2 − 3 (∼ −160 km s −1 and ∼ 450 km s −1 , respectively; Steidel et al. 2010) suggesting similar wind properties of these galaxies.

Biases in the measurement of velocity offsets on composite spectrum
The systemic redshift of individual spectra can not be measured because of their low S/N, on the other hand, several photospheric lines are detected in the composite spectrum (the Si III/C III/O I line complex). These are however blended and might be offset from the true due to the stacking of galaxies with different velocity properties.
We investigate these effects by using a sample of 38 z = 2 − 3 galaxies observed by Steidel et al. (2010). These galaxies have UV spectra similar to ours (in particular similar ∆v Lyα−IS ) and in addition are observed in Hα from which systemic redshift can be measured. First, the analysis by Steidel et al. shows that the O I absorption line is a very good tracer of the systemic redshift measured by Hα if the deepest absorption of the Si III/C III/O I line complex is assigned to O I. This observation can in addition be tested by a set of 8 galaxies at z ∼ 5 with Lyα emission, which are observed with ALMA and have derived systemic redshift from the [C II] fine structure line at 157.7 µm (Capak et al. 2015). We stack these 8 galaxies in the Lyα rest-frame and measure a velocity offset between Lyα and O I of 160 ± 120 km s −1 . This is in excellent agreement with the true Lyα velocity offset to systemic (measured by the [C II] at 157.7 µm) which we measure to be −170 ± 70 km s −1 . The velocity offset between Lyα and IS lines is 490 ± 200 km s −1 , consistent with the median of the distribution shown in Figure 13.
The biases and uncertainties of velocity measurements using the blended O I line on the composite spectrum are investigated by a Monte-Carlo simulation. We create 38 model galaxies with two different fiducial absorption lines (O I for photospheric/systemic line and the redder line of the Si IV doublet as IS absorption line) as well as Lyα based on the velocity offsets shown in figure 2 of Steidel et al. (2010). The lines are parametrized by a gaussian with different full-width-at-half-maxima (FWHM) and rest-frame equivalent-width (EW) values. For Lyα we choose basis values EW = 10Å and FWHM = 2Å and for the IS and photospheric lines we choose basis values EW = (4, 2)Å and FWHM = (6, 8)Å, respectively. Furthermore, we add random noise to the each of the model spectra such that the S/N is between 2 and 10 as for our real galaxies.
We then create 200 composite spectra from the 38 model galaxies, each time changing their EW and FWHM by 20% as well as their noise level (between S/N of 2 and 10). On these we measure the velocity offsets of our fiducial Lyα and IS absorption line assuming the fiducial O I line tracing the systemic redshift. This simulation shows that we are able to recover the input velocity offsets reasonably well within 100 km s −1 from the true. However, we find a systematic bias for both ∆v Lyα and ∆v IS towards the blue by 40 km s −1 and 90 km s −1 , respectively. Also, the uncertainty on the measurements from the Monte-Carlo sampling are on the order of ±180 km s −1 and ±230 km s −1 , respectively. The corrected velocity values are given in Table 3 and are used to estimate the effect of velocity offsets on the measurement of EWs.