The aim of the project is to calculate the heat flux and the melting depth during microthermal machining using a scanning thermal microscope (SThM), based on a modified atomic force microscope (AFM). When the probe is scanned across the specimen surface, the thermal energy melted the surface and to make a nano-scale hot processing. However, the bad quality for the specimen is often yielded. Because the heat flux flown on the surface and the melting depth are difficult to accurately control during processing. Therefore, this project presents an inverse method for improving the problems. The heated cantilever probe with an unknown heat flux is considered as a one-dimensional inverse heat conduction problem firstly. The heat flux can be determined by using the available temperature measurements. The estimated heat flux flows into the specimen surface and then it is melted and divided into two layers of the solid and the liquid states. Then the two-layer materials are also regarded as an inverse heat conduction problem for determining the interface between the solid and the liquid. The procedures for the study are to establish the mathematical models of inverse heat conduction problems for the probe and the material firstly. Next, the conjugate gradient method is applied to treat the inverse problems; the method includes the following processes: the direct problem, the sensitivity problem, the adjoint problem, the gradient equation and the convergent condition. It is believed that the study can contribute to upgrade the technique for ultraprecision processing and to improve the quality for the products.