How accurate is duality? In economic theory we know that with the use of some calculus, Hotellings Lemma and Sheppards lemma we can derive a given firms supply function and in term its Profit function.

With data of a given firms costs, can we in fact get an accurate estimate of its profit function and supply function?
Let me focus on the use of duality theory in demand analysis (as this is what I'm most familiar with).
Direct approach
Usually, in order to obtain a demand system (which you can then estimate) you need to take the following steps.

specify a utility function $u(x_1, \ldots, x_n)$.
maximize this with respect to a budget constraint $\sum_i p_i x_i \le m$. .
Obtain a closed form solution for $x_i$ as a function of all prices $(p_1,\ldots, p_n)$ and income $m$.
Estimate these functions.

Step 3 is the trickiest part as usually no closed form solutions are possible. To see this, notice that the first order conditions give the following system:
$$
\frac{\partial u(x_1, \ldots, x_n)}{\partial x_n} = p_i\,\, \lambda,\\
\sum_i p_i x_i = m.
$$
Solving for $\lambda$ we have:
$$
\dfrac{\dfrac{\partial u}{\partial x_i}}{\sum_j \dfrac{\partial u}{\partial p_j}} = \frac{p_i}{m}
$$
This gives the (normalized) prices on the right hand side as a function of the quantities (so the inverse demand functions). To obtain a closed form solution of the quantities in terms of the functions, this system needs to be inverted. Except in some particular cases (e.g. Cobb-Douglas or CES) we do not know how to do this.
Dual approach
The dual approach starts from a specification of the expenditure function and uses known duality results to obtain a closed form expression for the demand functions. It takes the following steps:

Specify an expenditure function $e(p_1, \ldots, p_n,u)$.
Use Shephard's lemma to obtain the Hicksian demand function $h_i(p_1,\ldots, p_n, u)$.
Invert $e(p_1, \ldots, p_n, u)$ with respect to $u$ to get the indirect utility function $v(p_1, \ldots, p_n, u)$.
substitute $v(p_1, \ldots, p_n, u)$ in $h(p_1, \ldots, p_n, u)$ to get the Marshallian demands $x_i(p_1, \ldots, p_n, m)$.

As an exemple, consider the widely used Almost Ideal Demand System specification of Deaton &amp; Muellbauer
Start from the following (flexible) specification for the expenditure function.
$$
\ln e(p,u) = \alpha_0 + \sum_i \alpha_i \ln(p_i) + \sum_{i,j}\frac{1}{2}\gamma_{i,j} \ln(p_i) \ln(p_j) + u \prod_i p_i^{\beta_i}
$$
We impose $\gamma_{i,j} = \gamma_{j,i}$, and by homogeneity of degree 1 we have that $\sum_i \alpha_i = 1$ and $\sum_{i = 1}^n \gamma_{i,j} = 1$ and $\sum_{i} \beta_i = 0$.
First we can take the derivative $\frac{\partial \ln e(p,u)}{\partial \ln p_i}$ to get the demand share equations. Shephard's lemma gives:
$$
\frac{\partial \ln e(p,u)}{\partial \ln p_i} = \frac{p_i h_i(p,u)}{e(p,u)} = \alpha_i + \sum_j \frac{1}{2}\gamma_{i,j} \ln(p_j) + u \beta_0 \beta_i \prod_i p_i^{\beta_i}
$$
Here $h_i(p,u)$ is the Hicksian demand for good $i$.
Writing by $v(p,m)$ the indirect utility function, we know by duality between utility maximisation and expenditure minimisation that:
$$
m = e(p,v(p,m)) \text{ or } u = v(p,e(p,u)).
$$
Using this, we can invert the expenditure function to obtain the indirect utility function.
$$
v(p,m) = \frac{\ln m - \alpha_0 - \sum_j \alpha_j \ln(p_j) - \sum_{i,j}\frac{1}{2} \gamma_{i,j} \ln(p_i) \ln(p_j)}{\beta_0 \prod_i p_i^{\beta_i}}
$$
Also by duality, if $x(p,m)$ is the Marshallian demand function then:
$$
x_i(p,m) = h_i(p,v(p,m)).
$$
So we can substitute $v(p,m)$ into $h_i(p,u)$ to get the shares as a function of prices and income.
$$
\begin{align*}
s_i(p,m) &amp;= \frac{p_i x(p,m)}{m} = \alpha_i + \sum_j \frac{1}{2}\gamma_{i,j} \ln(p_j) + \beta_i \left(\ln m - \alpha_0 - \sum_j \alpha_j \ln(p_j) - \frac{1}{2}\sum_{i,j} \gamma_{i,j} \ln(p_i) \ln(p_j)\right),\\
&amp;= \alpha_i + \sum_j \frac{1}{2}\gamma_{i,j} \ln(p_j) + \beta_i \ln(m/P).
\end{align*}
$$
where:
$$
P = \alpha_0 + \sum_j \alpha_j \ln(p_j) + \sum_{i,j} \frac{1}{2}\gamma_{i,j} \ln(p_i)\ln(p_j).
$$
This is the Almost Ideal Demand System. Conditional on $P$, shares are linear in the log of income and log of prices. The symmetry and homogeneity restrictions immediately translate to conditions on the coefficients of this system.